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 20:21:30 UTC

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)+".


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
>
>