julie_456
asked on
DOM Node to XML
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
Thank you
use a transformer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use JDOM to print the XML as it is
XMLOutputter xmlOutPutter=new XMLOutputter();
DOMBuilder domBuilder= new DOMBuilder();
System.out.println(xmlOutP utter.outp utString(d omBuilder. build(tran sformedDoc ument)));
XMLOutputter xmlOutPutter=new XMLOutputter();
DOMBuilder domBuilder= new DOMBuilder();
System.out.println(xmlOutP
If you want a quick and dirty way, see how it's done here:
http://technojeeves.com/joomla/index.php/free/63-xpath-tester
http://technojeeves.com/joomla/index.php/free/63-xpath-tester
It's a great pity that the JDK can offer nothing better than performing an xsl tranformation as a JDK-only way of doing one of the most fundamental things in XML programming