- To: "Phillip Ryan C. Ganir" <philliprs_yahu@y...>
- Subject: Re: Help on Creating Default Namespace using DOM Parser
- From: "Pete Kirkham" <mach.elf@g...>
- Date: Mon, 1 May 2006 20:35:34 +0100
- Cc: xml-dev <xml-dev@l...>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UQi0zZFQxGMjOuoaPi3U+5JVCB/XzKjXH/aJniW4G81wS9CugaihamYpllkLU/FeIHH74DqOZmymmY5dAuIg9OK6rDqcjFZodVv6TaKescMs74z7ZaJx68MqRY8GOLpDMaMYI/a6wmX0c9QPRsSDWPZho/iGqDArSivDG6nmEYc=
- In-reply-to: <20060501184240.99153.qmail@w...>
- References: <20060501184240.99153.qmail@w...>
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
|