• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Creating Namespace XML document

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!