Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XML-Schema keyref & namespaces ??!

From: <ezarakan@---.-->
To: <xmlschema-dev@--.--->, <public-schemata-users@--.--->
Date: 11/11/2005 12:48:00 PM




hallo everyone

my knowledge of xml is advanced, but not concerning namespaces.


i've got the following error when validating the xml instance document =
against its schema.

i think it's got to do with the namespaces...


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 =
constraint
'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 =
constraint
'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" =
use="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" =
minOccurs="0"/>
                <xs:element name="ContactTitle" type="xs:string" =
minOccurs="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" =
minOccurs="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" =
minOccurs="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 =
error geben, tut aber nicht !!!!! ev.

folgefehler von oben!-->
        <orderLink>bb</orderLink>
    </Blabla>
     
</ont:NewDataSet> 

 



From ezarakan@h... Sat Nov 12 1


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