Re: Use of Substitution Groups

On Mon, 2007-04-23 at 12:56 -0700, David Orchard wrote:
> 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.  

Well, to my mind, the distributed nature of the use case
is the heart of it. The schema syntax is a detail that
I have trouble focusing on.

Which of AbstractPersonName and such corresponds to
my:box and html:block in the example I gave?

[[
I'm interested in a form of extensibility where a markup
language designer can make a new my:box element and
say "it's an HTML block element"; then, when a
document containing a my:block element is checked
for syntactic happiness, the checking tool uses
normal HTML schemas until it gets to my:box; then
it looks up my:box in the web, finds that it's
declared to be an HTML block, and find than
an HTML block is allowed here, and carries on happily.
]]
-- http://lists.w3.org/Archives/Public/public-xml-versioning/2007Feb/0000.html

> <?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
-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Monday, 23 April 2007 20:10:39 UTC