*/
std::string getXPath(std::string id);
+ /**
+ * @brief Finds that objects that satisfied with the xpath in the object tree.
+ *
+ * @param xpath
+ *
+ * @return the list of found AccessibleNode vector
+ *
+ * @since_tizen 7.0
+ */
+ std::vector<std::shared_ptr<AccessibleNode>> findObjects(std::string xpath);
+
private:
/**
* @internal
xml_document *mDoc;
std::shared_ptr<AccessibleNode> mRoot;
std::unordered_map<std::string, std::string> mXPathMap;
+ std::unordered_map<std::string, std::shared_ptr<AccessibleNode>> mXNodeMap;
};
} // namespace Aurum
else
name = node->getType();
+ if (!name.compare("application"))
+ name = node->getPkg();
+
// Remove white spaces.
name.erase(remove(name.begin(), name.end(), ' '), name.end());
element.append_attribute("visible") = node->isVisible();
element.append_attribute("selectable") = node->isSelectable();
+ mXNodeMap[node->getId()] = node;
+
int childCnt = node->getChildCount();
for (int i = 0; i < childCnt; i++) {
std::shared_ptr<AccessibleNode> childNode = node->getChildAt(i);
}
return "NotSupported";
+}
+
+std::vector<std::shared_ptr<AccessibleNode>> AurumXML::findObjects(std::string xpath)
+{
+ std::vector<std::shared_ptr<AccessibleNode>> ret;
+ xpath_node_set results = mDoc->select_nodes(xpath.c_str());
+
+ for (xpath_node_set::const_iterator it = results.begin(); it != results.end(); ++it)
+ {
+ auto node = (*it).node();
+ std::string id(node.attribute("id").value());
+
+ if (mXNodeMap.count(id) > 0) ret.push_back(mXNodeMap[id]);
+ }
+
+ return ret;
}
\ No newline at end of file