From 6bc8429475341ff717f022bbf3980e600681bf75 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Thu, 6 Jul 2023 15:03:41 +0900 Subject: [PATCH] AurumXML: enhance speed of creating XPath and disable creating XPath partially. Change-Id: Ie740042a901322c75eb1e88568adb647998682a8 --- libaurum/src/AurumXML.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libaurum/src/AurumXML.cc b/libaurum/src/AurumXML.cc index 36dfa1b..a52764a 100644 --- a/libaurum/src/AurumXML.cc +++ b/libaurum/src/AurumXML.cc @@ -41,11 +41,8 @@ void AurumXML::traverse(xml_node& element, const std::shared_ptr { if (!node) return; - node->updateUniqueId(); node->updateName(); - node->updateRoleName(); node->updateAttributes(); - node->updateToolkitName(); std::string name; if (node->getType().empty()) @@ -164,11 +161,11 @@ std::shared_ptr AurumXML::checkParentNode(const std::shared_ptr< const auto parent = node->getParent(); if (!parent) return nullptr; - const std::string query = makeQuery(node->getId()); + const std::string query = makeQuery(parent->getId()); xml_node xmlNode = mDoc->select_node(query.c_str()).node(); if (xmlNode) { - auto children = node->getChildren(); + auto children = parent->getChildren(); for (const auto &child : children) { if (child->getRawHandler() == nullptr) continue; @@ -190,11 +187,15 @@ xml_node AurumXML::checkNode(const std::shared_ptr& node) xmlNode = mDoc->select_node(query.c_str()).node(); if (!xmlNode) { + /* When node is deleted, XMLDoc doesn't know it so XMLDoc is not updated. + * Disable creating XPath partially. // 1. find parent and check node again auto parent = checkParentNode(node); // 2. clear tree and create tree again - if (!parent) createXMLtree(); + if (!parent) + */ + createXMLtree(); xmlNode = mDoc->select_node(query.c_str()).node(); } -- 2.7.4