> At 17.03 29/03/2005 +0400, Michael Kochetkov wrote:
> > > >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?
> > >
> > > I don't get the issue: what do you mean by "works pretty well 
> > > indeed"? I cannot even guess what this code should do, as you
> >It does not crash.
> 
> Why should it? you are not using curElement, but an "elem" 
> object that I don't know where it comes from.
Well, it shell read curElement->getElementsByTagName indeed. Copy/paste and
later editing issue.

[...]
> >DOMElement* elem = (DOMElement*)elems->item(i); is reliable 
> and will remain
> >to be reliable in the future.
> 
> You can be sure that myNodes->item() call will always return 
> DOMElement 
> object if it is the return value of a getElementsByTagName. 
> But if it has 
> been returned by a call to getChildNodes it will contains DOMText, 
> DOMComment, etc...
> The correct programming would be checking for getNodeType to 
> be equal to 
> ELEMENT_NODE before casting to a DOMElement.
I have made use of hasChildNodes but I believe you are right -- ELEMENT_NODE
shall be more sutable. Though I consider it as a non-language workaround. I
do understand -- standard, portability issues, etc. So, please treat it as a
kind of a pedant's grumbling -- I do not argue.
Thanks a lot for your help.

--
Michael Kochetkov.


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

Reply via email to