MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / get_xpath_node

Method get_xpath_node

xmlschema/resources/xml_loader.py:193–205  ·  view source on GitHub ↗

Returns an XPath node for the element, fetching it from the XPath root node. Returns a new lazy element node if the matching element node is not found.

(self, elem: ElementType)

Source from the content-addressed store, hash-verified

191 return self._xmlns.get(elem)
192
193 def get_xpath_node(self, elem: ElementType) -> ElementNode:
194 """
195 Returns an XPath node for the element, fetching it from the XPath root node.
196 Returns a new lazy element node if the matching element node is not found.
197 """
198 xpath_node = self.xpath_root.get_element_node(elem)
199 if isinstance(xpath_node, ElementNode):
200 return xpath_node
201
202 try:
203 return LazyElementNode(elem, nsmap=self._nsmaps[elem])
204 except KeyError:
205 return LazyElementNode(elem)
206
207 def get_absolute_path(self, path: Optional[str] = None) -> str:
208 if path is None:

Callers 2

__call__Method · 0.80
collect_key_fieldsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected