Hi,
Is there a way to know the exact number of children a given node has, without counting the comments ?
Currently, I do:
unsigned int count = 0;


 // retrieve the NodeList of the RULES tag.
 DOMNodeList *sr_list = getElements(RULES);

 for (int i=0; i<sr_list->getLength(); i++)
   {
     DOMNode *node = sr_list->item(i);
     if (node->hasChildNodes())
   count += node->getChildNodes()->getLength();
   }

 // do not delete sr_list (to my understanding)
 return count;


==> but comments get counted. If I have:
<rule>
<A> ... </A>
<!-- My comment -->
<B> ... </B>
</rule>
count returns 3, and not 2.
Is there a way to filter out the comments (except doing it "manually" reading each item) ?


Regards
Axelle.


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



Reply via email to