-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key/keyref not performed on dynamic types #245
Comments
Hi, if XSI_TYPE in elem.attrib:
type_name = elem.attrib[XSI_TYPE].strip()
try:
xsd_type = self.maps.get_instance_type(type_name, xsd_type, namespaces)
except (KeyError, TypeError) as err:
yield self.validation_error(validation, err, elem, **kwargs)
else:
# Add missing selected elements to identity
if self.identities:
xpath_element = XPathElement(self.name, xsd_type)
for identity in self.identities.values():
context = IdentityXPathContext(self.schema, item=xpath_element)
for e in identity.selector.token.select_results(context):
if e not in identity.elements:
identity.elements[e] = None The fix will be available in the next release. Thank you for providing clear samples for the case (I will add them into package's tests). |
Hi Brunato, Thank you for your looking into the matter. Glad my examples are of help. Looking forward to the next release. Best wishes, Robbert |
- Add a dummy XPathElement for XPath operations on dynamic types - Add regression test for issue #243 (XPath processor fault)
Hi @robbert-harms, Best regards, |
Thank you Davide, for repairing this so swiftly. Your fixed for this worked as well. |
Hi brunato,
I was trying to add a key/keyref to one of my nodes with a dynamic type, but unfortunately it won't catch incorrect values. I made a small demo case:
XSD:
XML:
Other validation libraries, such as Xerex throw a warning that
circle_id
is not unique, i.e. that I usecircle_id="1"
twice.The XMLSchema library in general works for validating key/keyref, but it seems to fail with elements referencing an
xsi:type
, such as in the above example.Is this something that can be fixed?
Thank you for making this library, it helps me a lot in moving fully to Python.
Best,
Robbert
The text was updated successfully, but these errors were encountered: