MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / validate

Method validate

xmlschema/dataobjects.py:255–269  ·  view source on GitHub ↗

Validates the XML data object. :param use_defaults: whether to use default values for filling missing data. :param namespaces: is an optional mapping from namespace prefix to URI. \ For default uses the namespace map of the XML data object. :param max_depth:

(self, use_defaults: bool = True,
                 namespaces: Optional[NsmapType] = None,
                 max_depth: Optional[int] = None)

Source from the content-addressed store, hash-verified

253 return namespaces
254
255 def validate(self, use_defaults: bool = True,
256 namespaces: Optional[NsmapType] = None,
257 max_depth: Optional[int] = None) -> None:
258 """
259 Validates the XML data object.
260
261 :param use_defaults: whether to use default values for filling missing data.
262 :param namespaces: is an optional mapping from namespace prefix to URI. \
263 For default uses the namespace map of the XML data object.
264 :param max_depth: maximum depth for validation, for default there is no limit.
265 :raises: :exc:`XMLSchemaValidationError` if XML data object is not valid.
266 :raises: :exc:`XMLSchemaValueError` if the instance has no schema bindings.
267 """
268 for error in self.iter_errors(use_defaults, namespaces, max_depth):
269 raise error
270
271 def is_valid(self, use_defaults: bool = True,
272 namespaces: Optional[NsmapType] = None,

Callers

nothing calls this directly

Calls 1

iter_errorsMethod · 0.95

Tested by

no test coverage detected