-----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 7:50 PM To: xalan-c-users@xml.apache.org Subject: Re: Need help with XalanNodeList
>>Will Sappington wrote: <snip> >Well, you need to include the header file that defines the class >XalanNodeList, which is src/xalanc/XalanDOM/XalanNodeList.hpp Duh. I had NodeRefList.hpp in the includes section and XalanNodeList in the XALAN_USING_XALAN() stuff. Getting kinda bleary eyed and missed the disconnect. >> >> I've tried casting the node pointer to an Element pointer based on some >> code I found in the list archive, trying to give the node list a type >> but that was no help. Any help from someone here would be greatly >> appreciated. Relevant code snippets follow: >> >Whatever code you found that casts a XalanNodeList pointer to a >XalanElement pointer is hopelessly broken, as they are unrelated types. It didn't look right but I wanted to exhaust other possibilities before coming back to the well again. ... >> if (theNodeType == XalanNode::ELEMENT_NODE) >> { >> /* element node */ >> >> if (theNode->hasChildNodes()) >> { >> const XalanNodeList* pChildren = pParent->getChildNodes(); >> >> //===> /* ** this line gets a compile error ** */ > >Once you include the appropriate header file, this will compile. However, >depending on which underlying implementation you're using, this may or may >not work. The default Xalan source tree implementation does not support >getChildNodes(), so if you're using that implementation, an exception will >be thrown. The wrapper around the Xerces-C DOM does support this function. > >The best way to do this to ensure your code will work with both >implementations is to use pParent->getFirstChild(), then use >child->getNextSibling() to navigate the children. > >Dave Thanks Dave, that was going to be my next attempt. The getChildNodes() looked really convenient for what I wanted to do, but I was getting to the point where I was ready to punt on this and do the getFirst..., getNext... thing. I'm working strictly in the Xalan world so the getChildNodes() method won't work anyway. Thanks very much for all your help today. -will