You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Peter Len <pe...@earthlink.net> on 2003/03/05 17:09:01 UTC

Help - how to create element with proper namespace

Hello,

I am simply trying to create a Element that will look like the
following:

<requestSummary xmlns="urn:expertmgmt">

I run into problems when using createElementNS or createAttributeNS.
Here is an exmaple of one of my attempts:

 Element root = doc.createElement("requestSummary");
 Attr att = doc.createAttributeNS("urn:expertmgmt", "xxx");
 root.setAttributeNode(att);
 RETURNS: <requestSummary xxx=""/>

Does anyone know how to create the element I need?

Thanks - Peter



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Help - how to create element with proper namespace

Posted by Joseph Kesselman <ke...@us.ibm.com>.
> <requestSummary xmlns="urn:expertmgmt">

Element root = doc.createElementNS("urn:epertmgmt","requestSummary");

******DO*****NOT****** continue to use createElement() or 
createAttribute(). These really are incompatable with namespace-aware DOM 
processing. 

We would have deprecated them, except that (a) W3C doesn't have a 
deprecation mechanism and (b) there is an (extremely limited) legitimate 
use for them: running ancient non-namespace-aware DOM Level 1 code against 
a Level 2 or later implementation of the DOM.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. 
"may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody 
gets hurt.")


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org