Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


key and keyref problems

From: "pau carre" <pau.carre@-----.--->
To: xml-dev@-----.---.---
Date: 2/2/2007 4:12:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent