Package xmlschema_acue :: Package validators :: Module xsdbase :: Class XsdValidator

Class XsdValidator

source code


Common base class for XML Schema validator, that represents a PSVI (Post Schema Validation Infoset) information item. A concrete XSD validator have to report its validity collecting building errors and implementing the properties.

:param validation: defines the XSD validation mode to use for build the validator, its value can be 'strict', 'lax' or 'skip'. Strict mode is the default. :type validation: str

:ivar validation: XSD validation mode. :vartype validation: str :ivar errors: XSD validator building errors. :vartype errors: list

Instance Methods
 
__init__(self, validation='strict') source code
 
__unicode__(self) source code
 
__str__(self) source code
 
copy(self) source code
 
__copy__(self) source code
Method Details

built(self)

source code 

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

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

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

iter_components(self, xsd_classes=None)

source code 

Creates an iterator for traversing all XSD components of the validator.

:param xsd_classes: returns only a specific class/classes of components, otherwise returns all 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: