If you are using the C++ version, then the likely answer is this:

DOM_Element theElem = (DOM_Element&)theNode;

as the means to cast the raw node to its actual type.

Before you do though, check that it really is an element by getting the
node type (i.e. skip over text or other nodes that are likely to be in
there among the element nodes) or you will be in big trouble.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]



Indrajit Chaudhuri <[EMAIL PROTECTED]> on 02/24/2000 04:49:34 AM

Please respond to [EMAIL PROTECTED]

To:   xmldev <[EMAIL PROTECTED]>, xercesdev <[EMAIL PROTECTED]>
cc:
Subject:  Help required in setting an attribute in the DOM tree!!



Hi,

I am trying to set an attribute for an element in the DOM tree. What I
am doing is that :
* after parsing the document, I am getting a DOM_Document.
* from the document I am retrieving the elements corresponding to a
particular name in a DOM_NodeList using getElementsByTagName() method.
* now I can only retrieve DOM_Node from the nodelist using the item()
method. I can't find any method to retrieve the DOM_Elements from the
nodelist. Also I was not able to cast the DOM_Node into a DOM_Element.
* as such, I can't set the attribute using the setAttribute() method.

How can I set the attribute in the element? Is there any way out? TIA
for any help in this regard.

Thanks,
Indrajit



Reply via email to