W3C home > Mailing lists > Public > www-tag@w3.org > April 2007

Use of Substitution Groups

From: David Orchard <dorchard@bea.com>
Date: Mon, 23 Apr 2007 12:56:44 -0700
Message-ID: <E16EB59B8AEDF445B644617E3C1B3C9C039B191C@repbex01.amer.bea.com>
To: <www-tag@w3.org>

Henry, Dan, etc.,

Is this the scenario that you are talking about?

personName and personNameWithMiddle are of 2 different types that are in
the substitution group for AbstractPersonName.  It's more interesting
when the personNameWithMiddle is in a different schema doc and
namespace, but this is the heart of it.  

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.example.org/name/1" 
      xmlns:namens="http://www.example.org/name/1"> 

 <xs:element name="AbstractPersonName" abstract="true"/>
 <xs:element name="personName" type="namens:nameType"
substitutionGroup="namens:AbstractPersonName"/>
  
 <xs:complexType name="nameType">
	 <xs:sequence minOccurs="0" maxOccurs="unbounded">
		 <xs:choice>
			 <xs:element ref="namens:given" /> 
			 <xs:element ref="namens:family" /> 
		  </xs:choice>
	  </xs:sequence>
	  <xs:anyAttribute namespace="##any" processContents="strict" />

  </xs:complexType>
  
  <xs:element name="given" type="xs:string"/>
  <xs:element name="family" type="xs:string"/>
  
 <xs:complexType name="nameWithMiddleType">
	 <xs:sequence minOccurs="0" maxOccurs="unbounded">
		 <xs:choice>
		   <xs:element ref="namens:given" /> 
		   <xs:element ref="namens:family" /> 
		   <xs:element ref="namens:middle" minOccurs="0"/>
		 </xs:choice>
	 </xs:sequence>
     <xs:anyAttribute namespace="##any" processContents="strict" /> 
  </xs:complexType>
  
  <xs:element name="middle" type="xs:string"/>
  <xs:element name="personNameWithMiddle"
type="namens:nameWithMiddleType"
substitutionGroup="namens:AbstractPersonName"/>
  
</xs:schema>

Cheers,
Dave
Received on Monday, 23 April 2007 19:56:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:47:45 GMT