<!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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have replaced the line <STRONG>FileWriter writer 
= new FileWriter(file);&nbsp;</STRONG>&nbsp;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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I wait your help, advices, tips, suggestions, 
etc,etc...</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks from SpainĦĦĦ</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Pedro.</FONT></DIV>
<DIV><FONT face=Arial 
size=2><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</STRONG></FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 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&nbsp;saves/writes the file correctly. When i try to open 
  the xml file with Internet explorer gives me&nbsp;an&nbsp;error because the 
  file is cutted. And it's strange that if I send the file to the 
  System.out&nbsp;the file&nbsp;seemingly correctly and complete.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; What can be my 
  problem??</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>The code&nbsp;of the function that writes/saves 
  the xml file is ......</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><STRONG><FONT face=Arial size=2>public boolean SaveXML(String 
  file,Document doc) throws IOException{<BR>&nbsp;&nbsp;</FONT></STRONG></DIV>
  <DIV><STRONG><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileWriter writer = 
  new FileWriter(file);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;XMLOutputter outputter = new XMLOutputter(" 
  ",true);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></STRONG></DIV>
  <DIV><STRONG><FONT color=#00ff00 face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT 
  color=#0000ff>//&nbsp;&nbsp;outputter.output(doc, System.out);&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></STRONG></DIV>
  <DIV><STRONG><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT 
  color=#ff0000>outputter.output(doc, writer); </FONT></FONT></STRONG></DIV>
  <DIV><STRONG><FONT face=Arial 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// In JSP run OK and 
  create the file and in&nbsp;Java application cut the file but 
  </FONT></STRONG></DIV>
  <DIV><STRONG><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // 
  don't throws an&nbsp;</FONT><FONT face=Arial 
  size=2></STRONG><STRONG>exception<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</STRONG></FONT><FONT 
  face=Arial 
  size=2><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 
  true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;}</STRONG></FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2><PRE style="FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; LINE-HEIGHT: 12pt">&nbsp;</PRE><PRE style="FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; LINE-HEIGHT: 12pt">&nbsp;</PRE></FONT></DIV></BLOCKQUOTE></BODY></HTML>