W3C home > Mailing lists > Public > public-xsd-databinding@w3.org > June 2006

ISSUE-33: pattern for xs:choice

From: <jon.calladine@bt.com>
Date: Wed, 14 Jun 2006 18:47:41 +0100
Message-ID: <657E2B34242ACC46BDD6774A9728F9E3686E8E@E03MVZ3-UKDY.domain1.systemhost.net>
To: <public-xsd-databinding@w3.org>

Discharging ACTION-49
http://www.w3.org/2005/06/tracker/databinding/actions/49

A pattern for choice schema would be:

	<xs:element name="elementChoiceHat" type="ex:Hat"/>

	<xs:complexType name="Hat">
	  <xs:choice>
	    <xs:element name="trilby" type="xs:string"/>
	    <xs:element name="panama" type="xs:string"/>
	    <xs:element name="bearskin" type="xs:string"/>
	  </xs:choice>
	</xs:complexType>

With instance data:

<ex:elementChoiceHat>
   <ex:panama>Carludovica palmata</ex:panama>
</ex:elementChoiceHat>

<ex:elementChoiceHat>
<ex:trilby>felt</ex:trilby>
</ex:elementChoiceHat>


In ready to consume form for the document:

 
 <div2 id="pattern-Choice" class="pattern"><head>Choice</head>
	<glist>
	    <label>URI</label>
	    <def><eg
class="URI">http://www.w3.org/2002/ws/databinding/patterns/6/05/Choice</
eg></def>
	    <label>Definition</label>
	    <def>-</def>
 
	    <label>Examples</label>
	    <def>
	      <example id="eg-element-Choice-hat">
		<head>Choice</head>
		<glist>
		    <def><eg xml:space="preserve"
class="schemaexample"><![CDATA[

	<xs:element name="elementChoiceHat" type="ex:Hat"/>

	<xs:complexType name="Hat">
	  <xs:choice>
	    <xs:element name="trilby" type="xs:string"/>
	    <xs:element name="panama" type="xs:string"/>
	    <xs:element name="bearskin" type="xs:string"/>
	  </xs:choice>
	</xs:complexType>
          ]]></eg></def>


		    <label>Instance:</label>
		    <def><eg xml:space="preserve"
class="instanceexample"><![CDATA[
<ex:elementChoiceHat>
<ex:trilby>felt</ex:trilby>
</ex:elementChoiceHat>
]]></eg></def>
		    <label>Instance:</label>
		    <def><eg xml:space="preserve"
class="instanceexample"><![CDATA[
<ex:elementChoiceHat>
<ex:panama>Carludovica palmata</ex:panama>
</ex:elementChoiceHat>
]]></eg></def>
		</glist>
	      </example>
	    </def>
	</glist>
      </div2>
Received on Wednesday, 14 June 2006 17:48:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 18:20:37 GMT