- From: George Cristian Bina <george@oxygenxml.com>
- Date: Fri, 11 Oct 2013 10:14:20 +0300
- To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
- CC: Michael Kay <mike@saxonica.com>, xmlschema-dev@w3.org
Dear Michael, If the document specifies only vc:minVersion="1.0" on the schema root element then we will need to use an XML Schema 1.1 processor and this matches the result of the provided algorithm. Why we need to use an XML Schema 1.1 processor in this case? minVersion="1.0" allows XML Schema 1.1 constructs but in the same time it says that the schema is also a valid XML Schema 1.0. Now, because it does not limit the schema to XML Schema 1.0 only, that will mean that the 1.1 constructs are separately profiled, probably with a vc:minVersion="1.1", thus they get excluded when the schema is processed for an 1.0 processor. We need to use an XML Schema 1.1 processor because: - we need to provide the editing support for changing the schema and the schema may contain 1.1 specific code, so we need to provide 1.1 content completion for example - Some XML Schema 1.0 processors may not support excluding content based on the vc:* attributes so they will give errors on possible XML Schema 1.1 constructs that are profiled to be excluded when the processor version is 1.0 - we want to provide the best support for users when they validate their documents so we want to enforce additional 1.1 constraints specified in the schema Here it is a sample schema for which I would use a 1.1 processor and not a 1.0 processor: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.0" elementFormDefault="qualified"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:element name="x" type="xs:string"/> <xs:element name="y" type="xs:string"/> </xs:sequence> <xs:assert vc:minVersion="1.1" test="string-length(x) + string-length(y) > 10"/> </xs:complexType> </xs:element> </xs:schema> A few more comments: > If a schema author wants to ensure that ONLY a 1.0 processor will > handle the schema, they can use maxVersion=n, for any n greater than > 1.0. That is not sufficient, n should be also less or equal to 1.1 > In a schema document that provides several versions of a > declaration, the goal is to provide semantics for the vc:* attributes > that allow a schema author to be sure that every processor will > find exactly one declaration: > > <xs:element name="E" type="Te-1.0" > vc:minVersion="1.0" vc:maxVersion="1.1"/> > <xs:element name="E" type="Te-1.1" > vc:minVersion="1.1" vc:maxVersion="1.2"/> > <xs:element name="E" type="Te-1.2" > vc:minVersion="1.2" vc:maxVersion="1.21"/> > <xs:element name="E" type="Te-2.0" > vc:minVersion="1.21" vc:maxVersion="2.0"/> > <xs:element name="E" type="Te-1.2" > vc:minVersion="2.0"/> > > This ensures that a processor which has support for any version > whose number is 1.0 or higher will find exactly one declaration > to read. I am not sure I follow this.. Maybe you can specify in words what you want to achieve and then I can see that this code fragment does that? Now, looking at this I can see that, if v is the processor XML Schema version then for v in [1.0; 1.1) the type of E is Te-1.0 for v in [1.1; 1.2) the type of E is Te-1.1 for v in [1.2; 1.21) the type of E is Te-1.2 for v in [1.21; 2.0) the type of E is Te-2.0 ??? for v in [2.0; ∞) the type of E is Te-1.2 ??? I do not understand the logic of having Te-2.0 if the version is less than 2.0 and Te-1.2 is the version is 2.0 or higher. I was thinking that the name of the type hints to the schema version - thus my feedback to explain in plain words what this code fragment tries to achieve. Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 10/11/13 3:12 AM, C. M. Sperberg-McQueen wrote: > > On Oct 10, 2013, at 2:19 AM, George Cristian Bina wrote: > >> Thanks Mike for this suggestion! >> >> We will implement this algorithm in oXygen: >> >> if (there are vc:minVersion or vc:maxVersion attributes on the schema root element) then { >> if (version 1.1 is accepted) >> then (use XML Schema version 1.1) >> else if (version 1.0 is accepted) >> then (use XML Schema version 1.0) >> else (throw unsupported schema version error) >> } else (use the default XML Schema version specified in oXygen options) > > I wouldn't do it that way. A specification of vc:minVersion says that > 1.0 is the lowest version number required to process the element in > question and its descendants; that's true for a 1.0 schema document > but not, in general, for a 1.1 schema schema document. > > In other words, vc:minVersion="1.0" allows a 1.1 processor to handle > the document, but it doesn't forbid a 1.0 processor from handling it. So > it implicitly suggests that the schema document so marked is a 1.0 > document, not a 1.1 document. > > If a schema author wants to ensure that ONLY a 1.0 processor will > handle the schema, they can use maxVersion=n, for any n greater than > 1.0. > >> It is unfortunate that, as Andreas mentioned, the maxVersion is exclusive. > > In a schema document that provides several versions of a > declaration, the goal is to provide semantics for the vc:* attributes > that allow a schema author to be sure that every processor will > find exactly one declaration: > > <xs:element name="E" type="Te-1.0" > vc:minVersion="1.0" vc:maxVersion="1.1"/> > <xs:element name="E" type="Te-1.1" > vc:minVersion="1.1" vc:maxVersion="1.2"/> > <xs:element name="E" type="Te-1.2" > vc:minVersion="1.2" vc:maxVersion="1.21"/> > <xs:element name="E" type="Te-2.0" > vc:minVersion="1.21" vc:maxVersion="2.0"/> > <xs:element name="E" type="Te-1.2" > vc:minVersion="2.0"/> > > This ensures that a processor which has support for any version > whose number is 1.0 or higher will find exactly one declaration > to read. > >> ... >> >> and as you can see people will easily get confused about the maxVersion="1.1" in the XML Schema 1.0 documents. >> This also makes difficult to specify an XML Schema 1.1 only document, because what shall be used for maxVersion? 1.2, 2, 2.0, 1.1.1? > > For a 1.1 document, I would not use maxVersion; I'd use minVersion="1.1". >
Received on Friday, 11 October 2013 07:14:49 UTC