| 401 | self.counter[fields] += 1 |
| 402 | |
| 403 | def iter_errors(self, identities: dict[XsdIdentity, IdentityCounter]) \ |
| 404 | -> Iterator[XMLSchemaValueError]: |
| 405 | if self.refer is None: |
| 406 | return # don't validate with an unbuilt keyref |
| 407 | |
| 408 | refer_values = identities[self.refer].counter |
| 409 | |
| 410 | for v in filter(lambda x: x not in refer_values, self.counter): |
| 411 | if len(v) == 1 and v[0] in refer_values: |
| 412 | continue |
| 413 | elif self.counter[v] > 1: |
| 414 | msg = "value {} not found for {!r} ({} times)" |
| 415 | yield XMLSchemaValueError(msg.format(v, self.refer, self.counter[v])) |
| 416 | else: |
| 417 | msg = "value {} not found for {!r}" |
| 418 | yield XMLSchemaValueError(msg.format(v, self.identity.refer)) |
| 419 | |
| 420 | |
| 421 | class FieldValueSelector: |