W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2001

Re: Bug in XSV? ... reference without <import>

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 08 May 2001 08:39:19 +0100
To: "Roger L. Costello" <costello@mitre.org>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bbsp4jnmg.fsf@cogsci.ed.ac.uk>
"Roger L. Costello" <costello@mitre.org> writes:

> "Henry S. Thompson" wrote:
> > 
> > Sure there is -- just <import> the namespace, with no
> > 'schemaLocation'.  You've now issued a promise that at runtime someone
> > will supply types in that namespace (if indeed you use them), but that
> > promise won't come due _until_ runtime.  No problem.
> 
> Awesome!  So, the weather station schema would look like this:
> 
> weather-station.xsd
> ----------------------------------------------------
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>             targetNamespace="http://www.weather-station.org"
>             xmlns="http://www.weather-station.org"
>             xmlns:s="http://www.sensor.org"
>             elementFormDefault="qualified">
>     <xsd:import namespace="http://www.sensor.org"/>
>     <xsd:element name="weather-station">
>         <xsd:complexType>
>             <xsd:sequence>
>                 <xsd:element name="sensor" type="s:sensor_type" 
>                              maxOccurs="unbounded"/>
>             </xsd:sequence>
>         </xsd:complexType>
>     </xsd:element>
> </xsd:schema>
> ----------------------------------------------------
> 
> Note that the <import> element does not have a schemaLocation.  Each
> application provides its own definition of sensor_type, e.g.,
> 
> london-sensors.xsd
> ----------------------------------------------------
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>             targetNamespace="http://www.sensor.org"
>             xmlns="http://www.sensor.org"
>             elementFormDefault="qualified">
>     <xsd:simpleType name="sensor_type">
>        <xsd:restriction base="xsd:string">
>            <xsd:enumeration value="barometer"/>
>            <xsd:enumeration value="thermometer"/>
>            <xsd:enumeration value="anenometer"/>
>            <xsd:enumeration value="hygrometer"/>
>        </xsd:restriction>
>     </xsd:simpleType>
> </xsd:schema>
> 
> Instance documents will reference both schemas:
> 
> london-weather-station.xml
> ----------------------------------------------------
> <?xml version="1.0"?>
> <weather-station xmlns="http://www.weather-station.org"
>       xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
>       xsi:schemaLocation=
>                 "http://www.weather-station.org weather-station.xsd
>                  http://www.sensor.org london-sensors.xsd">
>     <sensor>thermometer</sensor>
>     <sensor>barometer</sensor>
>     <sensor>hygrometer</sensor>
>     <sensor>anenometer</sensor>
> </weather-station>
> ----------------------------------------------------
> 
> Do I now have a correct understanding? 

Yes.

ht
-- 
  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 Tuesday, 8 May 2001 03:39:22 GMT

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