Hi,
I am attempting to creating an XML document and then serialize it into a
Java string. My code looks like:
Document doc= new org.apache.xerces.dom.DocumentImpl();
Element root = doc.createElementNS("http://www.foo.com", "ns1:data");
StringWriter stringOut = new StringWriter();
OutputFormat format = new OutputFormat();
XMLSerializer serializer = new XMLSerializer(stringOut, format);
serializer.asDOMSerializer();
serializer.serialize(root);
String xmlstr = stringOut.toString();
When I print out the xmlstr , I see that the namespace declaration is
missing. The prefix "ns1" is used but not declared. The XML printed is:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:data/>
What do I need to do to get the namespace declaration to appear in the XML
string.
thanks,
Tahura Chaudhry
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]