Hi,
I am working with Xerces 2.1 and Xalan 1.4.


I am trying to apply a namespace to the root node of a DOM_Document object.
For this I am creating an attribute node with the
DOM_Document::createAttributeNS() method giving it the
NamespaceURI("http://www.w3.org/2000/xmlns/") and qualified name (say
xmlns:abc).

Then I used the DOM_Element::setAttributeNodeNS() method to set the
attribute from the above method to the root element.

1)Using the
DOM_Element::getElementsByTagNameNS(DOMString("http://www.w3.org/2000/xmlns/
"), DOMString("abc:elemName")) method on the root node gives me 0 elements.

2) I also tried serializing this DOM to a file and reparsing it with a new
DOMParser object with DOMParser::setDoNamespaces(true) method. The
rootNode.getElementsByTagNameNS(DOMString("http://www.w3.org/2000/xmlns/"),
DOMString("abc:elemName")) again gave me 0 children.

3) Looking into the output file after serializing the DOM shows me the root
element as below:


.....child nodes.....



Could anyone give me pointers as to where I am going wrong. Also, is this
the correct way to apply a namespace to a DOM_Document object ? Basically I
have an XSL file which looks for elements with tag names : "abc:doc"
() and hense the whole exercise.

Detailed help would be highly appreciated.

AS.


Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.

Reply via email to