> Hello,
> 
> getChildNodes()  function always returning  null pointer. When I am 
looking at User Groups mails,
> Dave mentioned,  to use getFirstChildNod() instead of getChildNodes.

XalanNode;:getChildNodes() is not supported -- our source tree has limited 
functionality, and only implements things we really need.  In addition, 
using getChildNodes() is really inefficient in almost all DOM 
implementations, so you should avoid it.

> My question is, if my XPATH expr is RESPONSE/ROUTCTL,  in my program, I 
have to return its not a LEAF_TAG/ something. 
> if my Xpath is RESPONSE/ROUTCTL/MSGNO, then I have to return value 
'BULK'. How can we do it?

The value bulk is represented in the tree as a text node, so you can 
simply use the XPath expression "RESPONSE/ROUTCTL/MSGNO/text()" to select 
the node directly.

> So, In our XML, there is sapce after ROUTCTL, so getFirstChild is 
alwways returns TEXT_NODE.
> 
> If we have getChildNodes(), we can do it what ever we want, by check 
each node type.

You can do the same thing by calling XalanNode::getFirstChild(), then 
iterate through the children by calling getNextSibling() on each child 
node:

for (XalanNode* current = parent->getFirstChild(); current != 0; current = 
current->getNextSibling())
{
...
}

None of your questions are Xalan-C specific.  You should find a good 
tutorial or book on the DOM, XPath, and XSLT.

Dave

Reply via email to