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

Re: Using multiple namespaces in an XML instance

From: Lukas Tan <lukas.tan@cmis.csiro.au>
Date: Thu, 20 Dec 2001 17:11:53 -0500 (EST)
Message-ID: <001201c1899b$f8144a20$c8595398@VOYAGERBT>
To: "Jeni Tennison" <jeni@jenitennison.com>
Cc: "Lukas Tan" <lukas.tan@csiro.au>, <xmlschema-dev@w3.org>
Jeni:

Brilliant! That worked wonderfully, thanks. The fact remains that I really
should have known better, but for that I blame the silly season.

Lukas

> Hi Lukas,
>
> > XML Schemas version 2: Explicit references
> > ========================================[stuff.xsd]
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >
> >  <xsd:import namespace="http://www.stuff.com/fruit"
> > schemaLocation="fruit.xsd"/>
> >
> >  <xsd:element name="stuff" type="stuff-type"/>
> >
> >  <xsd:complexType name="stuff-type">
> >   <xsd:sequence>
> >    <xsd:element name="count" type="xsd:nonNegativeInteger"/>
> >    <xsd:element ref="fruit:apple" minOccurs="1" maxOccurs="1"/>
> >    <xsd:element ref="fruit:orange" minOccurs="1" maxOccurs="1"/>
> >    <xsd:element ref="fruit:other" minOccurs="1" maxOccurs="1"/>
> >   </xsd:sequence>
> >  </xsd:complexType>
> >
> > </xsd:schema>
>
> I think that this might be the source of your problem. You haven't
> included namespace declarations for the fruit namespace, so when the
> schema validator sees ref="fruit:apple" and tries to work out what
> 'fruit' might mean, it hasn't a clue.
>
> Try adding a namespace declaration that associates the prefix 'fruit'
> with the namespace 'http://www.stuff.com/fruit':
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             xmlns:fruit="http://www.stuff.com/fruit">
> ...
> </xsd:schema>
Received on Friday, 21 December 2001 04:59:08 GMT

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