dcclib.conversion ¶
Convertible ¶
Bases: ABC
Abstract base class for classes that can be converted.
JSONConverter ¶
JSONConverter(xml: str, version: str)
Bases: Constructible, Convertible
JSONConverter class that converts DCC XML to JSON whilst being schema-aware.
Conversion is delegated to :class:dcc_json_toolkit.DccSchema, which loads and
caches the released XSD schema for the detected version.
Constructor for JSONConverter class.
| Parameters: |
|
|---|
convert ¶
convert() -> str
Convert the DCC XML to JSON.
| Returns: |
|
|---|
from_file
classmethod
¶
from_file(path: str)
Create a JSONConverter from a DCC XML file path.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_str
classmethod
¶
from_str(xml: str)
Create a JSONConverter from a DCC XML string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_tree
classmethod
¶
from_tree(tree: etree._Element | etree._ElementTree)
Create a JSONConverter from an etree.Element or etree.ElementTree. If a subtree element is passed, the schema version is derived from the enclosing document root.
| Parameters: |
|
|---|
| Returns: |
|
|---|
to_dict ¶
to_dict() -> dict
Convert the DCC XML to a dictionary.
| Returns: |
|
|---|
convertible ¶
json_converter ¶
JSONConverter ¶
JSONConverter(xml: str, version: str)
Bases: Constructible, Convertible
JSONConverter class that converts DCC XML to JSON whilst being schema-aware.
Conversion is delegated to :class:dcc_json_toolkit.DccSchema, which loads and
caches the released XSD schema for the detected version.
Constructor for JSONConverter class.
| Parameters: |
|
|---|
convert ¶
convert() -> str
Convert the DCC XML to JSON.
| Returns: |
|
|---|
from_file
classmethod
¶
from_file(path: str)
Create a JSONConverter from a DCC XML file path.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_str
classmethod
¶
from_str(xml: str)
Create a JSONConverter from a DCC XML string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_tree
classmethod
¶
from_tree(tree: etree._Element | etree._ElementTree)
Create a JSONConverter from an etree.Element or etree.ElementTree. If a subtree element is passed, the schema version is derived from the enclosing document root.
| Parameters: |
|
|---|
| Returns: |
|
|---|
to_dict ¶
to_dict() -> dict
Convert the DCC XML to a dictionary.
| Returns: |
|
|---|