Re: XML Schema language version

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".

-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************

Received on Friday, 11 October 2013 00:13:19 UTC