Version: 2.2.0.dev0

sdv.validators.stix.profile Module

class sdv.validators.stix.profile.STIXProfileValidator(profile_fn)[source]

Bases: sdv.validators.schematron.SchematronValidator

Performs STIX Profile validation.

Parameters:profile_fn – The filename of a .xlsx STIX Profile document.

Validates an XML instance document against a STIX profile.

Parameters:doc – The STIX document. This can be a filename, file-like object, etree._Element, or etree._ElementTree instance.
Returns:An instance of ProfileValidationResults.
Raises:ValidationError – If there are any issues parsing doc.
class sdv.validators.stix.profile.ProfileValidationResults(is_valid, doc=None, svrl_report=None)[source]

Bases: sdv.validators.schematron.SchematronValidationResults

Represents STIX profile validation results. This is returned from the STIXProfileValidator.validate() method.

  • is_vaildTrue if the document was valid and False otherwise.
  • doc – The document that was validated. This is an instance of lxml._Element.
  • svrl_report – The SVRL report. This is an instance of lxml.isoschematron.Schematron.validation_report

A list of ProfileError instances representing errors found in the svrl_report.


A dictionary representation of the SchematronValidationResults instance.

  • 'result': The validation results. Values can be True or False.
  • 'errors': A list of validation error dictionaries. The keys are 'message' and 'line'.
Returns:A dictionary representation of an instance of this class.

Returns a JSON representation of this class instance.


Returns True if the validation attempt was successful and False otherwise.

class sdv.validators.stix.profile.ProfileError(doc, error)[source]

Bases: sdv.validators.schematron.SchematronError

Represents STIX profile validation error.

  • doc – The instance document which was validated and produced this error.
  • error – The svrl:failed-assert or svrl:successful-report etree._Element instance.

The STIX Profile validation error message.


Returns a dictionary representation.

  • 'message': The error message
  • 'line': The line number associated with the error

Returns a JSON representation of this class instance.


Returns the line number in the input document associated with this error.

This property is lazily evaluated, meaning the line number isn’t known until the first time this property is accessed. Each subsequent call will return the cached line number.