XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
key and keyref problems

Hi all,
I am trying to use key and refkey elements in a XML Schema.

The XML instances look like:

<travelAgency>
       <countries>
               <country name = "Brasil" code ="BR">
               <country name = "United States of America" code ="USA">
               <country name = "Norway" code ="NO">
       </countires>
       <travel>
               <country code = "NO">
               <country code = "BRAS">
       <travel>
</TravelAgency>

And the XML Schema is (omitting noise with "..."):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name = "travelAgency" ...>
       <xs:complexType>
               ...
       </xs:complexType>

       <xs:key name="countryID">
               <xs:selector xpath="./countries/country"/>
               <xs:field xpath="@code"/>
       </xs:key>

       <xs:keyref name="countryIDRef" refer="countryID">
               <xs:selector xpath="./travel/country"/>
               <xs:field xpath="@code"/>
       </xs:keyref>
</xs:element>

The problem is that even wrong XML instances (like the one written
above with BRAS code) are found right by the validator. I have
unsuccessfully tried to change the xpath but I did not succeed.
Searching for inet I found that the namespaces should be added in
xpath declaration but I do not know how to do it, and if it is
necessary in my case.


Thanks in advance,

Pau


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS