Am Dienstag, 29. März 2005 13:56 schrieb Michael Kochetkov:
> > Clearly you can download the source distribution of Xerces,
> > turn on RTTI and use dynamic_cast in your code.
>
> Our management prefer to have "official" builds.
>
> BTW, I have noticed that
> for (XMLSize_t i = 0; i < len; ++i) {
>         XS::DOMNode* curNode = myNodes->item(i);
>         XS::DOMElement* curElement =
> reinterpret_cast<XS::DOMElement*>(curNode);
>         XS::DOMNodeList *anotherNodeList =
> elem.getElementsByTagName(wsAgent.c_str());
>
> works pretty well indeed even if curNode does not contain child nodes
> (XS stands for the Xerces long namespace name). Does Xerces ever
> return pure DOMNode* pointers?

Hi Michael,

I use to take 'static_cast' in order to obtain a DOMElement-pointer from 
a DOMNode-pointer. But usually I check the type of the node actually to 
be DOMNode::ELEMENT_NODE before performing the cast.

static_cast is a weaker concept than dynamic_cast, sure. However, 
static_cast is a stronger concept than reinterpret_cast, since the 
compiler can check if there is a descent relationship between the 
types.

BTW: do there exist any C++-compilers which do not understand 
static_cast?

Cheers,
                        Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to