Package xmlschema_acue :: Package validators :: Module xsdbase :: Class XsdComponent

Class XsdComponent

source code


Class for XSD components. See: https://www.w3.org/TR/xmlschema-ref/

:param elem: ElementTree's node containing the definition. :param schema: the XMLSchema object that owns the definition. :param parent: the XSD parent, `None` means that is a global component that has the schema as parent. :param name: name of the component, maybe overwritten by the parse of the `elem` argument.

:cvar qualified: for name matching, unqualified matching may be admitted only for elements and attributes. :vartype qualified: bool

Instance Methods
 
__setattr__(self, name, value) source code
 
__repr__(self) source code
 
match(self, name, default_namespace=None)
Returns the component if its name is matching the name provided as argument, `None` otherwise.
source code
 
get_global(self)
Returns the global XSD component that contains the component instance.
source code
 
tostring(self, indent='', max_lines=None, spaces_for_tab=4)
Returns the XML elements that declare or define the component as a string.
source code

Inherited from XsdValidator: __copy__, __str__, __unicode__, copy

Class Variables
  parent = None
  name = None
  qualified = True
Method Details

__init__(self, elem, schema, parent=None, name=None)
(Constructor)

source code 
Decorators:
Overrides: XsdValidator.__init__

is_global(self)

source code 

Is `True` if the instance is a global component, `False` if it's local.

Decorators:
  • @property

schema_elem(self)

source code 

The reference element of the schema for the component instance.

Decorators:
  • @property

source(self)

source code 

Property that references to schema source.

Decorators:
  • @property

target_namespace(self)

source code 

Property that references to schema's targetNamespace.

Decorators:
  • @property

default_namespace(self)

source code 

Property that references to schema's default namespaces.

Decorators:
  • @property

namespaces(self)

source code 

Property that references to schema's namespace mapping.

Decorators:
  • @property

maps(self)

source code 

Property that references to schema's global maps.

Decorators:
  • @property

local_name(self)

source code 
Decorators:
  • @property

qualified_name(self)

source code 
Decorators:
  • @property

prefixed_name(self)

source code 
Decorators:
  • @property

id(self)

source code 

The ``'id'`` attribute of the component tag, ``None`` if missing.

Decorators:
  • @property

validation_attempted(self)

source code 

Property that returns the *validation status* of the XSD validator. It can be 'full', 'partial' or 'none'.

| https://www.w3.org/TR/xmlschema-1/#e-validation_attempted | https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validation_attempted

Decorators:
  • @property
Overrides: XsdValidator.validation_attempted
(inherited documentation)

built(self)

source code 

Property that is ``True`` if schema validator has been fully parsed and built, ``False`` otherwise.

Decorators:
  • @property
Overrides: XsdValidator.built
(inherited documentation)

is_matching(self, name, default_namespace=None)

source code 

Returns `True` if the component name is matching the name provided as argument, `False` otherwise.

:param name: a local or fully-qualified name. :param default_namespace: used if it's not None and not empty for completing the name argument in case it's a local name.

Decorators:

iter_components(self, xsd_classes=None)

source code 

Creates an iterator for XSD subcomponents.

:param xsd_classes: provide a class or a tuple of classes to iterates over only a specific classes of components.

Decorators:
Overrides: XsdValidator.iter_components

iter_ancestors(self, xsd_classes=None)

source code 

Creates an iterator for XSD ancestor components, schema excluded. Stops when the component is global or if the ancestor is not an instance of the specified class/classes.

:param xsd_classes: provide a class or a tuple of classes to iterates over only a specific classes of components.

Decorators:

all_errors(self)

source code 

A list with all the building errors of the XSD validator and its components.

Decorators:
  • @property

parse_error(self, error, elem=None)

source code 

Helper method for registering parse errors. Does nothing if validation mode is 'skip'. Il validation mode is 'lax' collects the error, otherwise raise the error.

:param error: can be a parse error or an error message. :param elem: the Element instance related to the error, for default uses the 'elem' attribute of the validator, if it's present.

Decorators:

validity(self)

source code 

Property that returns the XSD validator's validity. It can be ‘valid’, ‘invalid’ or ‘notKnown’.

| https://www.w3.org/TR/xmlschema-1/#e-validity | https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validity

Decorators:
  • @property