- From: Paul Downey via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 15 Jul 2005 14:10:42 +0000
- To: public-ws-desc-eds@w3.org
Update of /sources/public/2002/ws/desc/schema-patterns
In directory hutz:/tmp/cvs-serv9108
Modified Files:
xml-schema-patterns.html xml-schema-patterns.xml
Log Message:
added map section, restructured enumeration and collection
Index: xml-schema-patterns.xml
===================================================================
RCS file: /sources/public/2002/ws/desc/schema-patterns/xml-schema-patterns.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xml-schema-patterns.xml 14 Jul 2005 15:55:47 -0000 1.4
--- xml-schema-patterns.xml 15 Jul 2005 14:10:39 -0000 1.5
***************
*** 8,15 ****
%entities;
! <!--
! <!ENTITY status "W3C Working Draft">
! -->
! <!ENTITY prevloc "http://www.w3.org/TR/2005/NOTE-xml-schema-patterns-20050502">
]>
<spec w3c-doctype="wgnote" role="&document.role;">
--- 8,14 ----
%entities;
! <!ENTITY wsdli-ns "http://www.w3.org/2005/05/wsdl-instance">
! <!ENTITY xmlschema-1 "http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/">
!
]>
<spec w3c-doctype="wgnote" role="&document.role;">
***************
*** 120,123 ****
--- 119,127 ----
<td>Defined in the W3C XML Schema specification <bibref ref="XMLSchemaP1"/>. </td>
</tr>
+ <tr>
+ <td>wsdli</td>
+ <td>"&wsdli-ns;"</td>
+ <td>Defined in the W3C WSDL 2.0 specification <bibref ref="wsdl20part1"/>. </td>
+ </tr>
</tbody>
</table>
***************
*** 132,137 ****
<div2 id="Naming">
<head>Naming Types</head>
! <p>Giving each data structure an individual type, following the so-called "venetian blind"
! schema authoring style, simplifies mapping to and from a data model.</p>
<p>The name of a schema type, attribute or element may be any valid XML non-colonized name
including names which may be reserved or not directly representable in some programming
--- 136,141 ----
<div2 id="Naming">
<head>Naming Types</head>
! <p>Giving each data structure an individual type, following the so-called "Venetian blind"
! schema authoring style, simplifies mapping to and from a data model. </p>
<p>The name of a schema type, attribute or element may be any valid XML non-colonized name
including names which may be reserved or not directly representable in some programming
***************
*** 157,195 ****
]]></eg>
</example>
! </div2>
! <div2 id="Enumerated-Open">
! <head>Open Enumerated Type</head>
! <p>Reusing the enumeration in a union with the base type or in combination with other
! enumerations may be used to express a vocabulary open to additional values. </p>
! <example id="eg-open-enum">
! <head>Open Enumerated Type</head>
! <eg xml:space="preserve"><![CDATA[
! <xs:simpleType name='AppleVariety' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='Braeburn' />
! <xs:enumeration value='Cox' />
! <xs:enumeration value='Egremont Russet' />
! <xs:enumeration value='Granny Smith' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='PlumVariety' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='Damson' />
! <xs:enumeration value='Greengage' />
! <xs:enumeration value='Victoria' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='FruitVariety' >
! <xs:union memberTypes='tns:AppleVariety tns:PlumVariety xs:string' />
</xs:simpleType>
]]></eg>
! </example>
</div2>
<div2 id="Collection">
<head>Collection</head>
! <p> A collection of data items, typically contained by a programming language "object", "class",
! "structure", or "record", may be represented in XML Schema using a single model
group. The individual items held in a collection may appear either as XML element or
attribute values.</p>
--- 161,206 ----
]]></eg>
</example>
! <div3 id="Enumerated-Extensible">
! <head>Extensible Enumerated Type</head>
! <p>An enumeration may made open to extension, possible in a later version of the schema,
! by creating a union with its base type. </p>
! <example id="eg-enum-extensible">
! <head>Extensible Enumerated Type</head>
! <eg xml:space="preserve"><![CDATA[
! <xs:simpleType name='KnownCurrency' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='GBP' />
! <xs:enumeration value='USD' />
! <xs:enumeration value='CAD' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='Currency' >
! <xs:union memberTypes='tns:Currency xs:string' />
! </xs:simpleType>
! ]]></eg>
! <p>Version 2 of the schema may introduce additional values whilst remaining backwards
! compatible with the original schema:</p>
! <eg xml:space="preserve"><![CDATA[
! <xs:simpleType name='KnownCurrency' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='GBP' />
! <xs:enumeration value='USD' />
! <xs:enumeration value='CAD' />
! <xs:enumeration value='EUR' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='Currency' >
! <xs:union memberTypes='tns:Currency xs:string' />
</xs:simpleType>
]]></eg>
! </example>
! </div3>
</div2>
<div2 id="Collection">
<head>Collection</head>
! <p> A collection of data items, typically contained by a programming language "object",
! "class", "structure", or "record", may be represented in XML Schema using a single model
group. The individual items held in a collection may appear either as XML element or
attribute values.</p>
***************
*** 226,241 ****
However, there are significant restrictions placed upon <code>all</code> types, not least
an element cannot have a <code>maxOccurs</code> value greater than <code>1</code>. The
! <loc href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#cos-nonambig">Unique
! Particle Attribution</loc> (UPA) constraint prevents a model group of <code>all</code>
! from being extended, either by containing an <code>any</code> element wildcard, being
! incorporated in a substitution group or derived using extension or restriction. </p>
! </div2>
! <div2 id="Collection-Extending-Attributes">
! <head>Extending A Collection With Attributes</head>
! <p>A collection may be made open to extension by the addition of attributes using the
! <code>anyAttribute</code> construct.</p>
! <example id="eg-extended-collection-attributes">
! <head>Extending a Collection with Attributes</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
--- 237,251 ----
However, there are significant restrictions placed upon <code>all</code> types, not least
an element cannot have a <code>maxOccurs</code> value greater than <code>1</code>. The
! <loc href="&xmlschema-1;#cos-nonambig">Unique Particle Attribution</loc> (UPA)
! constraint prevents a model group of <code>all</code> from being extended, either by
! containing an <code>any</code> element wildcard, being incorporated in a substitution
! group or derived using extension or restriction. </p>
! <div3 id="Collection-Extending-Attributes">
! <head>Extending A Collection With Attributes</head>
! <p>A collection may be made open to extension by the addition of attributes using the
! <code>anyAttribute</code> construct.</p>
! <example id="eg-extended-collection-attributes">
! <head>Extending a Collection with Attributes</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
***************
*** 247,276 ****
</xs:complexType>
]]></eg>
! </example>
! <p>The <code>namespace</code> value will typically either be: <ulist>
! <item>
! <p>
! <code>##targetNamespace</code> - the additional items will appear in the same
! namespace </p>
! </item>
! <item>
! <p>
! <code>##other</code> - the additional items may appear in a different namespace </p>
! </item>
! <item>
! <p>
! <code>##any</code> - the additional items may appear in any namespace</p>
! </item>
! </ulist>
! </p>
! <p>The <code>processContents</code> value of <code>lax</code> is typically used to indicate
! that additional items are unlikely to be known to the schema, this is a common case when
! evolving a schema to another version.</p>
! </div2>
! <div2 id="Collection-Extending-Elements">
! <head>Extending A Collection With Elements</head>
! <example id="eg-extended-collection-elements">
! <head>Extending a Collection with Elements in Another Namespace</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
--- 257,287 ----
</xs:complexType>
]]></eg>
! </example>
! <p>The <code>namespace</code> value will typically either be: <ulist>
! <item>
! <p>
! <code>##targetNamespace</code> - the additional items will appear in the same
! namespace </p>
! </item>
! <item>
! <p>
! <code>##other</code> - the additional items may appear in a different namespace
! </p>
! </item>
! <item>
! <p>
! <code>##any</code> - the additional items may appear in any namespace</p>
! </item>
! </ulist>
! </p>
! <p>The <code>processContents</code> value of <code>lax</code> is typically used to
! indicate that additional items are unlikely to be known to the schema, this is a common
! case when evolving a schema to another version.</p>
! </div3>
! <div3 id="Collection-Extending-Elements">
! <head>Extending A Collection With Elements</head>
! <example id="eg-extended-collection-elements">
! <head>Extending a Collection with Elements in Another Namespace</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
***************
*** 281,290 ****
</xs:complexType>
]]></eg>
! </example>
! <p> An <code>any</code> construct with a namespace of <code>##other</code> may directly
! follow an optional element. </p>
! <example id="eg-extended-collection-other">
! <head>Extending a Collection with Elements After an Optional Element</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
--- 292,301 ----
</xs:complexType>
]]></eg>
! </example>
! <p> An <code>any</code> construct with a namespace of <code>##other</code> may directly
! follow an optional element. </p>
! <example id="eg-extended-collection-other">
! <head>Extending a Collection with Elements After an Optional Element</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="ProductType">
<xs:sequence>
***************
*** 296,308 ****
</xs:complexType>
]]></eg>
! </example>
! <p>The UPA constraint prevents an <code>any</code> wildcard with a <code>namespace</code>
! value of <code>any</code> or <code>targetNamespace</code> to follow an element with a
! <code>minOccurs</code> value of <code>0</code>. In the case where a collection may be
! extended within the same namespace, an optional wrapper element may be used to contain the
! <code>any</code> wildcard.</p>
! <example id="eg-extended-collection-wrapper">
! <head>Extending a Collection within a Single Namespace</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerType">
<xs:sequence>
--- 307,319 ----
</xs:complexType>
]]></eg>
! </example>
! <p>The UPA constraint prevents an <code>any</code> wildcard with a <code>namespace</code>
! value of <code>any</code> or <code>targetNamespace</code> to follow an element with a
! <code>minOccurs</code> value of <code>0</code>. In the case where a collection may be
! extended within the same namespace, an optional wrapper element may be used to contain
! the <code>any</code> wildcard.</p>
! <example id="eg-extended-collection-wrapper">
! <head>Extending a Collection Within the Same Namespace</head>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerType">
<xs:sequence>
***************
*** 321,327 ****
</xs:complexType>
]]></eg>
! <p>Optional elements may be added to the CustomerExtenstionType whilst remaining
! compatible with previous versions of the schema:</p>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerExtensionType">
<xs:sequence>
--- 332,338 ----
</xs:complexType>
]]></eg>
! <p>Optional elements may be added to the CustomerExtenstionType whilst remaining
! compatible with previous versions of the schema:</p>
! <eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerExtensionType">
<xs:sequence>
***************
*** 333,348 ****
</xs:complexType>
]]></eg>
! </example>
! <p>Note that the 'any' element wildcard may not be used within an <code>all</code>
! model group.</p>
! </div2>
! <div2 id="Inheritence">
! <head>Inheritance</head>
! <ednote>
! <name>PaulD</name>
! <date>2005-07-14</date>
! <edtext>Examples of extending a collection into another namespace as for a class being
! extended into another package</edtext>
! </ednote>
</div2>
<div2 id="Vector">
--- 344,360 ----
</xs:complexType>
]]></eg>
! </example>
! <p>Note that the 'any' element wildcard may not be used within an <code>all</code> model
! group.</p>
! </div3>
! <div3 id="Collection-Inheritance">
! <head>Inheritance</head>
! <ednote>
! <name>PaulD</name>
! <date>2005-07-14</date>
! <edtext>Examples of extending a collection into another namespace as for a class being
! extended into another package</edtext>
! </ednote>
! </div3>
</div2>
<div2 id="Vector">
***************
*** 355,369 ****
<head>Wrapped Vector</head>
<eg xml:space="preserve"><![CDATA[
! <xsd:complexType name="ItemListType">
! <xsd:sequence>
! <xsd:element name="item" type="xsd:string" minOccurs=0 maxOccurs="unbounded"/>
! </xsd:sequence>
! </xsd:complexType>
]]></eg>
</example>
! <p> However, this may not always be the case, and a collection may contain repeated
! elements.</p>
<example id="eg-bare-vectors">
! <head>A Collection of Vectors</head>
<eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerType">
--- 367,381 ----
<head>Wrapped Vector</head>
<eg xml:space="preserve"><![CDATA[
! <xs:complexType name="ItemListType">
! <xs:sequence>
! <xs:element name="item" type="xs:string" minOccurs=0 maxOccurs="unbounded"/>
! </xs:sequence>
! </xs:complexType>
]]></eg>
</example>
! <p> However, there may not always be a wrapper element. A collection may contain more than
! one element with a <code>maxOccurs</code> value greater than <code>1</code>.</p>
<example id="eg-bare-vectors">
! <head>Bare Vectors</head>
<eg xml:space="preserve"><![CDATA[
<xs:complexType name="CustomerType">
***************
*** 375,378 ****
--- 387,401 ----
</xs:complexType>
]]></eg>
+ <eg xml:space="preserve"><![CDATA[
+ <customer>
+ <name>Mr</name>
+ <name>Benn</name>
+ <addressLine>52, Festive Road</addressLine>
+ <addressLine>London</addressLine>
+ <addressLine>England</addressLine>
+ <telephoneNumber>+44 207 946 0001</telephoneNumber>
+ <telephoneNumber>+44 7700 900 001</telephoneNumber>
+ </customer>
+ ]]></eg>
</example>
<p>A multi-dimensional array may be built by composing collections and vectors which contain
***************
*** 380,414 ****
the scope of this note.</p>
</div2>
! <div2 id="Map">
! <head>Map</head>
! <ednote>
! <name>PaulD</name>
! <date>2005-07-14</date>
! <edtext>This section is work in progress ..</edtext>
! </ednote>
! <p>A map is an unordered collection of appearing in programming languages as a "hash table",
! "dictionary", "associative array", "associative memory", "indexed table", "keyed data",
! etc.</p>
! <example id="eg-map-simple">
! <head>A Basic Map</head>
<eg xml:space="preserve"><![CDATA[
! <xs:complexType name="CountryCodeMap">
! <xs:all>
! <xs:element name="name" type="tns:CountryCodeMapItem" minOccurs="0" maxOccurs="unbounded"/>
! <xs:all>
! </xs:complexType>
! <xs:complexType name="CountryCodeMapItem">
! <xs:sequence>
! <xs:element name="countryName" type="xs:string"/>
! </xs:sequence>
! <xs:attribute type="xs:ID" use="required" />
! </xs:complexType>
]]></eg>
! </example>
! <p/>
! <example id="eg-map-xml-id">
! <head>Map Keyed Using xml:id</head>
<eg xml:space="preserve"><![CDATA[
<xs:schema targetNamespace="http://www.w3.org/1998/XML/Namespace">
<xs:attribute name="id" type="xs:ID"/>
--- 403,467 ----
the scope of this note.</p>
</div2>
! <div2 id="Maps">
! <head>Maps</head>
! <p>A map is an unordered collection of repeated items of the same type appearing in a
! programming language as a "hash table", "dictionary", "associative array", "associative
! memory", "indexed table", "keyed data", etc. Within the map, each item is accessible by a
! key value, unique within the scope of the collection.</p>
! <example id="eg-map-example">
! <head>Representing a Map</head>
! <p>The following Perl hash variable:</p>
<eg xml:space="preserve"><![CDATA[
! products = (
! '10203' => {
! name => 'apple'
! price => '35',
! },
! '10204' => {
! name => 'pear',
! price => '50',
! },
! )
]]></eg>
! <p>may be represented in XML using an attribute for the key:</p>
! <eg xml:space="preserve"><![CDATA[
! <products>
! <product id="10203">
! <name>apple</name>
! <price>35</price>
! </product>
! <product id="10204">
! <name>pear</name>
! <price>50</price>
! </product>
! ]]></eg>
! <p>or an element for the key:</p>
<eg xml:space="preserve"><![CDATA[
+ <products>
+ <product>
+ <key>10203</key>
+ <name>apple</name>
+ <price>35</price>
+ </product>
+ <product>
+ <key>10204</key>
+ <name>pear</name>
+ <price>50</price>
+ </product>
+ </products>
+ ]]></eg>
+ </example>
+ <p>For a tool to be able to recognise that a repeated item a map, it needs to be able to
+ identify which of the repeated elements or attributes represents the unique key.</p>
+ <div3 id="Map-ID">
+ <head>Map Keyed with xs:ID or xml:ID</head>
+ <p>The XML Schema type xs:ID and XML Core defined <bibref ref="XMLID"/> attribute
+ guarantee uniqueness of an value within the scope of an XML document. A repeated element
+ with a required attribute of type xs:ID may therefore be may be safely represented using
+ a map, with the xs:ID attribute as the key.</p>
+ <example id="eg-map-xml-id">
+ <head>Map Keyed Using xml:id</head>
+ <eg xml:space="preserve"><![CDATA[
<xs:schema targetNamespace="http://www.w3.org/1998/XML/Namespace">
<xs:attribute name="id" type="xs:ID"/>
***************
*** 428,432 ****
</xs:schema>
]]></eg>
! </example>
</div2>
</div1>
--- 481,571 ----
</xs:schema>
]]></eg>
! </example>
! </div3>
! <div3 id="Map-Unique-Key">
! <head>Map Type</head>
! <p>XML Schema provides a set of <loc
! href="&xmlschema-1;#cIdentity-constraint_Definitions">Identity Constraints</loc>,
! which may used to describe a value as being unique within a portion of a document
! identified using an XPath expression. A repeated element with a required attribute or
! element with a cardinality of one constrained by <code>xs:unique</code> may be safely
! represented using a map, with the unique elements or attributes forming the key.</p>
! <ednote>
! <name>PaulD</name>
! <date>2005-07-15</date>
! <edtext> This pattern seems promising, though it is limited to an element, difficult to
! present in a complexType. The XPath could be complex for tools to detect. Other schema
! identity constraints such as key/keyref suffer from similar difficulties. </edtext>
! </ednote>
! <p/>
! <example id="eg-map-unique">
! <head>Map with xs:unique Key</head>
! <eg xml:space="preserve"><![CDATA[
! <?xml version="1.0" encoding="UTF-8"?>
! <xs:element name="map">
! <xs:complexType>
! <xs:sequence>
! <xs:element name="item" type="MapItemType" minOccurs="0" maxOccurs="unbounded"/>
! </xs:sequence>
! </xs:complexType>
! <xs:unique name="item">
! <xs:selector xpath="item"/>
! <xs:field xpath="key"/>
! </xs:unique>
! </xs:element>
!
! <xs:complexType name="MapType">
! <xs:sequence>
! <xs:element ref="map"/>
! </xs:sequence>
! </xs:complexType>
!
! <xs:complexType name="MapItemType">
! <xs:sequence>
! <xs:element name="key" type="xs:anyType"/>
! <xs:element name="value" type="xs:anyType"/>
! </xs:sequence>
! </xs:complexType>
! ]]></eg>
! </example>
! </div3>
! <div3 id="Map-WSDL-Type">
! <head>WSDL Instance Map Item Type</head>
! <ednote>
! <name>PaulD</name>
! <date>2005-07-14</date>
! <edtext> This base type is offered as an alternative to the generic unique pattern and
! follows the approach taken by Axis. The wsdli namespace has been used without the
! approval of the WSDL WG and is therefore subject to change. </edtext>
! </ednote>
! <p>The WSDL Instance namespace defines a the MapItemType, which provides a container for a
! pair of elements, "key" and "value".</p>
! <example id="eg-map-element">
! <head>WSDL Instance Defined MapItemType</head>
! <eg xml:space="preserve">
! <xs:schema targetNamespace="&wsdli-ns;"
! elementFormDefault="qualified" attributeFormDefault="unqualified"> <![CDATA[
! <xs:complexType name="MapItemType">
! <xs:sequence>
! <xs:element name="key" type="xs:anyType"/>
! <xs:element name="value" type="xs:anyType"/>
! </xs:sequence>
! </xs:complexType>
! </xs:schema>
! ]]></eg>
! </example>
! <p>The MapItemType may used within a repeated element to represent a map in which the
! index is the "key" element, which may contain complex XML content.</p>
! <example id="eg-map-wsdli-use">
! <head>Use of the MapItemType</head>
! <eg xml:space="preserve"><![CDATA[
! <xs:complexType name="MapType">
! <xs:sequence>
! <xs:element name="item" minOccurs="0" maxOccurs="unbounded" type="wsdli:MapItemType"/>
! </xs:sequence>
! </xs:complexType>
! ]]></eg>
! </example>
! </div3>
</div2>
</div1>
***************
*** 434,439 ****
<head>Normative References</head>
<blist>
! <bibl id="XMLSchemaP1" key="XML Schema: Structures"
! href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/">
<titleref>XML Schema Part 1: Structures Second Edition</titleref>, H. Thompson, D. Beech,
M. Maloney, and N. Mendelsohn, Editors. World Wide Web Consortium Recommendation, 28
--- 573,577 ----
<head>Normative References</head>
<blist>
! <bibl id="XMLSchemaP1" key="XML Schema: Structures" href="&xmlschema-1;">
<titleref>XML Schema Part 1: Structures Second Edition</titleref>, H. Thompson, D. Beech,
M. Maloney, and N. Mendelsohn, Editors. World Wide Web Consortium Recommendation, 28
***************
*** 443,446 ****
--- 581,592 ----
<titleref>XML Schema Part 2: Datatypes Second Edition</titleref>, P. Byron and A.
Malhotra, Editors. World Wide Web Consortium Recommendation, 28 October 2004. </bibl>
+ <bibl id="XMLID" key="xml:id" href="http://www.w3.org/TR/xml-id/">
+ <titleref>xml:id Version 1.0</titleref>, J. Marsh, D. Veillard, N. Walsh, World Wide Web
+ Consortium Proposed Recommendation, July 2005. </bibl>
+ <bibl id="wsdl20part1" key="WSDL 2.0 Part 1"
+ href="http://www.w3.org/TR/2005/WD-wsdl20-20050510">
+ <titleref>Web Services Description Language (WSDL) Version 2.0 Part 1: Core
+ Language</titleref>, Roberto Chinnici, Martin Gudgin, Jean-Jacques Moreau, Jeffrey
+ Schlimmer, Sanjiva Weerawarana, World Wide Web Consortium Working Draft 10 May 2005 </bibl>
<bibl id="XMLInfoSet" key="XML Information Set"
href="http://www.w3.org/TR/2001/REC-xml-infoset-20011024/">
Index: xml-schema-patterns.html
===================================================================
RCS file: /sources/public/2002/ws/desc/schema-patterns/xml-schema-patterns.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** xml-schema-patterns.html 14 Jul 2005 15:55:47 -0000 1.4
--- xml-schema-patterns.html 15 Jul 2005 14:10:39 -0000 1.5
***************
*** 122,139 ****
2.2 <a href="#Enumerated">Enumerated
Type</a><br />
! 2.3 <a href="#Enumerated-Open">Open
! Enumerated Type</a><br />
! 2.4 <a href=
"#Collection">Collection</a><br />
! 2.5 <a href=
"#Collection-Extending-Attributes">Extending A Collection With
Attributes</a><br />
! 2.6 <a href=
"#Collection-Extending-Elements">Extending A Collection With
Elements</a><br />
! 2.7 <a href=
! "#Inheritence">Inheritance</a><br />
! 2.8 <a href="#Vector">Vector</a><br />
! 2.9 <a href="#Map">Map</a><br />
3 <a href="#normative-references">Normative References</a><br />
4 <a href="#informative-references">Informative
--- 122,145 ----
2.2 <a href="#Enumerated">Enumerated
Type</a><br />
! 2.2.1 <a href=
! "#Enumerated-Extensible">Extensible Enumerated Type</a><br />
! 2.3 <a href=
"#Collection">Collection</a><br />
! 2.3.1 <a href=
"#Collection-Extending-Attributes">Extending A Collection With
Attributes</a><br />
! 2.3.2 <a href=
"#Collection-Extending-Elements">Extending A Collection With
Elements</a><br />
! 2.3.3 <a href=
! "#Collection-Inheritance">Inheritance</a><br />
! 2.4 <a href="#Vector">Vector</a><br />
! 2.5 <a href="#Maps">Maps</a><br />
! 2.5.1 <a href=
! "#Map-ID">Map Keyed with xs:ID or xml:ID</a><br />
! 2.5.2 <a href=
! "#Map-Unique-Key">Map Type</a><br />
! 2.5.3 <a href=
! "#Map-WSDL-Type">WSDL Instance Map Item Type</a><br />
3 <a href="#normative-references">Normative References</a><br />
4 <a href="#informative-references">Informative
***************
*** 205,208 ****
--- 211,220 ----
"#XMLSchemaP1">[XML Schema: Structures]</a>.</td>
</tr>
+ <tr>
+ <td>wsdli</td>
+ <td>"http://www.w3.org/2005/05/wsdl-instance"</td>
+ <td>Defined in the W3C WSDL 2.0 specification <a href=
+ "#wsdl20part1">[WSDL 2.0 Part 1]</a>.</td>
+ </tr>
</tbody>
</table>
***************
*** 221,225 ****
<h3><a name="Naming" id="Naming"></a>2.1 Naming Types</h3>
<p>Giving each data structure an individual type, following the
! so-called "venetian blind" schema authoring style, simplifies
mapping to and from a data model.</p>
<p>The name of a schema type, attribute or element may be any valid
--- 233,237 ----
<h3><a name="Naming" id="Naming"></a>2.1 Naming Types</h3>
<p>Giving each data structure an individual type, following the
! so-called "Venetian blind" schema authoring style, simplifies
mapping to and from a data model.</p>
<p>The name of a schema type, attribute or element may be any valid
***************
*** 252,286 ****
</pre></div>
</div>
! </div>
! <div class="div2">
! <h3><a name="Enumerated-Open" id="Enumerated-Open"></a>2.3 Open
! Enumerated Type</h3>
! <p>Reusing the enumeration in a union with the base type or in
! combination with other enumerations may be used to express a
! vocabulary open to additional values.</p>
<div class="exampleOuter">
! <div class="exampleHeader"><a name="eg-open-enum" id=
! "eg-open-enum"></a>Example 2: Open Enumerated Type</div>
<div class="exampleInner">
<pre>
! <xs:simpleType name='AppleVariety' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='Braeburn' />
! <xs:enumeration value='Cox' />
! <xs:enumeration value='Egremont Russet' />
! <xs:enumeration value='Granny Smith' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='PlumVariety' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='Damson' />
! <xs:enumeration value='Greengage' />
! <xs:enumeration value='Victoria' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='FruitVariety' >
! <xs:union memberTypes='tns:AppleVariety tns:PlumVariety xs:string' />
</xs:simpleType>
--- 264,306 ----
</pre></div>
</div>
! <div class="div3">
! <h4><a name="Enumerated-Extensible" id=
! "Enumerated-Extensible"></a>2.2.1 Extensible Enumerated Type</h4>
! <p>An enumeration may made open to extension, possible in a later
! version of the schema, by creating a union with its base type.</p>
<div class="exampleOuter">
! <div class="exampleHeader"><a name="eg-enum-extensible" id=
! "eg-enum-extensible"></a>Example 2: Extensible Enumerated
! Type</div>
<div class="exampleInner">
<pre>
! <xs:simpleType name='KnownCurrency' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='GBP' />
! <xs:enumeration value='USD' />
! <xs:enumeration value='CAD' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='Currency' >
! <xs:union memberTypes='tns:Currency xs:string' />
! </xs:simpleType>
!
! </pre></div>
! <p>Version 2 of the schema may introduce additional values whilst
! remaining backwards compatible with the original schema:</p>
! <div class="exampleInner">
! <pre>
! <xs:simpleType name='KnownCurrency' >
<xs:restriction base='xs:string' >
! <xs:enumeration value='GBP' />
! <xs:enumeration value='USD' />
! <xs:enumeration value='CAD' />
! <xs:enumeration value='EUR' />
</xs:restriction>
</xs:simpleType>
! <xs:simpleType name='Currency' >
! <xs:union memberTypes='tns:Currency xs:string' />
</xs:simpleType>
***************
*** 288,293 ****
</div>
</div>
<div class="div2">
! <h3><a name="Collection" id="Collection"></a>2.4 Collection</h3>
<p>A collection of data items, typically contained by a programming
language "object", "class", "structure", or "record", may be
--- 308,314 ----
</div>
</div>
+ </div>
<div class="div2">
! <h3><a name="Collection" id="Collection"></a>2.3 Collection</h3>
<p>A collection of data items, typically contained by a programming
language "object", "class", "structure", or "record", may be
***************
*** 336,344 ****
<code>any</code> element wildcard, being incorporated in a
substitution group or derived using extension or restriction.</p>
! </div>
! <div class="div2">
! <h3><a name="Collection-Extending-Attributes" id=
! "Collection-Extending-Attributes"></a>2.5 Extending A Collection
! With Attributes</h3>
<p>A collection may be made open to extension by the addition of
attributes using the <code>anyAttribute</code> construct.</p>
--- 357,364 ----
<code>any</code> element wildcard, being incorporated in a
substitution group or derived using extension or restriction.</p>
! <div class="div3">
! <h4><a name="Collection-Extending-Attributes" id=
! "Collection-Extending-Attributes"></a>2.3.1 Extending A Collection
! With Attributes</h4>
<p>A collection may be made open to extension by the addition of
attributes using the <code>anyAttribute</code> construct.</p>
***************
*** 381,388 ****
to another version.</p>
</div>
! <div class="div2">
! <h3><a name="Collection-Extending-Elements" id=
! "Collection-Extending-Elements"></a>2.6 Extending A Collection With
! Elements</h3>
<div class="exampleOuter">
<div class="exampleHeader"><a name=
--- 401,408 ----
to another version.</p>
</div>
! <div class="div3">
! <h4><a name="Collection-Extending-Elements" id=
! "Collection-Extending-Elements"></a>2.3.2 Extending A Collection
! With Elements</h4>
<div class="exampleOuter">
<div class="exampleHeader"><a name=
***************
*** 431,435 ****
<div class="exampleHeader"><a name="eg-extended-collection-wrapper"
id="eg-extended-collection-wrapper"></a>Example 7: Extending a
! Collection within a Single Namespace</div>
<div class="exampleInner">
<pre>
--- 451,455 ----
<div class="exampleHeader"><a name="eg-extended-collection-wrapper"
id="eg-extended-collection-wrapper"></a>Example 7: Extending a
! Collection Within the Same Namespace</div>
<div class="exampleInner">
<pre>
***************
*** 470,475 ****
<code>all</code> model group.</p>
</div>
! <div class="div2">
! <h3><a name="Inheritence" id="Inheritence"></a>2.7 Inheritance</h3>
<table border="1" summary="Editorial note: PaulD">
<tr>
--- 490,496 ----
<code>all</code> model group.</p>
</div>
! <div class="div3">
! <h4><a name="Collection-Inheritance" id=
! "Collection-Inheritance"></a>2.3.3 Inheritance</h4>
<table border="1" summary="Editorial note: PaulD">
<tr>
***************
*** 485,490 ****
</table>
</div>
<div class="div2">
! <h3><a name="Vector" id="Vector"></a>2.8 Vector</h3>
<p>A vector is an ordered sequence of repeated items of the same
data type. This is a very common construct in programming languages
--- 506,512 ----
</table>
</div>
+ </div>
<div class="div2">
! <h3><a name="Vector" id="Vector"></a>2.4 Vector</h3>
<p>A vector is an ordered sequence of repeated items of the same
data type. This is a very common construct in programming languages
***************
*** 497,513 ****
<div class="exampleInner">
<pre>
! <xsd:complexType name="ItemListType">
! <xsd:sequence>
! <xsd:element name="item" type="xsd:string" minOccurs=0 maxOccurs="unbounded"/>
! </xsd:sequence>
! </xsd:complexType>
</pre></div>
</div>
! <p>However, this may not always be the case, and a collection may
! contain repeated elements.</p>
<div class="exampleOuter">
<div class="exampleHeader"><a name="eg-bare-vectors" id=
! "eg-bare-vectors"></a>Example 9: A Collection of Vectors</div>
<div class="exampleInner">
<pre>
--- 519,536 ----
<div class="exampleInner">
<pre>
! <xs:complexType name="ItemListType">
! <xs:sequence>
! <xs:element name="item" type="xs:string" minOccurs=0 maxOccurs="unbounded"/>
! </xs:sequence>
! </xs:complexType>
</pre></div>
</div>
! <p>However, there may not always be a wrapper element. A collection
! may contain more than one element with a <code>maxOccurs</code>
! value greater than <code>1</code>.</p>
<div class="exampleOuter">
<div class="exampleHeader"><a name="eg-bare-vectors" id=
! "eg-bare-vectors"></a>Example 9: Bare Vectors</div>
<div class="exampleInner">
<pre>
***************
*** 521,524 ****
--- 544,560 ----
</pre></div>
+ <div class="exampleInner">
+ <pre>
+ <customer>
+ <name>Mr</name>
+ <name>Benn</name>
+ <addressLine>52, Festive Road</addressLine>
+ <addressLine>London</addressLine>
+ <addressLine>England</addressLine>
+ <telephoneNumber>+44 207 946 0001</telephoneNumber>
+ <telephoneNumber>+44 7700 900 001</telephoneNumber>
+ </customer>
+
+ </pre></div>
</div>
<p>A multi-dimensional array may be built by composing collections
***************
*** 528,566 ****
</div>
<div class="div2">
! <h3><a name="Map" id="Map"></a>2.9 Map</h3>
! <table border="1" summary="Editorial note: PaulD">
! <tr>
! <td align="left" valign="top" width="50%"><b>Editorial note:
! PaulD</b></td>
! <td align="right" valign="top" width="50%">2005-07-14</td>
! </tr>
! <tr>
! <td colspan="2" align="left" valign="top">This section is work in
! progress ..</td>
! </tr>
! </table>
! <p>A map is an unordered collection of appearing in programming
! languages as a "hash table", "dictionary", "associative array",
! "associative memory", "indexed table", "keyed data", etc.</p>
<div class="exampleOuter">
! <div class="exampleHeader"><a name="eg-map-simple" id=
! "eg-map-simple"></a>Example 10: A Basic Map</div>
<div class="exampleInner">
<pre>
! <xs:complexType name="CountryCodeMap">
! <xs:all>
! <xs:element name="name" type="tns:CountryCodeMapItem" minOccurs="0" maxOccurs="unbounded"/>
! <xs:all>
! </xs:complexType>
! <xs:complexType name="CountryCodeMapItem">
! <xs:sequence>
! <xs:element name="countryName" type="xs:string"/>
! </xs:sequence>
! <xs:attribute type="xs:ID" use="required" />
! </xs:complexType>
</pre></div>
</div>
<div class="exampleOuter">
<div class="exampleHeader"><a name="eg-map-xml-id" id=
--- 564,635 ----
</div>
<div class="div2">
! <h3><a name="Maps" id="Maps"></a>2.5 Maps</h3>
! <p>A map is an unordered collection of repeated items of the same
! type appearing in a programming language as a "hash table",
! "dictionary", "associative array", "associative memory", "indexed
! table", "keyed data", etc. Within the map, each item is accessible
! by a key value, unique within the scope of the collection.</p>
<div class="exampleOuter">
! <div class="exampleHeader"><a name="eg-map-example" id=
! "eg-map-example"></a>Example 10: Representing a Map</div>
! <p>The following Perl hash variable:</p>
<div class="exampleInner">
<pre>
! products = (
! '10203' => {
! name => 'apple'
! price => '35',
! },
! '10204' => {
! name => 'pear',
! price => '50',
! },
! )
!
! </pre></div>
! <p>may be represented in XML using an attribute for the key:</p>
! <div class="exampleInner">
! <pre>
! <products>
! <product id="10203">
! <name>apple</name>
! <price>35</price>
! </product>
! <product id="10204">
! <name>pear</name>
! <price>50</price>
! </product>
!
! </pre></div>
! <p>or an element for the key:</p>
! <div class="exampleInner">
! <pre>
! <products>
! <product>
! <key>10203</key>
! <name>apple</name>
! <price>35</price>
! </product>
! <product>
! <key>10204</key>
! <name>pear</name>
! <price>50</price>
! </product>
! </products>
</pre></div>
</div>
+ <p>For a tool to be able to recognise that a repeated item a map,
+ it needs to be able to identify which of the repeated elements or
+ attributes represents the unique key.</p>
+ <div class="div3">
+ <h4><a name="Map-ID" id="Map-ID"></a>2.5.1 Map Keyed with xs:ID or
+ xml:ID</h4>
+ <p>The XML Schema type xs:ID and XML Core defined <a href=
+ "#XMLID">[xml:id]</a> attribute guarantee uniqueness of an value
+ within the scope of an XML document. A repeated element with a
+ required attribute of type xs:ID may therefore be may be safely
+ represented using a map, with the xs:ID attribute as the key.</p>
<div class="exampleOuter">
<div class="exampleHeader"><a name="eg-map-xml-id" id=
***************
*** 588,591 ****
--- 657,774 ----
</div>
</div>
+ <div class="div3">
+ <h4><a name="Map-Unique-Key" id="Map-Unique-Key"></a>2.5.2 Map
+ Type</h4>
+ <p>XML Schema provides a set of <a href=
+ "http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#cIdentity-constraint_Definitions">
+ Identity Constraints</a>, which may used to describe a value as
+ being unique within a portion of a document identified using an
+ XPath expression. A repeated element with a required attribute or
+ element with a cardinality of one constrained by
+ <code>xs:unique</code> may be safely represented using a map, with
+ the unique elements or attributes forming the key.</p>
+ <table border="1" summary="Editorial note: PaulD">
+ <tr>
+ <td align="left" valign="top" width="50%"><b>Editorial note:
+ PaulD</b></td>
+ <td align="right" valign="top" width="50%">2005-07-15</td>
+ </tr>
+ <tr>
+ <td colspan="2" align="left" valign="top">This pattern seems
+ promising, though it is limited to an element, difficult to present
+ in a complexType. The XPath could be complex for tools to detect.
+ Other schema identity constraints such as key/keyref suffer from
+ similar difficulties.</td>
+ </tr>
+ </table>
+ <div class="exampleOuter">
+ <div class="exampleHeader"><a name="eg-map-unique" id=
+ "eg-map-unique"></a>Example 12: Map with xs:unique Key</div>
+ <div class="exampleInner">
+ <pre>
+ <?xml version="1.0" encoding="UTF-8"?>
+ <xs:element name="map">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="item" type="MapItemType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:unique name="item">
+ <xs:selector xpath="item"/>
+ <xs:field xpath="key"/>
+ </xs:unique>
+ </xs:element>
+
+ <xs:complexType name="MapType">
+ <xs:sequence>
+ <xs:element ref="map"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="MapItemType">
+ <xs:sequence>
+ <xs:element name="key" type="xs:anyType"/>
+ <xs:element name="value" type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ </pre></div>
+ </div>
+ </div>
+ <div class="div3">
+ <h4><a name="Map-WSDL-Type" id="Map-WSDL-Type"></a>2.5.3 WSDL
+ Instance Map Item Type</h4>
+ <table border="1" summary="Editorial note: PaulD">
+ <tr>
+ <td align="left" valign="top" width="50%"><b>Editorial note:
+ PaulD</b></td>
+ <td align="right" valign="top" width="50%">2005-07-14</td>
+ </tr>
+ <tr>
+ <td colspan="2" align="left" valign="top">This base type is offered
+ as an alternative to the generic unique pattern and follows the
+ approach taken by Axis. The wsdli namespace has been used without
+ the approval of the WSDL WG and is therefore subject to
+ change.</td>
+ </tr>
+ </table>
+ <p>The WSDL Instance namespace defines a the MapItemType, which
+ provides a container for a pair of elements, "key" and "value".</p>
+ <div class="exampleOuter">
+ <div class="exampleHeader"><a name="eg-map-element" id=
+ "eg-map-element"></a>Example 13: WSDL Instance Defined
+ MapItemType</div>
+ <div class="exampleInner">
+ <pre>
+ <xs:schema targetNamespace="http://www.w3.org/2005/05/wsdl-instance"
+ elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:complexType name="MapItemType">
+ <xs:sequence>
+ <xs:element name="key" type="xs:anyType"/>
+ <xs:element name="value" type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+
+ </pre></div>
+ </div>
+ <p>The MapItemType may used within a repeated element to represent
+ a map in which the index is the "key" element, which may contain
+ complex XML content.</p>
+ <div class="exampleOuter">
+ <div class="exampleHeader"><a name="eg-map-wsdli-use" id=
+ "eg-map-wsdli-use"></a>Example 14: Use of the MapItemType</div>
+ <div class="exampleInner">
+ <pre>
+ <xs:complexType name="MapType">
+ <xs:sequence>
+ <xs:element name="item" minOccurs="0" maxOccurs="unbounded" type="wsdli:MapItemType"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ </pre></div>
+ </div>
+ </div>
+ </div>
</div>
<div class="div1">
***************
*** 609,612 ****
--- 792,809 ----
October 2004. (See
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/.)</dd>
+ <dt class="label"><a name="XMLID" id="XMLID"></a>xml:id</dt>
+ <dd><a href="http://www.w3.org/TR/xml-id/"><cite>xml:id Version
+ 1.0</cite></a>, J. Marsh, D. Veillard, N. Walsh, World Wide Web
+ Consortium Proposed Recommendation, July 2005. (See
+ http://www.w3.org/TR/xml-id/.)</dd>
+ <dt class="label"><a name="wsdl20part1" id="wsdl20part1"></a>WSDL
+ 2.0 Part 1</dt>
+ <dd><a href=
+ "http://www.w3.org/TR/2005/WD-wsdl20-20050510"><cite>Web Services
+ Description Language (WSDL) Version 2.0 Part 1: Core
+ Language</cite></a>, Roberto Chinnici, Martin Gudgin, Jean-Jacques
+ Moreau, Jeffrey Schlimmer, Sanjiva Weerawarana, World Wide Web
+ Consortium Working Draft 10 May 2005 (See
+ http://www.w3.org/TR/2005/WD-wsdl20-20050510.)</dd>
<dt class="label"><a name="XMLInfoSet" id="XMLInfoSet"></a>XML
Information Set</dt>
Received on Friday, 15 July 2005 14:10:48 UTC