cyclonedx.validation.xml

Classes

XmlValidationError

Validation failed with this specific error.

XmlValidator

Validator for CycloneDX documents in XML format.

Module Contents

class cyclonedx.validation.xml.XmlValidationError(data: Any)

Bases: cyclonedx.validation.ValidationError

Validation failed with this specific error.

Use data to access the content.

data: Any

Raw error data from one of the underlying validation methods.

class cyclonedx.validation.xml.XmlValidator(schema_version: cyclonedx.schema.SchemaVersion)

Bases: _BaseXmlValidator, cyclonedx.validation.BaseSchemabasedValidator, cyclonedx.validation.SchemabasedValidator

Validator for CycloneDX documents in XML format.

property output_format: Literal[cyclonedx.schema.OutputFormat.XML]

Get the format.

validate_str(data: str, *, all_errors: Literal[False] = ...) XmlValidationError | None
validate_str(data: str, *, all_errors: Literal[True]) collections.abc.Iterable[XmlValidationError] | None

Validate a string

Parameters:
  • data – the data string to validate

  • all_errors – whether to return all errors or only (any)one - if any

Returns:

validation error

Retval None:

if data is valid

Retval ValidationError:

if data is invalid and all_errors is False

Retval Iterable[ValidationError]:

if data is invalid and all_errors is True

property schema_version: cyclonedx.schema.SchemaVersion

Get the schema version.