<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.3315.2870" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Some tip to solve the problem with the saving of
xml files...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I have replaced the line <STRONG>FileWriter writer
= new FileWriter(file); </STRONG> with <FONT
color=#ff0000><STRONG>OutputStream writer = new
FileOutputStream(fichero);</STRONG></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>and creates the xml file correctly but I DON'T
understand why using a FileWriter Class in JSP run OK and in a stand-alone
application not.........</FONT></DIV>
<DIV><FONT face=Arial size=2>and a java Stand-alone apliccation with the line
<FONT color=#ff0000><STRONG>OutputStream writer = new FileOutputStream(fichero);
</STRONG></FONT><FONT color=#000000>run OK and creates the xml
file.......</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>What differences are between the FileWriter and
OutputStream classes??</FONT></DIV>
<DIV><FONT face=Arial size=2>What differences can be between the JSP application
and Java application envinronments???</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I wait your help, advices, tips, suggestions,
etc,etc...</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks from SpainĦĦĦ</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Pedro.</FONT></DIV>
<DIV><FONT face=Arial
size=2><STRONG> </STRONG></FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A href="mailto:ppalomo@hotpop.com" title=ppalomo@hotpop.com>Pedro</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
href="mailto:jdom-interest@jdom.org"
title=jdom-interest@jdom.org>jdom-interest@jdom.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, January 18, 2002 1:22
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [jdom-interest] HelpĦĦĦ
PleaseĦĦĦĦ Strange problem with JSP/XML/Java saving XML filesĦĦĦ</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Hi friends of XMLĦĦ</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I have a problem in my application. I use a
javabean to merge,copy,save xml files....and the problem is :</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> I have a JSP page that uses
this javabean and create/save an xml file correctly, but the same java code
and the same javabean in a separate Java application(stand alone JAVA
application) don't saves/writes the file correctly. When i try to open
the xml file with Internet explorer gives me an error because the
file is cutted. And it's strange that if I send the file to the
System.out the file seemingly correctly and complete.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> What can be my
problem??</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>The code of the function that writes/saves
the xml file is ......</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><STRONG><FONT face=Arial size=2>public boolean SaveXML(String
file,Document doc) throws IOException{<BR> </FONT></STRONG></DIV>
<DIV><STRONG><FONT face=Arial
size=2> FileWriter writer =
new FileWriter(file);<BR>
XMLOutputter outputter = new XMLOutputter("
",true);<BR> </FONT></STRONG></DIV>
<DIV><STRONG><FONT color=#00ff00 face=Arial
size=2> <FONT
color=#0000ff>// outputter.output(doc, System.out); In the
java program shows correctly the file in the Dos
Window</FONT></FONT></STRONG></DIV>
<DIV><STRONG><FONT color=#0000ff face=Arial
size=2> </FONT></STRONG></DIV>
<DIV><STRONG><FONT face=Arial
size=2> <FONT
color=#ff0000>outputter.output(doc, writer); </FONT></FONT></STRONG></DIV>
<DIV><STRONG><FONT face=Arial
size=2> // In JSP run OK and
create the file and in Java application cut the file but
</FONT></STRONG></DIV>
<DIV><STRONG><FONT face=Arial size=2> //
don't throws an </FONT><FONT face=Arial
size=2></STRONG><STRONG>exception<BR> </STRONG></FONT><FONT
face=Arial
size=2><STRONG> <BR> return
true;<BR> <BR> }</STRONG></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><PRE style="FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; LINE-HEIGHT: 12pt"> </PRE><PRE style="FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; LINE-HEIGHT: 12pt"> </PRE></FONT></DIV></BLOCKQUOTE></BODY></HTML>