[jdom-interest] Re: [jdom-interest] Help¡¡¡ Please¡¡¡¡ Strange problem with JSP/XML/Java saving XML files¡¡¡

Pedro ppalomo at hotpop.com
Fri Jan 18 04:59:37 PST 2002


Some tip to solve the problem with the saving of xml files...

I have replaced the line FileWriter writer = new FileWriter(file);  with OutputStream writer = new FileOutputStream(fichero);
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.........
and a java Stand-alone apliccation with the line OutputStream writer = new FileOutputStream(fichero); run OK and creates the xml file.......

What differences are between the FileWriter and OutputStream classes??
What differences can be between the JSP application and Java application envinronments???

I wait your help, advices, tips, suggestions, etc,etc...

Thanks from Spain¡¡¡

Pedro.
        

  ----- Original Message ----- 
  From: Pedro 
  To: jdom-interest at jdom.org 
  Sent: Friday, January 18, 2002 1:22 PM
  Subject: [jdom-interest] Help¡¡¡ Please¡¡¡¡ Strange problem with JSP/XML/Java saving XML files¡¡¡


  Hi friends of XML¡¡

  I have a problem in my application. I use a javabean to merge,copy,save xml files....and the problem is :

      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.
   
      What can be my problem??

  The code of the function that writes/saves the xml file is ......
   
  public boolean SaveXML(String file,Document doc) throws IOException{
    
           FileWriter writer = new FileWriter(file);
           XMLOutputter outputter = new XMLOutputter(" ",true);
           
          //  outputter.output(doc, System.out);  In the java program shows correctly the file in the Dos Window
          
          outputter.output(doc, writer); 
          // In JSP run OK and create the file and in Java application cut the file but 
          // don't throws an exception
                            
           return true;
       
    }


 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020118/30ea3549/attachment.htm


More information about the jdom-interest mailing list