Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML-Schema keyref & namespaces ??!

From: Kasimier Buchcik <K.Buchcik@---------.-->
To: ezarakan@---.--
Date: 11/11/2005 1:51:00 PM
Hi,

On Fri, 2005-11-11 at 11:47 +0100, ezarakan@h... wrote:
> hallo everyone
> 
> my knowledge of xml is advanced, but not concerning namespaces.
> 
> 
> i've got the following error when validating the xml instance document ag=
ainst its schema.
> 
> i think it's got to do with the namespaces...

I think it's probably related to the simple type of the attribute
"linkIDRef", which defaults to xs:anySimpleType. If I recall correctly,
then comparison of values of xs:anySimpleType with other simple type
values was left to be implementation-defined. So xmlSpy's schema
processor might produce negative results for such a comparison.
It doesn't work either with XSV 2.10-1, Xerces-J 2.7.1,
MSXML 4.0 SP2 and Libxml2; only Saxon seems to find a match for "L4".

Try to set the type of the attribute decalaration "linkIDRef" to
xs:string.

By the way, XSV 2.10-1 reports errors like:

<invalid 
  char="9" code="cvc-identity-constraint.2.2.3" line="17"
  resource="file:///p:/libxml2-lab/tests/2005-11-11/keyref.xml">
duplicate key L1 for
{http://plirosost.ethz.ch/Ontology/Schema}LinkIDKey,
first appearance was in unnamed entity at line 17 char 9 of
file:///p:/libxml2-lab/tests/2005-11-11/keyref.xml
</invalid>

This looks like the union in the XPath expression
".//ont:Link | .//ont:Link" is confusing XSV's
IDC resolution mechanism.

Regards,

Kasimier



> thank you for your time and effort
> greetings elly
> 
> 
> ps: im using altova xmlSpy, enterprise edition 2005 rel. 3
> 
> 
> <!-- ERROR of xml instance document *************************************=
*** -->
> 
> 
> line: 50
> This file is not valid: the value 'L4' matched by the <keyref> identity c=
onstraint
> 'ont:KeyIDRefLink' was not matched by the referenced key 'ont:LinkIDKey' =
within
> the scope of element 'ont:NewDataSet'.
> 
> 
> line: 55
> This file is not valid: the value 'L5' matched by the <keyref> identity c=
onstraint
> 'ont:KeyIDRefLink' was not matched by the referenced key 'ont:LinkIDKey' =
within
> the scope of element 'ont:NewDataSet'.
> 
> 
> <!-- Schema **************************************** -->
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema
>     targetNamespace="http://plirosost.ethz.ch/Ontology/Schema"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     xmlns:ont="http://plirosost.ethz.ch/Ontology/Schema"
>     elementFormDefault="qualified"
>     attributeFormDefault="qualified">
>     <!--  -->
> 
>   
>    <xs:element name="Link">
>        <xs:complexType>
>            <xs:simpleContent>
>                <xs:extension base="xs:string">
>                    <xs:attribute name="linkIDKey" type="xs:string" us=
e="required"/>
>                </xs:extension>
>            </xs:simpleContent>
>        </xs:complexType>
>    </xs:element>
>       
>     
>   <!--  -->
>   <xs:element name="NewDataSet">
>     <xs:complexType>
>       <xs:choice maxOccurs="unbounded">
>         <!--  -->
>           <xs:element name="Customers">
>             <xs:complexType>
>               <xs:sequence>
>                 <xs:element name="CustomerID">
>                   <xs:simpleType>
>                     <xs:restriction base="xs:string">
>                       <xs:pattern value="c\d+"/>
>                     </xs:restriction>
>                   </xs:simpleType>
>                 </xs:element>
>                 <xs:element name="CompanyName" type="xs:string"/>
>                 <xs:element name="ContactName" type="xs:string" minOc=
curs="0"/>
>                 <xs:element name="ContactTitle" type="xs:string" minO=
ccurs="0"/>
>                 <xs:element name="Address" type="xs:string" minOccurs=
="0"/>
>                 <xs:element name="City" type="xs:string" minOccurs==
"0"/>
>                 <xs:element name="Region" type="xs:string" minOccurs=
="0"/>
>                 <xs:element name="PostalCode" type="xs:string" minOcc=
urs="0"/>
>                  <xs:element ref="ont:Link"/>
>                  <xs:element name="Label" type="xs:string"/>
>               </xs:sequence>
>             </xs:complexType>
>           </xs:element>
>                 <!--  -->
>         <xs:element name="Orders">
>             <xs:complexType>
>                 <xs:sequence>
>                     <xs:element name="OrderID">
>                         <xs:simpleType>
>                             <xs:restriction base="xs:string">
>                                 <xs:pattern value="o\d+"/>
>                             </xs:restriction>
>                         </xs:simpleType>
>                     </xs:element>
>                     <xs:element name="CustomerID" type="xs:string"/>
>                     <xs:element name="OrderDate" type="xs:string" min=
Occurs="0"/>
>                     <xs:element ref="ont:Link"/>
>                 </xs:sequence>
>                 <xs:attribute name="label" type="xs:string"/>
>             </xs:complexType>
>         </xs:element>
>         <!--  -->
>         <xs:element name="Blabla">
>             <xs:complexType>
>                 <xs:sequence>
>                     <xs:element name="orderLink" type="xs:string"/>
>                 </xs:sequence>
>                 <xs:attribute name="linkIDRef" use="required"/>
>             </xs:complexType>
>         </xs:element>
>                 <!--  -->
>             </xs:choice>
>         </xs:complexType>
>       
>       <!--  -->
>       <xs:unique name="UniqueLinkID">
>           <xs:selector xpath=".//ont:Link | .//ont:Link"/>
>           <xs:field xpath="@ont:linkIDKey"/>
>       </xs:unique>
>     
>       <xs:key name="LinkIDKey">
>           <xs:selector xpath=".//ont:Link | .//ont:Link"/>
>           <xs:field xpath="@ont:linkIDKey"/>
>       </xs:key>
>       <xs:keyref name="KeyIDRefLink" refer="ont:LinkIDKey">
>           <xs:selector xpath=".//ont:Blabla"/>
>           <xs:field xpath="@ont:linkIDRef"/>
>       </xs:keyref>
>       <!--  -->
>     
>     </xs:element>
> </xs:schema>
> 
> 
> <!-- xml-instance **************************************** -->
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <ont:NewDataSet xmlns="http://plirosost.ethz.ch/Ontology/Schema"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:ont="http://plirosost.ethz.ch/Ontology/Schema"
>     xsi:schemaLocation="http://plirosost.ethz.ch/Ontology/Schema
> 
> file:/D:/SA1_OntologyBuilder/XML/meineBsp/customer3_Namespace.xsd">
>   
>     <Customers>
>         <CustomerID>c666</CustomerID>
>         <CompanyName>HSR</CompanyName>
>         <ContactName>Elly</ContactName>
>         <ContactTitle>Frau</ContactTitle>
>         <Address>blabla</Address>
>         <City>Z=FCrich</City>
>         <Region>CH</Region>
>         <PostalCode>8041</PostalCode>
>         <Link ont:linkIDKey="L1"></Link>
>         <Label>label1</Label>
>     </Customers>
>   
>     <Customers>
>         <CustomerID>c333</CustomerID>
>         <CompanyName>Herisau</CompanyName>
>         <ContactName>Claudio</ContactName>
>         <ContactTitle>Frau</ContactTitle>
>         <Address>blabla</Address>
>         <City>Z=FCrich</City>
>         <Region>CH</Region>
>         <PostalCode>7777</PostalCode>
>         <Link ont:linkIDKey="L2">aa</Link>
>         <Label>label2</Label>
>     </Customers>
>       
>     <Orders ont:label="label1">
>         <OrderID>o333</OrderID>
>         <CustomerID>c666</CustomerID>
>         <OrderDate>23.07.77</OrderDate>
>         <Link  ont:linkIDKey="L3">b</Link>
>     </Orders>
>   
>     <Orders ont:label="label1">
>         <OrderID>o777</OrderID>
>         <CustomerID>c666</CustomerID>
>         <OrderDate>23.07.77</OrderDate>
>         <Link ont:linkIDKey="L4">bb</Link>
>     </Orders>
>   
> 
> 
>     <Blabla ont:linkIDRef="L4">      <!-- ***line50*** l4sollte keinen =
error geben, tut es aber !!!!! -->
>         <orderLink>bb</orderLink>
>     </Blabla>
>   
>   
>     <Blabla ont:linkIDRef="L5">      <!-- ***line55 ***TODO l5 sollte e=
rror geben, tut aber nicht !!!!! ev.
> 
> folgefehler von oben!-->
>         <orderLink>bb</orderLink>
>     </Blabla>
>      
> </ont:NewDataSet> 
> 
>  
> 
> 

From ezarakan@h... Fri Nov 11 11:55:36 2005
Received: from wiggum.w3.org ([12


transparent
Print
Mail
Digg
delicious
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