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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   example and explanation of substitutionGroup in Schema

[ Lists Home | Date Index | Thread Index ]
  • From: "Tolkin, Steve" <Steve.Tolkin@FMR.COM>
  • To: xml-dev@lists.xml.org
  • Date: Tue, 21 Nov 2000 15:05:38 -0500

Suppose I have a user who has defined many elements.  For various reasons,
e.g. to hold common attributes, it was decided to enclose each element in a
common wrapper element.
Using DTD notation (because it is terser) the content model might look like

<!ELEMENT wrapper
( elem1 
| elem2 
| ... 
| elem999)
>

I know I could translate this directly to Schema.  But then adding or
renaming an element requires changing two places.
I think that an alternate way of expressing this, maybe, is to use a
substitutionGroup.

<element name="dummyElement" abstract="true" type="decimal"
substitutionGroup="myElement"/>

<element name="elem1" substitutionGroup="myElement"/>
<element name="elem2" substitutionGroup="myElement"/>
...
<element name="elem999" substitutionGroup="myElement"/>

What are the pro's and con's of this?
One pro that I can see is that adding an element is easier, in that one one
place in the Schema needs to be changed.

Also, the above was cobbled together based on the example in schema1.html.
The syntax might not be correct.  I could not understand the prose
describing the substitutionGroup feature.  Is there an clearer writeup of
this, with examples, anyplace?

Thanks,
Steve
-- 
Steven Tolkin          steve.tolkin@fmr.com      617-563-0516 
Fidelity Investments   82 Devonshire St. V10D    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates.






 

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

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