Parse xml data. This method will call the other internal methods to validate ``xpath``, names, optionally parse and run XSLT, and parse original or transformed XML and return specific nodes.
(self)
| 549 | """ |
| 550 | |
| 551 | def parse_data(self) -> list[dict[str, str | None]]: |
| 552 | """ |
| 553 | Parse xml data. |
| 554 | |
| 555 | This method will call the other internal methods to |
| 556 | validate ``xpath``, names, optionally parse and run XSLT, |
| 557 | and parse original or transformed XML and return specific nodes. |
| 558 | """ |
| 559 | from lxml.etree import iterparse |
| 560 | |
| 561 | if self.iterparse is None: |
| 562 | self.xml_doc = self._parse_doc(self.path_or_buffer) |
| 563 | |
| 564 | if self.stylesheet: |
| 565 | self.xsl_doc = self._parse_doc(self.stylesheet) |
| 566 | self.xml_doc = self._transform_doc() |
| 567 | |
| 568 | elems = self._validate_path() |
| 569 | |
| 570 | self._validate_names() |
| 571 | |
| 572 | xml_dicts: list[dict[str, str | None]] = ( |
| 573 | self._parse_nodes(elems) |
| 574 | if self.iterparse is None |
| 575 | else self._iterparse_nodes(iterparse) |
| 576 | ) |
| 577 | |
| 578 | return xml_dicts |
| 579 | |
| 580 | def _validate_path(self) -> list[Any]: |
| 581 | msg = ( |
nothing calls this directly
no test coverage detected