schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmlschema module

This module contains XMLSchema class for xsdtypes package

class schrodinger.application.matsci.qexsd.qespresso.xsdtypes.xmlschema.XMLSchema(xsd_file)[source]

Bases: object

Class to wrap an XML Schema for types lookups.

XML_SCHEMA_NAMESPACES = {'xs': 'http://www.w3.org/2001/XMLSchema', 'xsd': 'http://www.w3.org/2001/XMLSchema', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
__init__(xsd_file)[source]

Initialize self. See help(type(self)) for accurate signature.

namespaces

Namespaces used by XSD file

types

Map XSD global types to XSDType instance

attributes

Map XSD global attributes to XSDType instance

attribute_groups

Group XSD attributes definitions

elements

Map XSD global elements to XSDType instance

groups

Group XSD elements definitions

target_namespace

Target namespace URI

target_prefix

Namespace prefix for declarations

get_type(type_name)[source]

Return the XSD type instance corresponding to the argument.

Parameters

type_name – Name of the type. Types in the schema’s

namespace have to be provided with namespace URI or prefix. Unqualified names are interpreted as typed of xsd/xs namespace. :return: XSDType or XSDSimpleType instance

get_element(element_path)[source]
get_element_tag(element_path)[source]

Return the XSD type instance of the element.

Parameters

element_path – The absolute path to the element. Schema’s

namespace prefixes or URIs are stripped from the path. :return: XSDType, XSDSimpleType or XSDComplexType instance

get_attributes(element_path)[source]
get_element_type(element_path)[source]

Return the XSD type instance of the element.

Parameters

element_path – The absolute path to the element. Schema’s

namespace prefixes or URIs are stripped from the path. :return: XSDType, XSDSimpleType or XSDComplexType instance

get_attribute_type(attribute_name, element_path)[source]

Return the XSD type instance of the attribute.

Parameters

attribute_name – The name of the attribute. Schema’s

namespace prefix or URI is stripped from the name. :param element_path: The absolute path to the element. Schema’s namespace prefixes or URIs are stripped from the path. :return: XSDType or XSDSimpleType instance

get_element_default(element_path)[source]

Return the default of the element.

Parameters

element_path – The absolute path to the element. Schema’s

namespace prefixes or URIs are stripped from the path. :return: XSDType, XSDSimpleType or XSDComplexType instance

get_attribute_default(attribute_name, element_path)[source]

Return the XSD type instance of the attribute.

Parameters

attribute_name – The name of the attribute. Schema’s

namespace prefix or URI is stripped from the name. :param element_path: The absolute path to the element. Schema’s namespace prefixes or URIs are stripped from the path. :return: XSDType or XSDSimpleType instance

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

getroot()[source]

Return root element of the XML schema tree.

iselement(elem)[source]

Checks if an element instance appears to be a valid element object. :param elem:

iter(tag=None)[source]

Create and return an iterator that loops over all elements in this tree, in document order.

Parameters

tag – is a string with the tag name to iterate over

(default is to return all elements).

validate(xml_config)[source]

Validate the configuration with XSD and with optional parameter dependencies. :param xml_config: