diff options
-rw-r--r-- | src/utils/xmlutils.cpp | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/src/utils/xmlutils.cpp b/src/utils/xmlutils.cpp index 937695d41..c437b0175 100644 --- a/src/utils/xmlutils.cpp +++ b/src/utils/xmlutils.cpp @@ -49,15 +49,24 @@ void readXmlIntVector(const std::string &fileName, continue; for_each_xml_child_node(childNode, sectionNode) { - if (!xmlNameEqual(childNode, itemName.c_str())) - continue; - - const int val = XML::getProperty(childNode, - attributeName.c_str(), -1); - if (val == -1) - continue; - - arr.push_back(val); + if (xmlNameEqual(childNode, itemName.c_str())) + { + const int val = XML::getProperty(childNode, + attributeName.c_str(), -1); + if (val == -1) + continue; + arr.push_back(val); + } + else if (xmlNameEqual(childNode, "include")) + { + const std::string name = XML::getProperty( + childNode, "name", ""); + if (!name.empty()) + { + readXmlIntVector(name, rootName, sectionName, itemName, + attributeName, arr); + } + } } } } @@ -86,17 +95,27 @@ void readXmlStringMap(const std::string &fileName, continue; for_each_xml_child_node(childNode, sectionNode) { - if (!xmlNameEqual(childNode, itemName.c_str())) - continue; - - const std::string key = XML::getProperty(childNode, - attributeKeyName.c_str(), ""); - if (key.empty()) - continue; - const std::string val = XML::getProperty(childNode, - attributeValueName.c_str(), ""); - - arr[key] = val; + if (xmlNameEqual(childNode, itemName.c_str())) + { + const std::string key = XML::getProperty(childNode, + attributeKeyName.c_str(), ""); + if (key.empty()) + continue; + const std::string val = XML::getProperty(childNode, + attributeValueName.c_str(), ""); + arr[key] = val; + } + else if (xmlNameEqual(childNode, "include")) + { + const std::string name = XML::getProperty( + childNode, "name", ""); + if (!name.empty()) + { + readXmlStringMap(name, rootName, sectionName, itemName, + attributeKeyName, attributeValueName, + arr); + } + } } } } |