AurumXML: clear XPath cache when findObject is called 74/296474/4 accepted/tizen/8.0/unified/20231005.093951 accepted/tizen/unified/20230919.091747
authorHosang Kim <hosang12.kim@samsung.com>
Fri, 28 Jul 2023 11:16:51 +0000 (20:16 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Mon, 18 Sep 2023 07:42:48 +0000 (07:42 +0000)
Change-Id: If04238af44c852029199aad5212d36540f954024

libaurum/src/AurumXML.cc

index a52764a..8f90001 100644 (file)
@@ -81,9 +81,10 @@ bool AurumXML::createXMLtree()
     if (!mDoc || !mRoot) return false;
 
     mDoc->remove_children();
+    mXNodeMap.clear();
 
     xml_node element = mDoc->append_child("");
-    
+
     traverse(element, mRoot);
 
     return true;
@@ -232,13 +233,14 @@ void AurumXML::findXNodes(std::vector<std::shared_ptr<AccessibleNode>> &ret,
 
             if (mXNodeMap.count(id) > 0) ret.push_back(mXNodeMap[id]);
         }
-    }    
+    }
 }
 
 void AurumXML::findObjects(std::vector<std::shared_ptr<AccessibleNode>> &ret,
     std::string xpath, bool earlyReturn)
 {
     LOGI("xpath %s earlyReturn %d", xpath.c_str(), earlyReturn);
+    createXMLtree();
     try {
         findXNodes(ret, xpath, earlyReturn);
         if (ret.size() == 0) {