diff options
Diffstat (limited to 'xmlserializer')
-rw-r--r-- | xmlserializer/XmlElement.cpp | 14 | ||||
-rw-r--r-- | xmlserializer/XmlElement.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/xmlserializer/XmlElement.cpp b/xmlserializer/XmlElement.cpp index cea7a1d..11b9a94 100644 --- a/xmlserializer/XmlElement.cpp +++ b/xmlserializer/XmlElement.cpp @@ -166,6 +166,20 @@ bool CXmlElement::getChildElement(const string& strType, const string& strNameAt return false; } +uint32_t CXmlElement::getNbChildElements() const +{ + CXmlElement childElement; + uint32_t uiNbChildren = 0; + + CChildIterator childIterator(*this); + + while (childIterator.next(childElement)) { + + uiNbChildren++; + } + return uiNbChildren; +} + bool CXmlElement::getParentElement(CXmlElement& parentElement) const { _xmlNode* pXmlNode = _pXmlElement->parent; diff --git a/xmlserializer/XmlElement.h b/xmlserializer/XmlElement.h index 797179f..1028d60 100644 --- a/xmlserializer/XmlElement.h +++ b/xmlserializer/XmlElement.h @@ -64,6 +64,7 @@ public: // Navigation bool getChildElement(const string& strType, CXmlElement& childElement) const; bool getChildElement(const string& strType, const string& strNameAttribute, CXmlElement& childElement) const; + uint32_t getNbChildElements() const; bool getParentElement(CXmlElement& parentElement) const; // Setters |