W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2007

[Request] Xerces-J: XML Schema 1.1 feature feedback

From: Khaled Noaman <knoaman@ca.ibm.com>
Date: Fri, 9 Nov 2007 17:01:02 -0500
To: j-users@xerces.apache.org, xml-dev@lists.xml.org, xmlschema-dev@w3.org
Cc: j-dev@xerces.apache.org
Message-ID: <OF157739F0.50E8D049-ON8525738E.0078B7A0-8525738E.0078ECCF@ca.ibm.com>

The W3C Schema WG has released a last call working draft of XML Schema 1.1 
Part 1: Structures. We are considering implementing features from this 
draft in Xerces-J. We would like to understand which features users are 
most interested in and what scenarios they plan on using them in.

Here's a summary of the major features introduced in the spec:

All Group 
XML Schema 1.0 imposed many restrictions on <all> groups. XML Schema 1.1 
has relaxed several of those constraints:
<all> groups can now be extended by adding more members to them.
Wildcards are now allowed.
Particles in <all> groups can now have the value of maxOccurs be greater 
than 1.

<xs:complexType name="applianceType">
  <xs:element name="item" type="xs:string"/>
  <xs:element name="description" type="xs:string"/>

<xs:complexType name="heaterType">
  <xs:extension base="applianceType">
    <xs:element name="power_in_watt" type="xs:integer"/>
    <xs:any processContents="lax"/>

A form of co-occurrence constraint, using XPath 2.0 expressions, that is 
associated with a complex type to constrain element and attribute values. 
The list of assertions is evaluated when a complex type is used to 
validate an element. 

<xs:complexType name="intRange">
 <xs:attribute name="min" type="xs:int"/>
 <xs:attribute name="max" type="xs:int"/>
 <xs:assert test="@min le @max"/>

The value of the ?min? attribute must be less than the value of the ?max? 

<xs:complexType name="arrayType">
  <xs:element name="entry" minOccurs="0" maxOccurs="unbounded"/>
 <xs:attribute name="length" type="xs:int"/>
 <xs:assert test="@length eq fn:count(./entry)"/>

The value of the ?length? attribute must be equal to the number of 
occurrences of the ?entry? sub-elements.

Open Content Models
A new mechanism to allow content models to accept elements other than 
those explicitly defined. The schema author controls the degree of 
openness of the content model. They can specify whether elements should be 
accepted everywhere or at the end of the content model.

<xs:complexType name="name">
  <xs:openContent mode="suffix">
    <xs:any namespace="##other" processContents="skip"/>
    <xs:element name="given" type="xs:string"/>
    <xs:element name="middle" type="xs:string" minOccurs="0"/>
    <xs:element name="family" type="xs:string"/>

A schema author can also define a default open content at the schema 
document level, thus saving many copy/paste if the open content is the 
same across the complex types.

  . . .
  <xs:defaultOpenContent mode="interleave">
    <xs:any processContents="lax"/>
  . . .

Enhanced Wildcards
In XML Schema 1.0, a schema author was only allowed to exclude elements 
and attributes from one namespace, the target namespace,  by using 
##other. In XML Schema 1.1, a schema author can define wildcards that 
Elements and attributes from a set of namespaces by using [notNamespace]
A particular set of qualified elements and attributes by using [notQName]
?not-in-schema? elements and attributes (those that do not match any 
declaration in the schema)  by including the ##defined keyword in 

<xs:any namespace="http://www.w3.org/1999/XSL/Transform"
        notQName="xsl:comment xsl:fallback"/>

<xs:anyAttribute xmlns:ns1="http://ns1"
  notNamespace="ns1 ##targetNamespace"/>

Complex Type Restriction
The rules for checking validity of complex-type restrictions have been 
simplified. The set of elements or attributes accepted by a restriction 
must be a subset of those accepted by its base type.

Conditional Type Assignment
A form of co-occurrence constraint, using XPath 2.0, that allows for a 
type to be assigned to an element instance based on its properties 
(typically attribute values).

<xs:complexType name="valueType">
  <xs:extenstion base="xs:long">
   <xs:attribute name="kind" type="xs:string"/>

<xs:element name="value" type="valueType">
 <xs:alternative test="@kind='int'" type="xs:int"/>
 <xs:alternative test="@kind='short'" type="xs:short"/>
 <xs:alternative test="@kind='byte'" type="xs:byte"/>

Default Attributes
A new mechanism that makes it easier for schema authors to include common 
attributes like xml:base and xml:lang in all their content models.

  . . .

Conditional Inclusion
A mechanism that allows conforming XML Schema 1.1 processors to 
successfully ignore new constructs introduced in future version of the 
spec. It also allows schema authors to define schemas with newer 
constructs and be able to fall back to older versions when the newer 
constructs are not available.


  <xsd:element name="e" vc:minVersion="3.2">
    <!--* declaration suitable for 3.2 
        * and later processors *-->
  <xsd:element name="e" 
    <!--* declaration suitable for processors
        * supporting versions 1.1 through 3.1

We would appreciate your feedback.
Received on Saturday, 10 November 2007 14:06:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:13 UTC