The Artima Developer Community
Sponsored Link

Java Answers Forum
xmlToFile(document, filepath) problem

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
nabakumar

Posts: 23
Nickname: nkmeitei
Registered: Jun, 2005

xmlToFile(document, filepath) problem Posted: Nov 20, 2005 11:23 PM
Reply to this message Reply
Advertisement
Hi all
I have a method which writes an xml (as a DOm object ) to the file system which is in another machine (by using drive mapping in WINDOWS OS ). For writing to the file system , I am using the following code :

public xmlToFile(Document document,String pathAndNameWithExtension){
File file = new File(pathAndNameWithExtension);
file.createNewFile();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformar = tFactory.newTransformer();
DOMSource domSource = new DOMSource(document);
FileOutputStream fos = new FileOutputStream(file);
StreamResult result = new StreamResult(fos);
transformar.transform(domSource, result);
}
Now the problem is that , when i open the xml in the destination folder , some xmls are not proper . some are not well formed , some have changed attrib names etc ...

Can anybody point out what may be the possible issue .
can the network be responsible for it ??

Thanks in advance
nab

Topic: Action Listeners Previous Topic   Next Topic Topic: Most Efficent method to transfer Data from Result Set object to flat file

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use