This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes DOM Node to XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DOM Node to XML" Watch "DOM Node to XML" New topic
Author

DOM Node to XML

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Can some one please let me know if there is a utility/method to convert a DOM node to an XML. I have manipulated the Node object and I want to see it's contents. Can I print it in the form of an XML?
Thank you
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
It looks to me like you can create a javax.xml.transform.dom.DOMsource from a Node and then use a Transformer to process that Source to a Result which could write to a string or output stream.

See javax.xml.transform.stream.StreamResult
javax xml.transform.Transformer
etc.

Bill
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Thank you so much
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DOM Node to XML
 
Similar Threads
Removing the XML node from a DOM object
ParserImpl for DOM
Access DOCTYPE in DOM
How get Node's ID from DOM?
copy xml string into a dom tree