Hi all,

I posted this message on xerces-j-user a week ago, but got no answer: if
anyone can provide any help, it would much valuable.

I'm using Xerces 1.4.3, and I'm having a problem validating an XML document
wrt its XML Schema.

The XML Schema defines two complexTypes: the first (Item) has some elements
in an xs:all group, and the second (Book) extends the previous adding
another xs:all group. Here is the schema (catalog.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" attributeFormDefault="unqualified">
        <xs:element name="Item" type="Item"/>
        <xs:complexType name="Item">
                <xs:all>
                        <xs:element name="Description" type="xs:string"/>
                        <xs:element name="ItemIdentifier" type="xs:string"/>
                </xs:all>
        </xs:complexType>
        <xs:element name="Book" type="Book"/>
        <xs:complexType name="Book">
                <xs:complexContent>
                        <xs:extension base="Item">
                                <xs:all>
                                        <xs:element name="Title"
type="xs:string"/>
                                        <xs:element name="Author"
type="xs:string"/>
                                        <xs:element name="Publisher"
type="xs:string"/>
                                </xs:all>
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>
</xs:schema>

I tested this schema with W3C XSV (http://www.w3.org/2001/03/webdata/xsv)
and no error are found.

The problem is that Xerces gives errors while parsing this schema. I created
the following xml file (book.xml), based on the previous schema:

<?xml version="1.0" encoding="UTF-8"?>
<Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="catalog.xsd">
        <Description>this is very interesting</Description>
        <ItemIdentifier>B0001</ItemIdentifier>
        <Title>my favourite book</Title>
        <Author>the author of my favourite book</Author>
        <Publisher>whatever</Publisher>
</Book>

I used the default DOMCount example, and if I try

java dom.DOMCount -v book.xml

I get the following error:

[Error] book.xml:3:126: Schema error: ComplexType 'Book':
cos-all-limited.1.2: An "all" model group that is part of a complex type
definition must constitute the entire {content type} of the definition..
book.xml: 771 ms (6 elems, 2 attrs, 0 spaces, 96 chars)

Am I trying to do something illegal, or is this an implementation issue with
Xerces? Does anyone have any suggestion?

Thanks in Advance.
Marco Sbodio

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to