| 547 | } |
| 548 | |
| 549 | std::list<ProjectFile::PropertyFile> ProjectFile::getPropertyFiles(const std::string& name) const |
| 550 | { |
| 551 | // <ObjectData Count="1"> |
| 552 | // <Object name="Mesh"> |
| 553 | // <Properties Count="1"> |
| 554 | // <Property name="Mesh" type="Mesh::PropertyMeshKernel"> |
| 555 | // <Mesh file="MeshKernel.bms"/> |
| 556 | // <Property/> |
| 557 | // <Properties/> |
| 558 | // <Object/> |
| 559 | // <ObjectData/> |
| 560 | if (!xmlDocument) { |
| 561 | return {}; |
| 562 | } |
| 563 | |
| 564 | std::list<PropertyFile> files; |
| 565 | DOMNodeList* nodes = xmlDocument->getElementsByTagName(XStrLiteral("ObjectData").unicodeForm()); |
| 566 | for (XMLSize_t i = 0; i < nodes->getLength(); i++) { |
| 567 | DOMNode* node = nodes->item(i); |
| 568 | if (node->getNodeType() == DOMNode::ELEMENT_NODE) { |
| 569 | DOMNodeList* objectList = static_cast<DOMElement*>(node)->getElementsByTagName( |
| 570 | XStrLiteral("Object").unicodeForm()); // NOLINT |
| 571 | for (XMLSize_t j = 0; j < objectList->getLength(); j++) { |
| 572 | DOMNode* objectNode = objectList->item(j); |
| 573 | DOMNode* nameAttr = |
| 574 | objectNode->getAttributes()->getNamedItem(XStrLiteral("name").unicodeForm()); |
| 575 | if (nameAttr && strcmp(name.c_str(), StrX(nameAttr->getNodeValue()).c_str()) == 0) { |
| 576 | // now go recursively through the sub-tree (i.e. the properties) and collect |
| 577 | // every file attribute |
| 578 | findFiles(objectNode, files); |
| 579 | break; |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | return files; |
| 585 | } |
| 586 | |
| 587 | void ProjectFile::findFiles(XERCES_CPP_NAMESPACE::DOMNode* node, |
| 588 | std::list<ProjectFile::PropertyFile>& files) const |
no test coverage detected