diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-19 16:14:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-19 19:24:17 +0300 |
commit | c3d462ec9610726c12f6b8174a72ee46800f7c4d (patch) | |
tree | 77ea235e03a39e4402cf7f5618be88d5f6791219 /protocols/JabberG/src | |
parent | caad82eecc865ff2222c181874811181a9a8809d (diff) |
XmlGetChildByTag should search through all children of the same key
Diffstat (limited to 'protocols/JabberG/src')
-rw-r--r-- | protocols/JabberG/src/jabber_xml.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp index 142f0bc331..3f5496d145 100644 --- a/protocols/JabberG/src/jabber_xml.cpp +++ b/protocols/JabberG/src/jabber_xml.cpp @@ -182,14 +182,11 @@ int XmlGetChildInt(const TiXmlElement *hXml, const char *key) const TiXmlElement* XmlGetChildByTag(const TiXmlElement *hXml, const char *key, const char *attrName, const char *attrValue)
{
- if (hXml == nullptr)
- return nullptr;
-
- auto *pChild = hXml->FirstChildElement(key);
- if (pChild == nullptr)
- return nullptr;
+ for (auto *pChild : TiXmlFilter(hXml, key))
+ if (pChild->Attribute(attrName, attrValue))
+ return pChild;
- return (pChild->Attribute(attrName, attrValue)) ? pChild : nullptr;
+ return nullptr;
}
int XmlGetChildCount(const TiXmlElement *hXml)
|