you can try using getelementbytagname (check the case) function with "*" as a parameter.
check out the domcount sample, it does this. -Vinayak > -----Original Message----- > From: Axelle Apvrille (LMC) [mailto:[EMAIL PROTECTED] > Sent: Friday, March 28, 2003 10:25 AM > To: [EMAIL PROTECTED] > Subject: Know the exact number of children of a given node ? > > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
