OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Syntax vs semantics

[ Lists Home | Date Index | Thread Index ]

The use of substitution groups in a schema doesn't mean you're straying
dangerously over the syntax-semantics boundary.  It just means that
the _syntax_ of a number of your elements has something in common.  If
I write:

<xs:element name="para">
 <xs:complexType mixed="true">
  <xs:sequence>
   <xs:element ref="decoration" minOccurs="0" maxOccurs="unbounded"/>
  <xs:sequence>
 </xs:complexType>
</xs:element>

<xs:element name="decoration" abstract="true" type="subDeco"/>

<xs:complexType name="subDeco" mixed="true">
 <xs:sequence>
  <xs:element ref="coreDecoration" minOccurs="0" maxOccurs="unbounded"/>
 <xs:sequence>
</xs:complexType>

<xs:element name="coreDecoration" abstract="true" type="xs:string/>

<xs:element name="strong" substitutionGroup="decoration"/>

<xs:element name="quote" substitutionGroup="decoration"/>

<xs:element name="emph" substitutionGroup="coreDecoration"/>

in order to validate things such as

<para>This is a review of <strong>The <emph>Last</emph>
Emperor</strong>, in which we find the lead character saying <quote>I
<emph>will</emph> go to the ball!</quote>.</para>

there's nothing particular semantic about the use substitution group,
except in so far as one expects semantics to follow syntax to some
extent in _any_ coherent document type.

I'm just using the s-g mechanism to capture common patterning of the
relevant elements, and to make it easy to extend my document type by
adding more decorations in the future.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS