- From: Roger L. Costello <costello@mitre.org>
- Date: Fri, 15 Dec 2000 13:59:34 -0500
- To: xmlschema-dev@w3.org, costello@mitre.org
Hi Folks,
If I have an element that is in a substitutionGroup with a head element,
and it has a type that is derived from the head element's type, then in
an instance document do I need to specify its type using xsi:type?
Example.
<complexType name="PublicationType">
<sequence>
<element name="Title" type="string"/>
<element name="Author" type="string" />
<element name="Date" type="year"/>
</sequence>
</complexType>
<complexType name="BookType">
<complexContent>
<extension base="cat:PublicationType" >
<sequence>
<element name="ISBN" type="string"/>
<element name="Publisher" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="Publication" type="a:PublicationType"/>
<element name="Book" substitutionGroup="a:Publication"
type="a:BookType"/>
<element name="Review">
<complexType>
<sequence>
<element ref="a:Publication""/>
</sequence>
</complexType>
</element>
Here is an instance document, which uses the Publication element within
<Review>:
<Review>
<Publication>
<Title>Antiaging Strategies</Title>
<Author>Dr. Herman Fleishman</Author>
<Date>12-04-00</Date>
</Publication>
</Review>
Here is an alternate instance document, where the Publication element
has been substituted by the Book element:
<Review>
<Book xsi:type="a:BookType">
<Title>Illusions</Title>
<Author>Richard Bach</Author>
<Date>05-10-72</Date>
<ISBN>94303-12021-43892</ISBN>
<Publisher>McMillin Publishing</Publisher>
</Book>
</Review>
Is it necessary to use xsi:type on the Book element? I believe that it
is necessary, but just want to be sure. /Roger
Received on Friday, 15 December 2000 13:59:13 UTC