[Bug 6194] New: Attribute wildcard union and intersection examples

http://www.w3.org/Bugs/Public/show_bug.cgi?id=6194

           Summary: Attribute wildcard union and intersection examples
           Product: XML Schema
           Version: 1.1 only
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Primer: XSD Part 0
        AssignedTo: David_E3@VERIFONE.com
        ReportedBy: sandygao@ca.ibm.com
         QAContact: www-xml-schema-comments@w3.org


During the 2008-10 F2F meeting, the WG discussed situations when attribute
wildcards are unioned and intersected.

Union is used when complex types are derived via extension; intersection is
used when multiple attribute wildcards are specified (explicitly, via attribute
group reference, or via defaulted attribute group).

We concluded that sometimes union gives the expected behavior, and sometimes
intersection. Examples should be added to the primer to highlight these
situations to help user choose between explicit specification and extension.

Example1:

<xs:schema>
   <xs:attributeGroup name="c1">
     <xs:anyAttribute namespace="ns1"/>
   </xs:attributeGroup>
   <xs:attributeGroup name="c2">
     <xs:anyAttribute namespace="ns2"/>
   </xs:attributeGroup>

   <xs:complexType name="foo">
     <xs:attributeGroup ref="c1"/>
     <xs:attributeGroup ref="c2"/>
   </xs:complexType>
</xs:schema>

In this case, intersection is used, and the result is a wildcard that allows
nothing. Complex type extension should be used in this case:

<xs:schema>
   <xs:attributeGroup name="c1">
     <xs:anyAttribute namespace="ns1"/>
   </xs:attributeGroup>
   <xs:complexType name="fooBase">
     <xs:attributeGroup ref="c1"/>
   </xs:complexType>

   <xs:attributeGroup name="c2">
     <xs:anyAttribute namespace="ns2"/>
   </xs:attributeGroup>
   <xs:complexType name="foo">
     <xs:complexContent>
       <xs:extension base="fooBase">
         <xs:attributeGroup ref="c2"/>
       </xs:extension>
     </xs:complexType>
   </xs:complexType>
</xs:schema>

Example 2:

<xs:schema tns="v1">
   <xs:attributeGroup name="c1">
     <xs:anyAttribute namespace="##other"/>
   </xs:attributeGroup>

   <xs:complexType name="foo">
     <xs:attributeGroup ref="c1"/>
   </xs:complexType>
</xs:schema>

<xs:schema tns="v2">
   <xs:attributeGroup name="c2">
     <xs:anyAttribute namespace="##other"/>
   </xs:attributeGroup>

   <xs:complexType name="foo">
     <xs:complexContent>
       <xs:extension base="v1:foo">
         <xs:attributeGroup ref="c2"/>
       </xs:extension>
     </xs:complexContent>
   </xs:complexType>
</xs:schema>

This gives you union, which allows all qualified names. This may not be what's
expected (names in neither "v1" nor "v2"). In this case, intersection is the
correct behavior. That is, v2 reads:

   <xs:complexType name="foo">
     <xs:attributeGroup ref="v1:c1"/>
     <xs:attributeGroup ref="c2"/>
   </xs:complexType>


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 31 October 2008 00:13:58 UTC