Imported from previous forum
Hi,
I added the XSD schema to XML spy, and generated the following XML file which parses and validates without any issues:
<?xml version="1.0" encoding="UTF-8"?>However, when I try to parse the same file in Xerces-C, I get the following error:
Error at file fastapi.xml, line 2, char 201
Message: Complex type ‘__AnonC13’ violates the Unique Particle Attribution rule in its components ‘##other’ and '##any’
Exception : fastapi.xml, line 2, char 201, Complex type ‘__AnonC13’ violates the Unique Particle Attribution rule in its components ‘##other’ and ‘##any’
Is this an issue with Xerces, or is the schema really wrong?
P.S. I am not adding the schema as it can be retrieved directly from FAST Specification 1 x 1.pdf (Appendix 2 W3C XML Schema (Non-Normative)
Error at file fastapi.xml, line 2, char 201 Message: Complex type
‘__AnonC13’ violates the Unique Particle Attribution rule in its
components ‘##other’ and ‘##any’ Exception : fastapi.xml, line 2, char
201, Complex type ‘__AnonC13’ violates the Unique Particle Attribution
rule in its components ‘##other’ and ‘##any’
Is this an issue with Xerces, or is the schema really wrong?
It looks like an issue with Xerces-C. I’ve been able to validate the template definition you provided using Xerces-J without an issue.
The Unique Particle Attribution rule generally fails in extensible schemas where there is ambiguity as to how an element or attribute should be validated.
<?xml version="1.0" encoding="UTF-8"?> <templates xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fixprotocol.org/ns/fast/td/1.1 </blockquote> <p>fast.xsd"></p> <p>The only thing that could violate the UPA is that the templates element allows extensible attributes as long as they have a foreign non-local namespace. Xerces may fail when it reaches the xmlns or xsi:schemaLocation attributes in the templates element.</p> <p>I would try to manually specify the schema in the code and remove those attributes. Chances are the Xerces-C forum/mailing lists could provide better answers. If you do figure out what the issue is, please let us know.</p> <p>Thanks,<br> Jake</p>
After searching the Xerces-C mailing list, it seems that you may be running into the following bug in Xerces-C. It appears to still be open.
“Incorrect UPA violation error with xs:any and ##other” https://issues.apache.org/jira/browse/XERCESC-1655
It seems to me they interpret the rule in a different way than other tools (but that doesn’t explain why Xerces-J validates the schema while Xerces-C++ doesn’t).
I created a bug entry for Xerces-C++ related to this:
https://issues.apache.org/jira/browse/XERCESC-1758
Hopefully they will prioritize it.