Generates a sequence of validation errors if the XML data object is invalid. Accepts the same arguments of :meth:`validate`.
(self, use_defaults: bool = True,
namespaces: Optional[NsmapType] = None,
max_depth: Optional[int] = None)
| 282 | return error is None |
| 283 | |
| 284 | def iter_errors(self, use_defaults: bool = True, |
| 285 | namespaces: Optional[NsmapType] = None, |
| 286 | max_depth: Optional[int] = None) -> Iterator['XMLSchemaValidationError']: |
| 287 | """ |
| 288 | Generates a sequence of validation errors if the XML data object is invalid. |
| 289 | Accepts the same arguments of :meth:`validate`. |
| 290 | """ |
| 291 | if self._encoder is None: |
| 292 | raise XMLSchemaValueError("%r has no schema bindings" % self) |
| 293 | |
| 294 | kwargs: dict[str, Any] = { |
| 295 | 'namespaces': self.get_namespaces(namespaces, root_only=False), |
| 296 | 'converter': DataElementConverter, |
| 297 | 'use_defaults': use_defaults, |
| 298 | } |
| 299 | if isinstance(max_depth, int) and max_depth >= 0: |
| 300 | kwargs['max_depth'] = max_depth |
| 301 | |
| 302 | for result in self._encoder.iter_encode(self, **kwargs): |
| 303 | if isinstance(result, validators.XMLSchemaValidationError): |
| 304 | yield result |
| 305 | else: |
| 306 | del result |
| 307 | |
| 308 | def encode(self, validation: str = 'strict', **kwargs: Any) -> EncodeType[ElementType]: |
| 309 | """ |