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)
| 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 | |
| 428 | class DataBindingMeta(ABCMeta): |