Altova Mailing List Archives>Archive Index >xml-dev Archive Home >Recent entries >Thread Prev - [xml-dev] Help on Creating Default Namespace using DOM Parser [Thread Next] Re: [xml-dev] Help on Creating Default Namespace using DOM ParserTo: "Phillip Ryan C. Ganir" <philliprs_yahu@-----.---> Date: 5/1/2006 7:31:00 PM 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 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
