Does anyone know if there is a quick and easy way (using JAXP or any other Java XML parser) to convert the contents of a DOM to a String? I am used to working with Microsoft's parser so I apologize for the comparison (again), but MSXML's DOMDocument object has a method, .xml() which will convert the contents of the DOM into a String. Example: l_sXML = l_oXML.xml Debug.Print l_sXML The output might be something like "<junk><stuff>This is junk</stuff></junk>". This can then be passed around in code as a String. Anything like this in a (Java) DOM? Thanks.
You could use the XMLSerializer that comes bundled with Xerces. Here's a small code example -
Note that since XMLSerializer can write to any OutputStream, you can either write to a file or a String. Hope that helps!
------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. IBM Certified Developer - XML and Related Technologies, V1. [This message has been edited by Ajith Kallambella (edited June 07, 2001).]
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Men call me Jim. Women look past me to this tiny ad:
how do I do my own kindle-like thing - without amazon