[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Schemas: Best Practices
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|