-
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
Failed validation: XsdFieldSelector(path='@trigger|@attime') field selects multiple values #418
Comments
Hi, So I checked the XSD 1.1 section on Identity constraints, that contains a paragraph about key fields:
This is still not completely clear to me, so I will check other XSD W3C tests of similar cases to decide if a patch is needed, and which. About the results of xmllint (based on the libxml2's XSD validator) if the key constraint is effective this should be clearly invalid, but is reported as valid:
then I don't trust the results of libxml2/xmllint on this, Xerces J2 is a more compliant validator (with full XSD 1.1 support, libxml2 support only XSD 1.0), but I've to understand which node-set is intended in case of multiple members. thank you |
After checking the related XSD W3C tests it seems that something is not aligned also for Xerces that not reports the test "idL100.v" as invalid. Initially the test instance was considered valid, but it changed to invalid after an issue on it:
So I going to change xmlschema to consider only XML instance values for checking the duplicated values. This should permits to build the XSD fields once, ignoring duplicated XSD nodes-decoders (but the fields decoders must be changed admitting a also a list of decoders and then an intermediate matching have to be done). With these modifications the XML samples that you provided will be validated as you expected. What I ask you is if the thank you |
Note: my error, Reworked identities decoding, using XPath typed selectors, the fix will be available with next release. thank you |
- Remove useless XsdSelector.target_namespace property
Version v3.4.3 fix identity validation with multiple values. Added your example to the test cases. |
Hi,
I have an XML with events defined that can occur when a certain trigger from a third system arrives or at a given fixed time. For that, we wanted to have a single
event
element type definition with several attributes, two of them,trigger
orattime
, mutually exclusive. In order to implement that I found this solution:So, I created a file compliant with this schema, with
event
nodes having eithertrigger
orattime
attribute, but not both, and another one with a failing instance ofevent
, withtrigger
andattime
at the same time.The problem is that both failed, and XMLSchema.validate() raises in both cases an exception for a valid
event
instance (with only thetrigger
attribute), as follows:I checked everything with
xmllint
and in that case everything works as expected, that is, the valid XML file validates, and the failing one fails to validate, and the correct reason is provided. But, of course, I would like to use a Python solution likexmlschema
.Please, find attached the sample XML and XSD files, as well as a very simplistic Python script.
test_keys.zip
The text was updated successfully, but these errors were encountered: