W3C

ElementKey Example

<xs:schemaTargetNamespaceUnqualifiedLocalAttributes targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/09/"TargetNamespace elementFormDefault="qualified"QualifiedLocalElements>
<xs:elementGlobalElementElementTypeReference name="elementKey"IdentifierNameGlobalElementElementTypeReference type="ex:ElementKey"GlobalElementElementTypeReference>
<xs:keyElementKey name="key"IdentifierName>
<xs:selectorElementKey xpath=".//item"ElementKey/>
<xs:fieldElementKey xpath="number"ElementKey/>
</xs:key>
</xs:element>
<xs:complexTypeGlobalComplexType name="itemType"IdentifierNameGlobalComplexType>
<xs:sequenceComplexTypeSequence> </xs:sequence>
</xs:complexType>
</xs:schema>

The example schema [ElementKey.xsd] has been classified as being an Advanced XML Schema Patterns for Databinding 1.0 conformant document as it only exhibits the following patterns:

Status Nodes Name XPath
basic TargetNamespace .[@targetNamespace]/ (., @targetNamespace)
basic QualifiedLocalElements .[@elementFormDefault = 'qualified']/ (@elementFormDefault)
basic UnqualifiedLocalAttributes .[not(@attributeFormDefault) or @attributeFormDefault = 'unqualified']/ (., @attributeFormDefault)
basic IdentifierName .//.[matches(@name, "^[A-Za-z_]([A-Za-z0-9_]0 31)$")]/ (@name)
basic GlobalElement ./xs:element[@name and @type and contains(@type, ':')]/ (., @name, @type)
basic ElementMinOccurs1MaxOccursUnbounded .//xs:element[(not(@minOccurs) or @minOccurs = '1') and @maxOccurs = 'unbounded']/ (@minOccurs, @maxOccurs)
basic GlobalComplexType ./xs:complexType[@name]/ (., @name)
basic ComplexTypeSequence .//xs:complexType/xs:sequence/ (., xs:element/(., @name))
basic GlobalElementSequence ./xs:element[@name]/xs:complexType/xs:sequence[xs:element]/ (../../(., @name), .., ., xs:element/(., @name))
basic SequenceElement .//xs:sequence/xs:element/(.)
basic SequenceSingleRepeatedElement .//xs:sequence[count(xs:element) = 1]/xs:element[@maxOccurs = 'unbounded']/ (., @maxOccurs)
basic ElementTypeReference .//xs:element[@name and @type and namespace-uri-from-QName(resolve-QName(@type,.)) != 'http://www.w3.org/2001/XMLSchema' and contains(@type, ':')]/ (., @name, @type)
basic ElementReference .//xs:element[@ref and contains(@ref, ':')]/ (., @ref)
advanced IntegerElement .//xs:element/@type[resolve-QName(.,..) = xs:QName('xs:integer')]
basic GlobalElementComplexType .//xs:element[parent::xs:schema]/xs:complexType / (.,..)
advanced ElementKey .//xs:element/xs:key[xs:selector and xs:field]/(., xs:selector, xs:selector/(@xpath), xs:field, xs:field/(@xpath))

To facilitate testing, the example schema element has been wrapped in the following descriptions:

The following valid instance documents are provided:

Instance Validity
ElementKey01 true

  <ex:elementKey>
        <ex:item>
          <ex:number>1234</ex:number>
        </ex:item>
      </ex:elementKey>

This document was produced by the W3C XML Schema Patterns for Databinding Working Group. Comments on this document may be sent to the public public-xsd-databinding-comments@w3.org mailing list (public archive).

Generated from examples.xml $Date: 2008/07/23 13:14:53 $