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 Costello <co...@mitre.org> on 2000/06/24 17:55:04 UTC

Xerces 1.1.2: No Liftoff

Hi Folks,

The below schema validated just fine using xerces-1_1_1, but produced
tons of errors with xerces-1_1_2.  

Hmm, interesting.  I just ran xerces-1_1_2 on an instance document which
conforms to the below schema and it validated just fine.  It appears
that validating the schema against structures.dtd fails, but validating
an instance document against the schema succeeds.  

Here is a snippet of the error messages.  The schema follows.  /Roger

http://www.w3.org/1999/XMLSchema grammar not found
[Error] BookCatalogue1.xsd:13:31: The content of element type
"annotation" must match "(appinfo|documentation)*".
[Error] BookCatalogue1.xsd:15:25: The content of element type "sequence"
must match "(annotation?,(element|group|choice|sequence|any)*)"

As you can see below my schema is fine.  The above error messages are
incorrect. 

<?xml version="1.0"?>
<!DOCTYPE schema SYSTEM "structures.dtd"[
<!ATTLIST schema xmlns:cat CDATA #FIXED
"http://www.publishing.org/namespaces/BookCatalogue">
]>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
     
targetNamespace="http://www.publishing.org/namespaces/BookCatalogue"
      xmlns:cat="http://www.publishing.org/namespaces/BookCatalogue">
    <element name="BookCatalogue">
        <complexType>
            <sequence>
                <annotation>
                    <documentation>A book catalogue contains zero or
more books</documentation>
                </annotation>
                <element ref="cat:Book" minOccurs="0"
maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
    <element name="Book">
        <complexType>
            <sequence>
                <element ref="cat:Title" minOccurs="1" maxOccurs="1"/>
                <element ref="cat:Author" minOccurs="1" maxOccurs="1"/>
                <element ref="cat:Date" minOccurs="1" maxOccurs="1"/>
                <element ref="cat:ISBN" minOccurs="1" maxOccurs="1"/>
                <element ref="cat:Publisher" minOccurs="1"
maxOccurs="1"/>
            </sequence>
        </complexType>
    </element>
    <element name="Title" type="string"/>
    <element name="Author" type="string"/>
    <element name="Date" type="string"/>
    <element name="ISBN" type="string"/>
    <element name="Publisher" type="string"/>
</schema>


Re: Xerces 1.1.2 bug: elementFormDefault="qualified" not working

Posted by Eric Ye <er...@locus.apache.org>.
You sample schema has a targetNamespace declared, but you didn't delare
another namespace for it, the only namespace binding is from prefix "" to
http://www.w3.org/1999/XMLSchema", which is not where you wanted to put you
stuff. Actually ,  named elements and types were not put in your intended
targetNameSpace.  If you want to use targetNameSpace, you need to delcare
another namespace prefix for it  WHEN you define the SCHEMA, your instance
document looks fine.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Roger Costello" <co...@mitre.org>
To: <xe...@xml.apache.org>; <co...@mitre.org>
Sent: Saturday, June 24, 2000 11:21 AM
Subject: Xerces 1.1.2 bug: elementFormDefault="qualified" not working


> It appears that there is a bug with elementFormDefault="qualified".
> When I try to validate my instance document I get a bunch of error
> messages stating that Book is not declared (Book is a local element).
>
> Here is the schema, instance document, and error message:
>
> Schema:
>
> <?xml version="1.0"?>
> <!DOCTYPE schema SYSTEM "structures.dtd">
> <schema xmlns="http://www.w3.org/1999/XMLSchema"
>
> targetNamespace="http://www.publishing.org/namespaces/BookCatalogue"
>       elementFormDefault="qualified">
>     <element name="BookCatalogue">
>         <complexType>
>              <sequence>
>                  <element name="Book" minOccurs="0"
> maxOccurs="unbounded">
>                      <complexType>
>                          <sequence>
>                              <element name="Title" type="string"
>                                       minOccurs="1" maxOccurs="1"/>
>                              <element name="Author" type="string"
>                                       minOccurs="1" maxOccurs="1"/>
>                              <element name="Date" type="string"
>                                       minOccurs="1" maxOccurs="1"/>
>                              <element name="ISBN" type="string"
>                                       minOccurs="1" maxOccurs="1"/>
>                              <element name="Publisher" type="string"
>                                       minOccurs="1" maxOccurs="1"/>
>                          </sequence>
>                      </complexType>
>                  </element>
>             </sequence>
>         </complexType>
>     </element>
> </schema>
> --------------------------------------------------------------------
> instance 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
>                         BookCatalogue2.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>
>         <Book>
>                 <Title>Illusions The Adventures of a Reluctant
>                        Messiah</Title>
>                 <Author>Richard Bach</Author>
>                 <Date>1977</Date>
>                 <ISBN>0-440-34319-4</ISBN>
>                 <Publisher>Dell Publishing Co.</Publisher>
>         </Book>
>         <Book>
>                 <Title>The First and Last Freedom</Title>
>                 <Author>J. Krishnamurti</Author>
>                 <Date>1954</Date>
>                 <ISBN>0-06-064831-7</ISBN>
>                 <Publisher>Harper &amp; Row</Publisher>
>         </Book>
> </BookCatalogue>
> ---------------------------------------------------------
> error messages:
>
> [Error] BookCatalogue.xml:7:15: Element type "Book" must be declared.
> [Error] BookCatalogue.xml:8:24: Element type "Title" must be declared.
> [Error] BookCatalogue.xml:9:25: Element type "Author" must be declared.
> [Error] BookCatalogue.xml:10:23: Element type "Date" must be declared.
> [Error] BookCatalogue.xml:11:23: Element type "ISBN" must be declared.
> [Error] BookCatalogue.xml:12:28: Element type "Publisher" must be
> declared.
> [Error] BookCatalogue.xml:14:15: Element type "Book" must be declared.
> [Error] BookCatalogue.xml:15:24: Element type "Title" must be declared.
> [Error] BookCatalogue.xml:16:25: Element type "Author" must be declared.
> [Error] BookCatalogue.xml:17:23: Element type "Date" must be declared.
> [Error] BookCatalogue.xml:18:23: Element type "ISBN" must be declared.
> [Error] BookCatalogue.xml:19:28: Element type "Publisher" must be
> declared.
> [Error] BookCatalogue.xml:21:15: Element type "Book" must be declared.
> [Error] BookCatalogue.xml:22:24: Element type "Title" must be declared.
> [Error] BookCatalogue.xml:23:25: Element type "Author" must be declared.
> [Error] BookCatalogue.xml:24:23: Element type "Date" must be declared.
> [Error] BookCatalogue.xml:25:23: Element type "ISBN" must be declared.
> [Error] BookCatalogue.xml:26:28: Element type "Publisher" must be
> declared.
> [Error] BookCatalogue.xml:28:18: The content of element type
> "BookCatalogue" mus
> t match "(Book)+".
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>


