Version: 2.5.0
sdv.validators.cybox.schema Module¶
-
class
sdv.validators.cybox.schema.CyboxSchemaValidator(schema_dir=None)[source]¶ Bases:
sdv.validators.base.BaseSchemaValidator-
validate(doc, version=None, schemaloc=False)[source]¶ Performs XML Schema validation against a CybOX document.
When validating against the set of bundled schemas, a CybOX version number must be declared for the input doc. If a user does not pass in a version parameter, an attempt will be made to collect the version from the input doc.
Note
If schemaloc is
Trueor this class was initialized with aschema_dir, no version checking or verification will occur.Parameters: - doc – The CybOX document. This can be a filename, file-like object,
etree._Element, oretree._ElementTreeinstance. - version – The version of the CybOX document. If
Nonean attempt will be made to extract the version from doc. - schemaloc – If
True, thexsi:schemaLocationattribute on doc will be used to drive the validation.
Returns: An instance of
XmlValidationResults.Raises: UnknownCyboxVersionError– If version isNoneand doc does not contain CybOX version information.InvalidCyboxVersionError– If version is an invalid CybOX version or doc contains an invalid CybOX version number.ValidationError– If the class was not initialized with a schema directory and schemaloc isFalse.XMLSchemaImportError– If an error occurs while processing the schemas required for validation.XMLSchemaIncludeError– If an error occurs while processingxs:includedirectives.ValidationError– If there are any issues parsing doc.
- doc – The CybOX document. This can be a filename, file-like object,
-