[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Document is invalid: no grammar found.


xerces no grammar found
Hi,

xerces version is xerces-2_2_1.

book.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="/tmp/example/xml_1/book.xsd">
      <title>
      Being a Dog Is a Full-Time Job
      </title>
      <author>Charles M. Schulz</author>
      <character>
      <name>Snoopy</name>
      <friend-of>Peppermint Patty</friend-of>
      <since>1950-10-04</since>
      <qualification>
      extroverted beagle
      </qualification>
      </character>
      <character>
      <name>Peppermint Patty</name>
      <since>1966-08-22</since>
      <qualification>bold, brash and tomboyish</qualification>
      </character>
      </book>

book.xsd file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- definition of simple types -->
  <xs:simpleType name="nameType">
    <xs:restriction base="xs:string">
      <xs:maxLength value="32"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="sinceType">
    <xs:restriction base="xs:date"/>
  </xs:simpleType>
  <xs:simpleType name="descType">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  <xs:simpleType name="isbnType">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{10}"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- definition of complex types -->
  <xs:complexType name="characterType">
    <xs:sequence>
      <xs:element name="name" type="nameType"/>
      <xs:element name="friend-of" type="nameType" minOccurs="0"
               maxOccurs="unbounded"/>
      <xs:element name="since" type="sinceType"/>
<xs:element name="qualification" type="descType"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="bookType">
    <xs:sequence>
      <xs:element name="title" type="nameType"/>
      <xs:element name="author" type="nameType"/>
      <xs:element name="character" type="characterType" minOccurs="0"/>
      <!-- the definition of the "character" element is
        using the "characterType" complex type    -->
    </xs:sequence>
    <xs:attribute name="isbn" type="isbnType" use="required"/>
  </xs:complexType>
  <!-- Reference to "bookType" to define the
     "book" element -->
  <xs:element name="book" type="bookType"/>
</xs:schema>


>Just guessing, but you might try reorganizing your xml so the data starts 
>*after* the schema declaration, and just to be safe, use a fully qualified 
>path to "book.xsd":
>
><?xml version="1.0" encoding="UTF-8"?>
><book
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   
>xsi:noNamespaceSchemaLocation="//mycomputer/usr/wenpeng/schemas/book.xsd"
>   isbn="0836217462">
>
>Good luck ;-)
>
>Phil F.
>
>-----Original Message-----
>From: learning xml [mailto:learning_xml@h...]
>Sent: Tuesday, March 09, 2004 8:27 AM
>To: xml-dev@l...
>Subject:  Document is invalid: no grammar found.
>
>
>Hi, Everyone:
>I complied a XML instance : book xml and a schema book.xsd.
>
>In the begining of book.xml, it is like the following:
><?xml version="1.0" encoding="UTF-8"?>
><book isbn="0836217462"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:noNamespaceSchemaLocation="file:book.xsd">
>
>when I run parser with xerces, it always gives error message:
>
>Document is invalid: no grammar found.
>What is wrong?
>
>Thanks in advance!
>Wenpeng
>
>_________________________________________________________________
>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
>http://join.msn.com/?page=features/virus
>
>
>-----------------------------------------------------------------
>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
>initiative of OASIS <http://www.oasis-open.org>
>
>The list archives are at http://lists.xml.org/archives/xml-dev/
>
>To subscribe or unsubscribe from this list use the subscription
>manager: <http://www.oasis-open.org/mlmanage/index.php>
>

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.