API reference / Quittio \ Core \ Validation \ Drivers
XsdValidator
final class in quittio/core · implements ValidationDriver
Quittio\Core\Validation\Drivers\XsdValidator · Source
XML schema validation (level L4) with the bundled CII D16B and UBL 2.1 schemas. XML of another syntax read by the reader of a country pack (e.g. ebInterface) is not checked here: the reader checks its structure.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->levels() | |
->name() | Returns "xsd", the name of this check in the validation.levels configuration. |
->schemaFor() | Path of the bundled XSD for the document's root element (CII D16B CrossIndustryInvoice, UBL 2.1 Invoice or CreditNote); null for any other root element. |
->supports() | |
::syntaxOf() | Syntax of the document by its root element name: CII for CrossIndustryInvoice, UBL for Invoice and CreditNote; null for any other root element. The namespace is not checked. |
->validate() | Validates the subject's XML against the schema of its root element and returns the schema errors as level L4, e.g. XSD-NOT-WELL-FORMED for unreadable or unsafe XML and XSD-UNKNOWN-ROOT when no schema fits. |
->validateXml() |
__construct()#
public function __construct(?string $schemaPath = null)| Parameter | Type | Description |
|---|---|---|
$schemaPath | ?string = null |
levels()#
public function levels(): array- Returns
array
name()#
public function name(): stringReturns "xsd", the name of this check in the validation.levels configuration.
- Returns
string
schemaFor()#
public function schemaFor(DOMDocument $document): ?stringPath of the bundled XSD for the document's root element (CII D16B CrossIndustryInvoice, UBL 2.1 Invoice or CreditNote); null for any other root element.
| Parameter | Type | Description |
|---|---|---|
$document | DOMDocument |
- Returns
?string
supports()#
public function supports(ValidationSubject $subject): bool| Parameter | Type | Description |
|---|---|---|
$subject | ValidationSubject |
- Returns
bool
syntaxOf()#
public static function syntaxOf(DOMDocument $document): ?SyntaxSyntax of the document by its root element name: CII for CrossIndustryInvoice, UBL for Invoice and CreditNote; null for any other root element. The namespace is not checked.
| Parameter | Type | Description |
|---|---|---|
$document | DOMDocument |
- Returns
?Syntax
validate()#
public function validate(ValidationSubject $subject): ValidationResultValidates the subject's XML against the schema of its root element and returns the schema errors as level L4, e.g. XSD-NOT-WELL-FORMED for unreadable or unsafe XML and XSD-UNKNOWN-ROOT when no schema fits.
| Parameter | Type | Description |
|---|---|---|
$subject | ValidationSubject |
- Returns
ValidationResult
validateXml()#
public function validateXml(string $xml): list<ValidationMessage>| Parameter | Type | Description |
|---|---|---|
$xml | string |
- Returns
list<ValidationMessage>