- From: Michael Kay <mike@saxonica.com>
- Date: Mon, 16 Apr 2007 23:48:44 +0100
- To: "'Shlomo Yona'" <S.Yona@F5.com>, <xmlschema-dev@w3.org>
- Message-ID: <001201c78079$80df6270$4b0f210a@turtle>
Once I fix your typographical quotation marks to turn them into ASCII quotation marks, Saxon reports: Error at xsd:schema on line 1 of file:/c:/temp/test.xsd: The zero-length string is not a legal namespace URI Error at xsd:element on line 11 of file:/c:/temp/test.xsd: Cannot reference schema components in namespace foo as it has not been imported (more of the same) Error at xsd:all on line 25 of file:/c:/temp/test.xsd: Element <xsd:all> is not allowed as a child of <xsd:sequence> Error at xsd:all on line 25 of file:/c:/temp/test.xsd: Within <xs:all>, an <xs:element> must have @maxOccurs equal to 0 or 1 Error at xsd:all on line 25 of file:/c:/temp/test.xsd: Within <xs:all>, an <xs:element> must have @maxOccurs equal to 0 or 1 When I fix these problems Saxon actually reports both your schema and the instance as valid. This is because Saxon doesn't detect a UPA in the situation where you have two element particles that both refer to the same element declaration - if Saxon can determine unambiguously which element declaration an element refers to, it doesn't report any ambiguity. A known minor departure from the spec. Michael Kay http://www.saxonica.com/ _____ From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On Behalf Of Shlomo Yona Sent: 16 April 2007 08:57 To: xmlschema-dev@w3.org Subject: Determinization in case of ambiguity or Should XML validators report on schemas that violate the UPA constraint? Hello, In the following example schema the element <b/> can appear either as part of a sequence model group or as part of a choice model group or as an all model group. This means that the instance does not follow the Unique Particle Attribution Constraint (see: "Section 3.8.6: Constraints on Model Group Schema Components " and Appendix H in "XML Schema Part 1: Structures Second Edition, W3C Proposed Edited Recommendation"). <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="" xmlns="foo"> <xsd:element name="a"> <xsd:complexType> <xsd:sequence minOccurs="0" maxOccurs="2"> <xsd:sequence minOccurs="0" maxOccurs="2"> <xsd:element ref="b" minOccurs="0" maxOccurs="2"/> <xsd:element ref="c" minOccurs="0" maxOccurs="2"/> </xsd:sequence> <xsd:choice minOccurs="0" maxOccurs="2"> <xsd:element ref="b" minOccurs="0" maxOccurs="2"/> <xsd:element ref="d" minOccurs="0" maxOccurs="2"/> </xsd:choice> <xsd:all minOccurs="0" maxOccurs="1"> <xsd:element ref="e" minOccurs="0" maxOccurs="2"/> <xsd:element ref="b" minOccurs="0" maxOccurs="2"/> </xsd:all> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="b"> <xsd:complexType/> </xsd:element> <xsd:element name="c"> <xsd:complexType/> </xsd:element> <xsd:element name="d"> <xsd:complexType/> </xsd:element> <xsd:element name="e"> <xsd:complexType/> </xsd:element> </xsd:schema> My question is: should the following example be valid against the schema or not valid? <a> <b/><c/><b/> </a> I see that different XML validators behave differently on this example. However, I did not see them report an error in the schema. Now, please consider the following schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="bar" xmlns="foo"> <xsd:element name="a"> <xsd:complexType> <xsd:sequence> <xsd:sequence minOccurs="0"> <xsd:element name="b"> <xsd:complexType/> </xsd:element> </xsd:sequence> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> Instance: <a/> Is it valid? See, the element b might not appear and that's OK if you ask the inner sequence but the outer sequence needs to "happen" once (the minOccurs="1" is implied). So, how should I read this? Is the above single <a/> element instance valid or not with this schema? Is such a schema legal or not? If the schema is not legal, must a schema processor report an error? Thanks. Shlomo.
Received on Monday, 16 April 2007 22:50:05 UTC