I am trying to create a XML document using JAXP 1.1 DOM tree with namespace. When I add a new element I use the method document.createElementNS(..). Once the whole DOM tree is created, I wish to write the DOM tree to a file. I am using Transformer class to write to file. What should I do to generate a XML file with namespaces in it ? If I have to use xsl to generate such a file, what should be the content of the xsl ?
You don't need to do anything special to create the document with Namespace declarations. If the DOM tree has a node with a reference to a namespace, when you persist the tree to an XML file( using transformation ) the namespace should appear in the XML file. If it doesn't then you have a problem in the code. Perhaps more specific information about your problem will help! ------------------ Ajith Kallambella M. Sun Certified Programmer for the Java�2 Platform. IBM Certified Developer - XML and Related Technologies, V1.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).