gws.lib.xmlx.validator¶
XML schema validator for tests.
Source code: gws.lib.xmlx.validator
Module Contents¶
- exception gws.lib.xmlx.validator.Error(*args, **kwargs)¶
Bases:
gws.ErrorValidation or schema error, with
messageandlineno.- lineno¶
- message¶
- gws.lib.xmlx.validator.validate(xml: str | bytes) bool¶
Validate a document against the schemas listed in its
xsi:schemaLocation.Remote schemas are downloaded and cached under
gws.c.CACHE_DIR; URLs containing.locorlocalare downloaded without caching.- Parameters:
xml – The document as a string or bytes.
- Returns:
Trueif the document is valid.- Raises:
Error – If the document or a schema cannot be parsed, or the document is invalid.