XML Parser Reference
The parse_xml function unpakcs a relatics XML into a pandas dataframe.
The XML relatics returns is deeply nested and needs to be unpacked, multiple report parts can be part of the same report. This means that multible different tables can be formed from a single webservice.
In order to cleanly extract these tables the report part should be specified. This means the report part as defined in the Relatics report.
Overview
relatics_toolkit.parse_xml(root, report_part)
Function to convert a relatics report part into a pandas DataFrame.
Relatics report parts can be deeply nested, this function recusively unpacks the XML and returns a single DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
ElementTree
|
The complete xml.etree.ElementTree xml as obtained from the relatics webservice. Can be easily obtained from the RelaticsClient. |
required |
report_part
|
str
|
Specific report part to unpack into a pandas dataframe. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
df |
DataFrame
|
An unpacked pandas DataFrame of a specific report part. |
Source code in src/relatics_toolkit/ingestion/xml_parser.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |