www.webdeveloper.com
Results 1 to 2 of 2

Thread: Error in validation of schema

  1. #1
    Join Date
    Feb 2006
    Posts
    4

    Error in validation of schema

    Why do I get the following error when I validate my Scheme

    Results from W3C XML Schema validation:
    Validation error:
    Reason: The element 'Books' is used but not declared in the DTD/Schema.
    Error code: -1072898035

    --------------------------------------------------------------------
    My XML doc

    <?xml version ='1.0' ?>
    <!DOCTYPE Books SYSTEM "BooksDTD.dtd">
    <Books
    xmlns="http://madeupbookshop.com/books"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://madeupbookshop.com/books books.xsd">
    <Book>
    <ISBN>12345</ISBN>
    <PUBLISHER>Wrok</PUBLISHER>
    <AUTHOR>
    <FIRST_NAME>William</FIRST_NAME>
    <LAST_NAME>Blake</LAST_NAME>
    </AUTHOR>
    <TITLE>Walk in the wood</TITLE>
    <EDITION>First edition</EDITION>
    <PRICE>$99.95</PRICE>
    <PAGES>500</PAGES>
    <DATE_PUBLISHED>12 January 2004</DATE_PUBLISHED>
    <DESCRIPTION>I love trees</DESCRIPTION>
    <IMAGE>one.gif</IMAGE>
    </Book>
    <Book>
    <ISBN>12346</ISBN>
    <PUBLISHER>Wrok</PUBLISHER>
    <AUTHOR>
    <FIRST_NAME>Erric</FIRST_NAME>
    <LAST_NAME>Bird</LAST_NAME>
    </AUTHOR>
    <TITLE>eating to be large</TITLE>
    <EDITION>First edition</EDITION>
    <PRICE>$45.95</PRICE>
    <PAGES>600</PAGES>
    <DATE_PUBLISHED>16 January 2004</DATE_PUBLISHED>
    <DESCRIPTION>Be big and fat</DESCRIPTION>
    <IMAGE>two.jpg</IMAGE>
    </Book>
    <Books>

    --------------------------------------------------------------------------
    I have the following schema

    <?xml version="1.0"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:target="http://madeupbookshop.com/books"
    targetNamespace="http://madeupbookshop.com/books"
    elementFormDefault="qualified">
    <element name="Books" type="target:booksType" />
    <complexType name="AuthorType">
    <sequence>
    <element name="FIRST_NAME" type="string"/>
    <element name="LAST_NAME" type="string"/>
    </sequence>
    </complexType>
    <complexType name="bookType">
    <sequence>
    <element name="ISBN" type="string"/>
    <element name="PUBLISHER" type="string"/>
    <element name="AUTHOR" type="target:AuthorType"/>
    <element name="TITLE" type="string"/>
    <element name="EDITION" type="string"/>
    <element name="PRICE" type="string"/>
    <element name="PAGES" type="positiveInteger"/>
    <element name="DATE_PUBLISHED" type="string"/>
    <element name="DESCRIPTION" type="string"/>
    <element name="IMAGE" type="string"/>
    </sequence>
    </complexType>
    <complexType name="booksType">
    <sequence>
    <element name="Book" type="target:bookType" minOccurs="0" maxOccurs="unbounded" />
    </sequence>
    </complexType>
    </schema>

  2. #2
    Join Date
    May 2004
    Location
    FL
    Posts
    3,453
    O.k., I could be way off on this. I don't really know XML that good but doesn't the schema require a "xs:" in front, e.g.
    Code:
    <xs:element name="Books" type="target:booksType" />
    I'm just kind of taking a guess here. As I said, I could be way off.

    Also, do the other require a space before the "/>"?
    Code:
    <element name="ISBN" type="string" />
    <element name="PUBLISHER" type="string" />

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles