Manage the XML Schema files : schema_manager#

-tba-


source code documentation#

manages the XML Schema of this project

The schema_manager calls the cache_manager and is called by nxdl_manager.

Public

SchemaManager([path])

describes the XML Schema for the NeXus NXDL definitions files

Schema_Root(element_node[, obj_name, ...])

root element of the nxdl.xsd file

Schema_Attribute(xml_obj[, obj_name, ...])

xs:attribute element

Schema_Element(xml_obj[, obj_name, ns_dict, ...])

xs:element

Schema_Type(ref[, tag, schema_root])

a named NXDL structure type (such as groupGroup)

get_default_schema_manager()

internal: convenience function

raise_error(node, text, obj)

standard ValueError exception handling

strip_ns(ref)

strip the namespace prefix from ref

Internal

_Mixin(xml_obj[, obj_name, ns_dict, schema_root])

common code for NXDL Rules classes below

_GroupParsing(*args, **kwargs)

internal: avoid a known recursion of group in a group

_Recursion(obj_name)

internal: an element used in recursion, such as child group of group

class punx.schema_manager.SchemaManager(path=None)[source]#

describes the XML Schema for the NeXus NXDL definitions files

parse_nxdlTypes()[source]#

get the allowed data types and unit types from nxdlTypes.xsd

parse_nxdl_patterns()[source]#

get regexp patterns for validItemName, validNXClassName, & validTargetName from nxdl.xsd

class punx.schema_manager.Schema_Attribute(xml_obj, obj_name=None, ns_dict=None, schema_root=None)[source]#

xs:attribute element

Parameters:
  • xml_obj (lxml.etree.Element) – XML element

  • obj_name (str) – optional, default taken from xml_obj

  • ns_dict (dict) – optional, default taken from NAMESPACE_DICT

  • schema_root (obj) – optional, instance of lxml.etree._Element

class punx.schema_manager.Schema_Element(xml_obj, obj_name=None, ns_dict=None, schema_root=None)[source]#

xs:element

Parameters:
  • xml_obj (lxml.etree.Element) – XML element

  • obj_name (str) – optional, default taken from xml_obj

  • ns_dict (dict) – optional, default taken from NAMESPACE_DICT

  • schema_root (obj) – optional, instance of lxml.etree._Element

See:

http://download.nexusformat.org/doc/html/nxdl.html

See:

http://download.nexusformat.org/doc/html/nxdl_desc.html#nxdl-elements

class punx.schema_manager.Schema_Root(element_node, obj_name=None, ns_dict=None, schema_root=None, schema_manager=None)[source]#

root element of the nxdl.xsd file

Parameters:
  • xml_obj (lxml.etree.Element) – XML element

  • obj_name (str) – optional, default taken from xml_obj

  • ns_dict (dict) – optional, default taken from NAMESPACE_DICT

  • schema_root (obj) – optional, instance of lxml.etree._Element

parse_sequence(seq_node)[source]#

parse the sequence used in the root element

class punx.schema_manager.Schema_Type(ref, tag='*', schema_root=None)[source]#

a named NXDL structure type (such as groupGroup)

Parameters:
  • ref (str) – name of NXDL structure type (such as groupGroup)

  • tag (str) – XML Schema element tag, such as complexType (default=``*``)

  • schema_root (obj) – optional, instance of lxml.etree._Element

See:

http://download.nexusformat.org/doc/html/nxdl.html

See:

http://download.nexusformat.org/doc/html/nxdl_desc.html#nxdl-data-types-internal

class punx.schema_manager.Schema_nxdlType(xml_obj, ns_dict=None, schema_root=None)[source]#

one of the types defined in the file nxdlTypes.xsd

class punx.schema_manager.Schema_pattern[source]#

describe the regular expression patterns ofr names of NeXus things

punx.schema_manager.get_default_schema_manager()[source]#

internal: convenience function

punx.schema_manager.raise_error(node, text, obj)[source]#

standard ValueError exception handling

Parameters:
  • node (obj) – instance of

  • text (str) – label for obj

  • obj (str) – value

punx.schema_manager.strip_ns(ref)[source]#

strip the namespace prefix from ref

Parameters:

ref (str) – one word, colon delimited string, such as nx:groupGroup

Returns str:

the part to the right of the last colon