2.6.4.4. pycsamt.emtf.xml.parser#
Low-level, namespace-safe helpers for EMTF XML parsing.
Functions
|
Return the first direct child matching name. |
|
Return direct child elements matching name by local name. |
|
Convert a small metadata subtree to a loss-preserving Python mapping. |
|
Parse source and return |
|
Return an XML local name, discarding namespace or prefix. |
|
Parse an FCU-style real or |
|
Return stripped text from node or one named direct child. |
|
Emit a reader warning with a stable warning category. |
Classes
|
Per-document data-type declaration used while parsing XML. |
Exceptions
Raised when an EMTF XML document cannot be interpreted safely. |
|
Warning emitted for recoverable EMTF XML inconsistencies. |
- exception pycsamt.emtf.xml.parser.EMTFXMLParseError[source]
Bases:
ValueErrorRaised when an EMTF XML document cannot be interpreted safely.
- exception pycsamt.emtf.xml.parser.EMTFXMLWarning[source]
Bases:
UserWarningWarning emitted for recoverable EMTF XML inconsistencies.
- class pycsamt.emtf.xml.parser.XMLDataTypeSpec(name, tag, data_kind, input_kind=None, output_kind=None, units=None, intention='primary', description='', derived_from=None, see_also=(), external_url=None)[source]
Bases:
objectPer-document data-type declaration used while parsing XML.
This is deliberately separate from the global scientific registry. EMTF XML files are self-describing and may contain data types unknown to the installed pyCSAMT version; reading one file must not mutate global state.
- Parameters:
- name: str
- tag: str
- data_kind: str
- intention: str = 'primary'
- description: str = ''
- pycsamt.emtf.xml.parser.child(node, name)[source]
Return the first direct child matching name.
- pycsamt.emtf.xml.parser.children(node, name)[source]
Return direct child elements matching name by local name.
- pycsamt.emtf.xml.parser.element_to_mapping(node)[source]
Convert a small metadata subtree to a loss-preserving Python mapping.
- pycsamt.emtf.xml.parser.local_name(tag)[source]
Return an XML local name, discarding namespace or prefix.
- pycsamt.emtf.xml.parser.load_xml_root(source)[source]
Parse source and return
(root, source_label).
- pycsamt.emtf.xml.parser.parse_numeric_text(value, *, complex_)[source]
Parse an FCU-style real or
real imagnumeric value.