fix 3mf rel-parsing

pull/2966/head
kkulling 2020-09-02 17:45:37 +02:00
parent 73fa2cbe88
commit 87d2580aad
1 changed files with 17 additions and 10 deletions

View File

@ -76,7 +76,10 @@ public:
void ParseRootNode(XmlNode &node) { void ParseRootNode(XmlNode &node) {
ParseAttributes(node); ParseAttributes(node);
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) { for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
ParseChildNode(currentNode); std::string name = currentNode.name();
if (name == "Relationships") {
ParseRelationsNode(currentNode);
}
} }
} }
@ -91,13 +94,15 @@ public:
return true; return true;
} }
void ParseChildNode(XmlNode &node) { void ParseRelationsNode(XmlNode &node) {
if (node.empty()) { if (node.empty()) {
return; return;
} }
for (XmlNode currentNode = node.first_child(); currentNode; currentNode = currentNode.next_sibling()) {
std::string name = currentNode.name();
if (name == "Relationship") {
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship()); OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
std::string name = node.name();
relPtr->id = node.attribute(XmlTag::RELS_ATTRIB_ID.c_str()).as_string(); relPtr->id = node.attribute(XmlTag::RELS_ATTRIB_ID.c_str()).as_string();
relPtr->type = node.attribute(XmlTag::RELS_ATTRIB_TYPE.c_str()).as_string(); relPtr->type = node.attribute(XmlTag::RELS_ATTRIB_TYPE.c_str()).as_string();
relPtr->target = node.attribute(XmlTag::RELS_ATTRIB_TARGET.c_str()).as_string(); relPtr->target = node.attribute(XmlTag::RELS_ATTRIB_TARGET.c_str()).as_string();
@ -105,6 +110,8 @@ public:
m_relationShips.push_back(relPtr); m_relationShips.push_back(relPtr);
} }
} }
}
}
std::vector<OpcPackageRelationshipPtr> m_relationShips; std::vector<OpcPackageRelationshipPtr> m_relationShips;
}; };