|
[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: Document is invalid: no grammar found.
Title: RE: Document is invalid: no grammar found.
Well you have missed the isbn attribute out of the <book> element
The value of <title> is too long due to whitespace and you are only allowed a single <character> element according to the schema.
-----Original Message-----
From: learning xml [mailto:learning_xml@h...]
Sent: 09 March 2004 15:54
To: pfuhlman@D...
Cc: xml-dev@l...
Subject: RE: Document is invalid: 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
-----------------------------------------------------------------
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>
************************************************************************
DISCLAIMER
The information contained in this e-mail is confidential and is intended
for the recipient only.
If you have received it in error, please notify us immediately by reply
e-mail and then delete it from your system. Please do not copy it or
use it for any other purposes, or disclose the content of the e-mail
to any other person or store or copy the information in any medium.
The views contained in this e-mail are those of the author and not
necessarily those of Admenta UK Group.
************************************************************************
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
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.
|
|