child element count
Brought to you by:
leethomason
It would be great if you could tell how much children a
node has. I need this function a few times in my
project, so I always add it manually to tinyXML. It
might be useful for other people too, so I post it here :
int TiXmlNode::ChildElementCount(const char *value) const
{
int count = 0;
const TiXmlElement* e = FirstChildElement(value);
while (e)
{
e = e->NextSiblingElement(value);
count++;
}
return count;
}
int TiXmlNode::ChildElementCount() const
{
int count = 0;
const TiXmlElement* e = FirstChildElement();
while (e)
{
e = e->NextSiblingElement();
count++;
}
return count;
}
Would be cool, if you can include that snippet into the
next release..
Cheers :-)