schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmldocument module¶
This module contains XMLDocument class for xsdtypes package
- class schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmldocument.XmlDocument(xsd_file)[source]¶
Bases:
object
Generic XML schema based document.
A XSD schema is needed for checking types, validation of the configuration and for lookup of default values of the attributes. Full schema’s validation is available only if lxml library is installed.
Supported files data format for configuration are XML, YAML and JSON.
- read(filename, data_format='XML')[source]¶
Read configuration from a text file in a specific data format.
- Parameters
filename – Name of the text file containing the configuration
data_format – Input file data format (XML, JSON or YAML)
- extra_validations(xlm_tree)[source]¶
Hook for ad-hoc validations of dependencies between parameters that are not explainable with the XSD schema.
- write(filename, output_format='XML')[source]¶
Write configuration to a text file in a specific data format.
- Parameters
filename –
output_format –
- Returns
- find(path, namespaces=None)[source]¶
Find first matching element by tag name or path.
- Parameters
path – is a string having either an element tag or an XPath,
namespaces – is an optional mapping from namespace prefix to full name.
- Returns
the first matching element, or None if no element was found
- findall(path, namespaces=None)[source]¶
Find all matching subelements by tag name or path.
- Parameters
path – is a string having either an element tag or an XPath,
namespaces – is an optional mapping from namespace prefix to full name.
- Returns
the first matching element, or None if no element was found