You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Roger L. Costello" <co...@mitre.org> on 2000/06/19 12:23:44 UTC

Incorrect handling of schema derived types in xerces1.1.1

Hi Folks,

I found an interesting bug in how xerces1.1.1 handles derived by
extension.  

In my schema I have a Book type that extends a Publication type:

    <complexType name="Publication">
        <sequence>
            <element name="Title" type="string" maxOccurs="unbounded"/>
            <element name="Author" type="string" maxOccurs="unbounded"/>
            <element name="Date" type="year"/>
        </sequence>
    </complexType>
    <complexType name="Book" base="cat:Publication"
                 derivedBy="extension">
        <sequence>
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
        </sequence>
    </complexType>

Then I create a BookCatalogue that is comprised of zero or more
Book type elements:

    <element name="BookCatalogue">
        <complexType>
            <sequence>
                <element name="Book" maxOccurs="unbounded"
                        type="cat:Book"/>
            </sequence>
        </complexType>
    </element>

Here's a snippet of my XML document:

<?xml version="1.0"?>
<BookCatalogue
xmlns="http://www.publishing.org/namespaces/BookCatalogue"
               xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
               xsi:schemaLocation=
                      
"http://www.publishing.org/namespaces/BookCatalogue
                        BookCatalogue5.xsd">
        <Book>
                <Title>My Life and Times</Title>
                <Author>Paul McCartney</Author>
                <Date>1998</Date>
                <ISBN>94303-12021-43892</ISBN>
                <Publisher>McMillin Publishing</Publisher>
        </Book>

As you can see, I the content of <Book> is as specified by the schema. 
However, when I validate this XML document with xerces1.1.1 I get an
error message:

[Error] BookCatalogue.xml:13:17: The content of element type "Book" must
match "(Title+,Author+,Date,(ISBN,Publisher))".

Note the parentheses around (ISBN,Publisher).  The error message
seems to be suggesting that in my XML document the ISBN and Publisher
elements be grouped (somehow).  Any thoughts/comments?  /Roger


RE: Incorrect handling of schema derived types in xerces1.1.1

Posted by Jean-Louis Vila <jl...@cosmosbay.com>.
Hi Roger,

I guess that you wrote in your schema file:
   ...
   xmlns:cat="http://www.publishing.org/namespaces/BookCatalogue"
   targetNamespace="http://www.publishing.org/namespaces/BookCatalogue" 
   ...
We found the same problem when we're using namespace ...

I send my files and I'm waiting for the next release !!!

Regards,
Jean-Louis Vila

-----Message d'origine-----
De : Roger L. Costello [mailto:costello@mitre.org]
Envoye : lundi 19 juin 2000 12:24
A : xerces-j-dev@xml.apache.org
Objet : Incorrect handling of schema derived types in xerces1.1.1


Hi Folks,

I found an interesting bug in how xerces1.1.1 handles derived by
extension.  

In my schema I have a Book type that extends a Publication type:

    <complexType name="Publication">
        <sequence>
            <element name="Title" type="string" maxOccurs="unbounded"/>
            <element name="Author" type="string" maxOccurs="unbounded"/>
            <element name="Date" type="year"/>
        </sequence>
    </complexType>
    <complexType name="Book" base="cat:Publication"
                 derivedBy="extension">
        <sequence>
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
        </sequence>
    </complexType>

Then I create a BookCatalogue that is comprised of zero or more
Book type elements:

    <element name="BookCatalogue">
        <complexType>
            <sequence>
                <element name="Book" maxOccurs="unbounded"
                        type="cat:Book"/>
            </sequence>
        </complexType>
    </element>

Here's a snippet of my XML document:

<?xml version="1.0"?>
<BookCatalogue
xmlns="http://www.publishing.org/namespaces/BookCatalogue"
               xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
               xsi:schemaLocation=
                      
"http://www.publishing.org/namespaces/BookCatalogue
                        BookCatalogue5.xsd">
        <Book>
                <Title>My Life and Times</Title>
                <Author>Paul McCartney</Author>
                <Date>1998</Date>
                <ISBN>94303-12021-43892</ISBN>
                <Publisher>McMillin Publishing</Publisher>
        </Book>

As you can see, I the content of <Book> is as specified by the schema. 
However, when I validate this XML document with xerces1.1.1 I get an
error message:

[Error] BookCatalogue.xml:13:17: The content of element type "Book" must
match "(Title+,Author+,Date,(ISBN,Publisher))".

Note the parentheses around (ISBN,Publisher).  The error message
seems to be suggesting that in my XML document the ISBN and Publisher
elements be grouped (somehow).  Any thoughts/comments?  /Roger


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org