[xml] Question about default namespace with XML Schema
- From: GUY Fabrice <fabrice guy gmail com>
- To: xml gnome org
- Subject: [xml] Question about default namespace with XML Schema
- Date: Mon, 2 May 2005 11:03:43 +0200
Hi,
I'm using this schema :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ELEMENTS">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="element" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="element2" type="xsd:string" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="key">
<xsd:selector xpath="element"/>
<xsd:field xpath="."/>
</xsd:key>
<xsd:keyref name="keref" refer="key">
<xsd:selector xpath="element2"/>
<xsd:field xpath="."/>
</xsd:keyref>
</xsd:element>
</xsd:schema>
with this xml file :
<?xml version="1.0" encoding="ISO-8859-1"?>
<ELEMENTS>
<element>test1</element>
<element>test2</element>
<element2>test2</element2>
</ELEMENTS>
And that works perferctly fine.
But when I try to use the default namespace in the schema (to avoid
using the xsd: prefix), I get this message when I validate it with
xmllint :
test.xsd:14: element keyref: Schemas parser error : keyRef 'keref':
References from this schema to components in the namespace
'http://www.w3.org/2001/XMLSchema' are not valid, since not indicated
by an import statement.
Here's my schema with the default namespace :
<?xml version="1.0" encoding="ISO-8859-1"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<element name="ELEMENTS">
<complexType>
<sequence>
<element name="element" type="string" minOccurs="0"
maxOccurs="unbounded"/>
<element name="element2" type="string" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</complexType>
<key name="key">
<selector xpath="element"/>
<field xpath="."/>
</key>
<keyref name="keref" refer="key">
<selector xpath="element2"/>
<field xpath="."/>
</keyref>
</element>
</schema>
Have I missed something (namespace declaration,...) or this is a bug ?
Fabrice
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]