[DFDL-WG] DFDL wildcards with dimension

Mike Beckerle beckerle at us.ibm.com
Wed Nov 21 12:44:35 CST 2007


I did some investigation.

1) xs:any wildcards are not allowed inside xs:all groups at all. 

2) The schema below is valid, and admits the instance document following 
it:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <xsd:element name="x"> 
 <xsd:complexType>
  <xsd:sequence>
   <xsd:element name="name"/>
   <xsd:element name="address"/>
   <xsd:any processContents="lax" minOccurs='0' maxOccurs='unbounded'/>
  </xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>

Here's the instance:

<?xml version="1.0"?>
<x>
<name/>
<address/>
<foo/>
<bar/>
<quux/>
<frobboz/>
</x>

3) Note however, the only way to create an XML Schema which will validate 
both the instance above and the one below where the order is all 
scrambled, is an array-of-choice schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <xsd:element name="x"> 
 <xsd:complexType>
  <xsd:choice maxOccurs='unbounded'> <!-- array of choice -->
   <xsd:element name="name"/>
   <xsd:element name="address"/>
   <xsd:any processContents="lax"/>
  </xsd:choice>
</xsd:complexType>
</xsd:element>

</xsd:schema>

This array-of-choice schema will accept this instance document also:

<?xml version="1.0"?>
<x>
<foo/>
<address/>
<bar/>
<name/>
<quux/>
<frobboz/>
</x>

The above array-of-choice schema obviously will also accept things where 
there are multiple name and address entries, which is undesirable, but the 
XPath expressions x/name and x/address will still work. 

<?xml version="1.0"?>
<x>
<address/>
<address/>
<foobar/>
</x>

Implications for DFDL: I suggest we should allow dimension on any 
wildcards because this unordered sequence DFDL fragment:

<xsd:sequence dfdl:ordered="false">
    <xsd:element name="name"/>
    <xsd:element name="address"/>
    <xsd:any id="unknown" processContents="lax" minOccurs='0' 
maxOccurs='unbounded'/>
 </xsd:sequence>

describes something quite useful which otherwise requires an array of 
choice to model. 

Array-of-choice is generally undesirable as a model because it loses the 
cardinality information that says that name is required and address is 
required and there can be exactly 1 instance of each. 

...mikeb

Mike Beckerle
STSM, Architect, Scalable Computing
IBM Software Group
Information Platform and Solutions
Westborough, MA 01581
direct: voice and FAX 508-599-7148
assistant: Pam Riordan 
                  priordan at us.ibm.com 
                  508-599-7046

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ogf.org/pipermail/dfdl-wg/attachments/20071121/4cfd2d37/attachment-0001.html 


More information about the dfdl-wg mailing list