OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Help on Creating Default Namespace using DOM Parser

[ Lists Home | Date Index | Thread Index ]

It's better to create the element in the namespace you want rather
than trying to change it, eg:

      Document svgDoc =
domImplementation.createDocument("http://www.w3.org/2000/svg";, "svg",
null);
      Element elt = svgDoc.createElementNS("http://www.example.com/";, "boo");
      svgDoc.getDocumentElement().appendChild(elt);

results in

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg";>
  <boo xmlns="http://www.example.com/"/>
</svg>

Pete




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS