Re: Using multiple namespaces in an XML instance

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 UTC