xml.Error

An xml.Error class represents a single error reported during the validation process of the current job.

Nested classes: xml.Error.ExternalLinkParam, xml.Error.Param

class xml.Error

Proper instances of this class will be created within RaptorXML only, instantiation from script code will throw a NotImplementedError exception.

Class methods

classmethod xml.Error.create(type cls, msg, severity=ErrorSeverity.ERROR, error_code=None, reference=None, location=None, children=None, **params)

Constructs a new xml.Error object with the given text message. Placeholders for dynamic content can be inserted in the message string using the parameter name in curly braces. Parameters can be of type string, xml.InformationItem, xsd.Component or other objects representing XML information items or XSD schema components like XBRL concepts or facts.

A string can be passed to the optional ‘error_code’ argument to set the error code or name. An URI string can be passed to the optional ‘reference’ argument to identify a specific part of the specification which has been violated. An xml.ErrorSeverity enumeration value can be passed to the optional ‘severity’ argument. Errors of type xml.ErrorSeverity.ERROR will cause the result of the current validation job to be set to ‘Failed’. An xsd.Component or xml.InformationItem object or a string with an absolute URI can be passed to the optional ‘location’ argument to specify the XML location of the error. A list of child errors can be passed to the optional ‘children’ argument. For each placeholder in the message an argument with the same name should be supplied.

Example:

>>> job.error_log.report(Error.create('Value {val} for fact {fact} is not allowed!', location=fact, val=fact.normalized_value, fact=fact))

Attributes

xml.Error.children

Returns an iterator of xml.Error objects for each child error of this error.

xml.Error.error_code

Returns the error code (name) of this error.

xml.Error.error_qname

Returns the qualified name of this error.

xml.Error.main_line

Returns the textual representation of the main line as a string.

xml.Error.severity

Returns the error severity as an xml.ErrorSeverity enumaration.

xml.Error.text

Returns the textual representation of the full error message as a string.

Special methods

__bool__, __eq__, __ge__, __gt__, __le__, __lt__, __ne__