You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Brian Lambert <br...@nearfx.com> on 2000/09/29 03:59:34 UTC

Question about DOM_Element vs. DOM_Node...

Hello,

I've just started to use Xerces as the XML parser in a program I'm working
on.  It works really well.

I have a small question, though, and I hoped someone on this list can help
me understand what I'm missing.

When I have a DOM_Element and I want to find a set if sub-elements by name,
I call DOM_Element::getElementsByTagName.  From this I get back a
DOM_NodeList.

But what I want is a DOM_ElementList (which doesn't exist)!

When I iterate through the set of entries in the NodeList, and I make sure
that I do indeed have an element, how do I change the DOM_Node to a
DOM_Element?

I found only one place in the whole source pack that seems to do this.

XMLDOMUtil seems to do this by using a static_cast operator:

			pObj->element = *(static_cast<DOM_Element*> (&node));

Question is, is this the best way to do this?  Seems kinda fishy.

Thanks!

Brian Lambert