Next in thread → Next in month →

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

From
Pete Kirkham <>
To
"Phillip Ryan C. Ganir" <>
Date
2006-05-01T19:35:34Z
ID
<>
Thread
Re: [xml-dev] Help on Creating Default Namespace using DOM Parser
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
Next in thread → Next in month →