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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: XML Schemas: Best Practices

[ Lists Home | Date Index | Thread Index ]
  • From: "Roger L. Costello" <costello@mitre.org>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 14 Dec 2000 14:41:25 -0500

Hi Folks,

[1] I would like to put on hold the topic of "Capturing Semantics of XML
Schema Components".  I realize now that that is a huge topic and it is
probably best to hold off on it till after the holidays.

[2] I gave a talk last week at XML 2000 on the results of our Best
Practices discussions.  An on-line version of the talk may be found at: 

       http://www.xfront.com/xml2000/

[3] The issue that I would like to start on now is: "Use Cases for
element substitution".  I would like for us to collectively come up with
a set of use cases for where it is appropriate to use element
substitution.

First, let's recall what element substitution is all about.  Element
substitution allows you to create an element that can substitute for
another element in an instance document.

Example.

In the below example I declare an element, metro, which can substitute
for subway in instance documents:

    <element name="subway" type="string"/>
    <element name="metro" substitutionGroup="a:subway"/>
    <element name="transportation">
        <complexType>
            <sequence>
                 <element ref="a:subway"/>
            </sequence>
        </complexType>
    </element>

Here's an instance document which uses <subway>:

    <transportation>
        <subway>Red Line</subway>
    </transportation>

Since metro can substitute for subway, here is another instance document
where <transportation> contains <metro>:

    <transportation>
        <metro>Red Line</metro>
    </transportation>

Thus, this example shows how the subway element may be substituted by
the metro element.

Is this subway/metro example a good use case for element substitution?

It occurred to me that one use case for element substitution is for
allowing instance document tags to be expressed in different languages.

For the above example I could use element substitution to enable
instance document authors to express <transportation> or <subway> in
either English or German:

   <element name="subway" type="string"/>
   <element name="Fußgängerunterführung" substitutionGroup="a:subway"/>
   <complexType name="transport">
        <sequence>
             <element ref="a:subway"/>
        </sequence>
   </complexType>
   <element name="transportation" type="a:transport"/>
   <element name="Beförderung" substitutionGroup="a:transportation"/>

Now someone could create an instance document and use either English or
German tags.  For example, here an instance document is expressed in
German:

    <Beförderung>
        <Fußgängerunterführung>Rot zeile</Fußgängerunterführung>
    </Beförderung>

Is this a good use case for element substitution?

What are other good use cases for element substitution?  I would like
for us to compile a list of use cases.  /Roger





 

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

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