XML Schema Question: understanding equivClass and abstract

Roger L. Costello costello at mitre.org
Thu Dec 30 13:31:40 GMT 1999

Hi Folks,

I am not sure that I understand equivClass types and abstract elements. 
If I may, I will describe my understanding, and then you can tell me
where I am mistaken.  As a point of discussion, consider this XML

<?xml version="1.0"?>
<!DOCTYPE schema SYSTEM "xml-schema.dtd"[
<!ATTLIST schema xmlns:cat CDATA #IMPLIED>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
    <type name="Publication">
        <element name="Title" type="string" maxOccurs="*"/>
        <element name="Author" type="string" maxOccurs="*"/>
        <element name="Date" type="date"/>
    <element name="Publication" type="cat:Publication" 
    <element name="Book" equivClass="cat:Publication">
        <type source="cat:Publication" derivedBy="extension">
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
    <element name="Magazine" equivClass="cat:Publication">
        <type source="cat:Publication" derivedBy="restriction">
            <element name="Author" type="string" maxOccurs="0"/>
    <element name="Catalogue">
            <element ref="cat:Publication" minOccurs="0" maxOccurs="*"/>

I have defined a Publication type and a Publication element which is of
type Publication.  The Publication element I declared to be abstract by
setting the abstract attribute equal to 'true'.  I then defined a Book
and Magazine element and made them equivalence classes of the
Publication type.  Lastly, I defined a Catalogue element.  It contains
zero or more Publication elements.

My understanding is that by making the Publication element abstract then
whereever it is used (as it is in the Catalogue element) in the XML
instance document it must be replaced by an equivalent element.  What I
mean by this is best explained by showing an XML instance document:

<?xml version="1.0"?>
<Catalogue xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
                <Title>Natural Health</Title>
                <Date>December, 1999</Date>
                <Title>Illusions The Adventures of a Reluctant
                <Author>Richard Bach</Author>
                <Publisher>Dell Publishing Co.</Publisher>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Publisher>Harper &amp; Row</Publisher>

Notice how the Catalogue element contains Magazine and Book elements. 
The abstract Publication element that was defined to be the content of
Catalogue has been replaced by elements that are of an equivalent class
with Publication.  The Magazine and Book elements were declared to be of
an equivalent class, thus they can be used as the replacements for the
abstract Publication element.

Is this a correct understanding of abstract elements and of equivClass
types?  /Roger

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list