W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2000

Re: Importing schemas

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 11 Sep 2000 14:22:47 +0100
To: David Vázquez Guerrero <d_vazquez_g@yahoo.com>
Cc: XML Schema <xmlschema-dev@w3.org>
Message-ID: <f5bzolfysew.fsf@cogsci.ed.ac.uk>
David Vázquez Guerrero <d_vazquez_g@yahoo.com> writes:

> I have a schema common.xsd for common element types
> used by my other schemas and I'm using the import
> element in order to access those types.
> 
> I'm not sure about how to use the import element. I
> validated (with XSV) an XML instance using a schema
> that in turn uses the common.xsd schema and there were
> no errors. 

There were errors, just not as obvious as they should be -- because of 
naming errors in your files, no schema was found and no strict
validation was done.

> However, when I include non-valid data in the XML
> instance, XSV still says there are no errors. How can
> I make sure my schemas are correct?
> 
> I attached the code of the documents I used at the end
> of this message.
> 
> 
> Many thanks,
> 
> David
> 
> <!-- common.xsd -->
> <snip/>

That one was fine

> <!-- loop.xsd -->
> <?xml version="1.0"?>
> <schema xmlns="http://www.w3.org/1999/XMLSchema" 
>    xmlns:loop="someURL/loop" 
>    targetNamespace="someURL/loop" 
>    xmlns:cmn="someURL/common">
> 
>    <import namespace="someURL/common"
> schemaLocation="common.txt"/>

Oops -- should be common.xsd

> <snip/>

Rest was fine.

> 
> <!-- loop.xml -->
> <?xml version="1.0"?>
> <loop
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
>       xsi:noNamespaceSchemaLocation="loop.txt" 
>       number="1">

Oops:
 1) should be loop.xsd
 2) you can't suddenly decide you want to use a schema for namespace
    'someURL/loop' to validate a document in no namespace.  Change
    this to what follows and it all works just fine with XSV [1]

    <!-- loop.xml -->
    <?xml version="1.0"?>
    <l:loop
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
          xsi:schemaLocation="someURL/loop loop.xsd"
          xmlns:l="someURL/loop"
          number="1">
       <P>22.5</P>
       <S ref="505,7">1</S>
       <F ref="32">4</F>
       <K ref="something">AA</K>
    </l:loop>

Hope this helps,

ht

[1] http://www.w3.org/2000/06/webdata/xsv
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Monday, 11 September 2000 09:22:55 GMT

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