W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2005

RE: Importing other schema's into the main schema defintion

From: Michael Kay <mike@saxonica.com>
Date: Tue, 30 Aug 2005 09:48:52 +0100
To: "'Kevin L. Cobb'" <kevin.cobb@emergint.com>, <xmlschema-dev@w3.org>
Message-ID: <E1EA1ni-00008C-2f@maggie.w3.org>
I think the problem is with the way you are invoking your schema validator,
and not with the content of your schema.
 
When I run the following:
 
java com.saxonica.Validate -t book.xml books.xsd
 
the output is:
 
Saxon-SA 8.5.1 from Saxonica
Java version 1.5.0
Loading schema document file:/c:/temp/books.xsd
Loading schema document file:/c:/temp/Money.xsd
Finished loading schema document file:/c:/temp/Money.xsd
Finished loading schema document file:/c:/temp/books.xsd
Schema checking successful. Time: 2553 milliseconds
Processing file:/c:/temp/book.xml
Execution time: 351 milliseconds
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Kevin L. Cobb
Sent: 29 August 2005 16:39
To: xmlschema-dev@w3.org
Subject: Importing other schema's into the main schema defintion



I am new to the list and pretty new to schema definitions, although I work
with XML and XSLT a lot.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am trying to define multiple schema's that reference each other and am
running into some problems. When I try and validate my Source XML with the
Source Schema (books.xsd), I get the error: "Cannot find the declaration of
element 'book'." Based on what I know, the schema definitions and the import
is correct but, obviously, there is a problem. Can someone provide some
direction. 

Source XML:

<book xmlns=" <BLOCKED::http://books/> http://books/" xmlns:money="
<BLOCKED::http://money/> http://money/">
   <author>Charles Dickens</author>
   <title>Oliver Twist</title>
   <money:gbp>20</money:gbp>
   <money:dollar>40</money:dollar>
</book>

Source XSD (books.xsd):

<xs:schema
   targetNamespace="http://books/ <BLOCKED::http://books/> "
   xmlns="http://books/ <BLOCKED::http://books/> "
   xmlns:xs="http://www.w3.org/2001/XMLSchema
<BLOCKED::http://www.w3.org/2001/XMLSchema> "
   xmlns:money="http://money/ <BLOCKED::http://money/> "
   elementFormDefault="qualified"
   attributeFormDefault="unqualified">

   <xs:import namespace="http://money/ <BLOCKED::http://money/> "
schemaLocation="Money.xsd"/>

   <xs:element name="book">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="author" type="xs:string"/>
            <xs:element name="title" type="xs:string"/>
            <xs:element ref="money:gbp"/>
            <xs:element ref="money:dollar"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

 

Imported Schema Number 2 (money.xsd):

<xs:schema
   xmlns="http://money/ <BLOCKED::http://money/> "
   targetNamespace="http://money/ <BLOCKED::http://money/> "
   xmlns:xs="http://www.w3.org/2001/XMLSchema
<BLOCKED::http://www.w3.org/2001/XMLSchema> ">
   
   <xs:element name="gbp" type="xs:integer" />
   <xs:element name="dollar" type="xs:integer" />
</xs:schema>

 

 
Received on Tuesday, 30 August 2005 08:49:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:50 GMT