wood burning stoves
The moose likes XML and Related Technologies and the fly likes Xml result is not coming. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Xml result is not coming." Watch "Xml result is not coming." New topic

Xml result is not coming.

Punya Pratap Singh
Ranch Hand

Joined: Nov 23, 2010
Posts: 81
I am sorry if I am posting it wrong forum,as I could not find the appropriate place.
As I am running this code It is working fine but the out put in xml file is not appropriate.

Out put should be ---
like this
But out put is coming as- javax.xml.transform.stream.StreamResult@9444d1

please help me as I am new in XML.

Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

Instead of putting a toString() on the StreamResult, you need to convert the StringWriter to a StringBuffer and have the toString() method to it.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Better still, get rid of the wasteful process where you generate XML to a String and then write it to a file (with the wrong encoding by the way). Just generate the XML directly to the file.

(This also removes about ten lines of code from your program. But beginners always write too much code...)
Punya Pratap Singh
Ranch Hand

Joined: Nov 23, 2010
Posts: 81
Thanks a lot Paul Clapham.
Now Its working fine.and also I will try to write some meaningful code now onwards.
Thanks once again.
I agree. Here's the link: http://aspose.com/file-tools
subject: Xml result is not coming.
It's not a secret anymore!