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

Method iterfind

xmlschema/dataobjects.py:413–425  ·  view source on GitHub ↗

Creates and iterator for all XSD subelements matching the path. :param path: an XPath expression that considers the data element as the root. :param namespaces: is an optional mapping from namespace prefix to full name. :return: an iterable yielding all matching dat

(self, path: str,
                 namespaces: Optional[NsmapType] = None)

Source from the content-addressed store, hash-verified

411 return cast(list[DataElement], [e for e in results if isinstance(e, DataElement)])
412
413 def iterfind(self, path: str,
414 namespaces: Optional[NsmapType] = None) -> Iterator['DataElement']:
415 """
416 Creates and iterator for all XSD subelements matching the path.
417
418 :param path: an XPath expression that considers the data element as the root.
419 :param namespaces: is an optional mapping from namespace prefix to full name.
420 :return: an iterable yielding all matching data elements in document order.
421 """
422 parser = XPath2Parser(namespaces, strict=False)
423 context = self._get_xpath_context()
424 results = parser.parse(path).select_results(context)
425 yield from filter(lambda x: isinstance(x, DataElement), results)
426
427
428class DataBindingMeta(ABCMeta):

Callers 3

test_xpath_apiMethod · 0.45
test_iterfindMethod · 0.45

Calls 2

_get_xpath_contextMethod · 0.95
parseMethod · 0.45

Tested by 3

test_xpath_apiMethod · 0.36
test_iterfindMethod · 0.36