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)¶ 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.
-
__init__
(xsd_file)¶ Initialize self. See help(type(self)) for accurate signature.
-
read
(filename, data_format='XML')¶ 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)
-
parse_xml
(filename)¶ Return an ElementTree object representing an XML file
-
parse_json
(filename)¶ Build an ElementTree object representing a YAML file
-
parse_yaml
(filename)¶ Build an ElementTree object representing a YAML file
-
from_dict
()¶ Build an ElementTree object from a dictionary
-
validate
(filename=None)¶
-
extra_validations
(xlm_tree)¶ Hook for ad-hoc validations of dependencies between parameters that are not explainable with the XSD schema.
-
write
(filename, output_format='XML')¶ Write configuration to a text file in a specific data format.
Parameters: - filename –
- output_format –
Returns:
-
read_string
(text)¶
-
get
(qualified_name)¶
-
to_dict
()¶
-
to_json
()¶ Converts the configuration to to json.
-
iter
(tag=None)¶
-
find
(path, namespaces=None)¶ 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)¶ 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
-