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)¶
-
__getitem__
(section)¶
-
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
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmldocument', '__doc__': "\n Generic XML schema based document.\n\n A XSD schema is needed for checking types, validation of the configuration\n and for lookup of default values of the attributes. Full schema's validation\n is available only if lxml library is installed.\n\n Supported files data format for configuration are XML, YAML and JSON.\n ", '__init__': <function XmlDocument.__init__>, 'read': <function XmlDocument.read>, 'parse_xml': <function XmlDocument.parse_xml>, 'parse_json': <function XmlDocument.parse_json>, 'parse_yaml': <function XmlDocument.parse_yaml>, 'from_dict': <function XmlDocument.from_dict>, 'validate': <function XmlDocument.validate>, 'extra_validations': <function XmlDocument.extra_validations>, 'write': <function XmlDocument.write>, 'read_string': <function XmlDocument.read_string>, 'get': <function XmlDocument.get>, '__getitem__': <function XmlDocument.__getitem__>, 'to_dict': <function XmlDocument.to_dict>, 'to_json': <function XmlDocument.to_json>, 'iter': <function XmlDocument.iter>, 'find': <function XmlDocument.find>, 'findall': <function XmlDocument.findall>, '__dict__': <attribute '__dict__' of 'XmlDocument' objects>, '__weakref__': <attribute '__weakref__' of 'XmlDocument' objects>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmldocument'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
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
-