Xerces 1.1.2 bug: elementFormDefault="qualified" not working

Posted by Roger Costello <co...@mitre.org>.
It appears that there is a bug with elementFormDefault="qualified". 
When I try to validate my instance document I get a bunch of error
messages stating that Book is not declared (Book is a local element).

Here is the schema, instance document, and error message:

Schema:

<?xml version="1.0"?>
<!DOCTYPE schema SYSTEM "structures.dtd">
<schema xmlns="http://www.w3.org/1999/XMLSchema"
     
targetNamespace="http://www.publishing.org/namespaces/BookCatalogue"
      elementFormDefault="qualified">
    <element name="BookCatalogue">
        <complexType>
             <sequence>
                 <element name="Book" minOccurs="0"
maxOccurs="unbounded">
                     <complexType>
                         <sequence>
                             <element name="Title" type="string"
                                      minOccurs="1" maxOccurs="1"/>
                             <element name="Author" type="string"
                                      minOccurs="1" maxOccurs="1"/>
                             <element name="Date" type="string"
                                      minOccurs="1" maxOccurs="1"/>
                             <element name="ISBN" type="string" 
                                      minOccurs="1" maxOccurs="1"/>
                             <element name="Publisher" type="string" 
                                      minOccurs="1" maxOccurs="1"/>
                         </sequence>
                     </complexType>
                 </element>
            </sequence>
        </complexType>
    </element>
</schema>
--------------------------------------------------------------------
instance 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
                        BookCatalogue2.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>
        <Book>
                <Title>Illusions The Adventures of a Reluctant
                       Messiah</Title>
                <Author>Richard Bach</Author>
                <Date>1977</Date>
                <ISBN>0-440-34319-4</ISBN>
                <Publisher>Dell Publishing Co.</Publisher>
        </Book>
        <Book>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Date>1954</Date>
                <ISBN>0-06-064831-7</ISBN>
                <Publisher>Harper &amp; Row</Publisher>
        </Book>
</BookCatalogue>
---------------------------------------------------------
error messages:

[Error] BookCatalogue.xml:7:15: Element type "Book" must be declared.
[Error] BookCatalogue.xml:8:24: Element type "Title" must be declared.
[Error] BookCatalogue.xml:9:25: Element type "Author" must be declared.
[Error] BookCatalogue.xml:10:23: Element type "Date" must be declared.
[Error] BookCatalogue.xml:11:23: Element type "ISBN" must be declared.
[Error] BookCatalogue.xml:12:28: Element type "Publisher" must be
declared.
[Error] BookCatalogue.xml:14:15: Element type "Book" must be declared.
[Error] BookCatalogue.xml:15:24: Element type "Title" must be declared.
[Error] BookCatalogue.xml:16:25: Element type "Author" must be declared.
[Error] BookCatalogue.xml:17:23: Element type "Date" must be declared.
[Error] BookCatalogue.xml:18:23: Element type "ISBN" must be declared.
[Error] BookCatalogue.xml:19:28: Element type "Publisher" must be
declared.
[Error] BookCatalogue.xml:21:15: Element type "Book" must be declared.
[Error] BookCatalogue.xml:22:24: Element type "Title" must be declared.
[Error] BookCatalogue.xml:23:25: Element type "Author" must be declared.
[Error] BookCatalogue.xml:24:23: Element type "Date" must be declared.
[Error] BookCatalogue.xml:25:23: Element type "ISBN" must be declared.
[Error] BookCatalogue.xml:26:28: Element type "Publisher" must be
declared.
[Error] BookCatalogue.xml:28:18: The content of element type
"BookCatalogue" mus
t match "(Book)+".