xml-parser: ensure that traverse-collectors are only collecting xmlnodes.
parent
87d2580aad
commit
0c05398602
|
@ -235,11 +235,11 @@ public:
|
|||
}
|
||||
|
||||
void collectChildrenPreOrder( XmlNode &node ) {
|
||||
if (node != mParent) {
|
||||
std::string name = node.name();
|
||||
|
||||
if (node != mParent && node.type() == pugi::node_element) {
|
||||
mNodes.push_back(node);
|
||||
}
|
||||
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
|
||||
for (XmlNode currentNode : node.children()) {
|
||||
collectChildrenPreOrder(currentNode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,4 +85,9 @@ TEST_F(utXmlParser, parse_xml_and_traverse_test) {
|
|||
bool empty = nodeIt.isEmpty();
|
||||
EXPECT_FALSE(empty);
|
||||
EXPECT_NE(numNodes, 0U);
|
||||
XmlNode node;
|
||||
while (nodeIt.getNext(node)) {
|
||||
const std::string nodeName = node.name();
|
||||
EXPECT_FALSE(nodeName.empty());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue