[
Lists Home |
Date Index |
Thread Index
]
Hello,
I am using <key> and <keyref> in my XML Schema.
When I declare the <key> element globally ('AdminUnitKey_Global'), the key's
are set appropriatly.
When I want to declare the <key> element locally ('AdminUnitKey_Local'; by
using the expression <selector xpath="."/ under the <AdminUnit> element) the
key is not set and the schema does not validate because the <keyref> fails to
refer to some key.
I thought that xpath="." refers to the current element where the xpath
expression is set? Why doesn't that work with <key>?
Thanks, Markus
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.opentourism.org"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:utour="http://www.opentourism.org"
elementFormDefault="unqualified">
<element name="Country">
<complexType>
<sequence>
<element name="CountryID" type="string"/>
<element name="AdminUnit" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="AdminUnitName" type="string"/>
<element name="SubAdminUnits" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="SubAdminUnitName" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<!--
<key name="AdminUnitKey_Local">
<selector xpath="."/>
<field xpath="AdminUnitName"/>
</key>
<keyref name="AdminUnitRef_Local" refer="utour:AdminUnitKey_Local">
<selector xpath="SubAdminUnits"/>
<field xpath="SubAdminUnitName"/>
</keyref>
-->
</element>
</sequence>
</complexType>
<key name="AdminUnitKey_Global">
<selector xpath="AdminUnit"/>
<field xpath="AdminUnitName"/>
</key>
<keyref name="AdminUnitRef_Global" refer="utour:AdminUnitKey_Global">
<selector xpath="AdminUnit/SubAdminUnits"/>
<field xpath="SubAdminUnitName"/>
</keyref>
</element>
</schema>
--
Markus Seibold
------------------------------
Krebsgasse 6
D-93047 Regensburg
Germany
------------------------------
Email: markus.seibold@gmx.net
Phone: +49 (941) 504 1009
Mobile: +49 (171) 212 6869
FAX: +49 (89) 1488 210457
|