• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Xml result is not coming.

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 81
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of putting a toString() on the StreamResult, you need to convert the StringWriter to a StringBuffer and have the toString() method to it.

stwriter.getBuffer().toString();
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Paul Clapham.
Now Its working fine.and also I will try to write some meaningful code now onwards.
Thanks once again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic