[
Lists Home |
Date Index |
Thread Index
]
The first error I get on this is that you've constrained "Type" to be
singles or doubles, but the actual value is "Those are football matches".
The next error appears to be because the values you are using for keys have
variable numbers of leading and trailing spaces. If you want these
normalized, don't use the type xs:string.
The next two errors are because your key definitions and references don't
match: your Member elements are matching the content of the Name element,
not the @id attribute, and the Team elements are matching on the @Name
attribute, not the @id attribute.
It always helps, incidentally, to say which product you are using. Then you
might get someone looking at it who is familiar with the error messages
produced by that product.
Michael Kay
# -----Original Message-----
# From: learning xml [mailto:learning_xml@hotmail.com]
# Sent: 17 March 2004 09:06
# To: xml-dev@lists.xml.org
# Subject: [xml-dev] Error: not found for identity constraint of element
#
# Hi,
# I composed sport.xml and sport.xsd files. When I parse and
# validate with DOM. There are something wrong.
# [Error] sport.xml:43:14: Key 'ref_Team' with value 'ID Value:
# FIN
# ' not found for identity constraint of element 'Tournament'.
# [Error] sport.xml:43:14: Key 'ref_Team' with value 'ID Value:
# CHN
# ' not found for identity constraint of element 'Tournament'.
# [Error] sport.xml:43:14: Key 'ref_Participant' with value 'ID Value:
# FF
# ' not found for identity constraint of element 'Tournament'.
# [Error] sport.xml:43:14: Key 'ref_Participant' with value 'ID Value:
#
# Thanks,
#
# The files are as foloows:
# sport.xml
# <?xml version="1.0" encoding="UTF-8"?>
# <Tournament xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
# xsd:noNamespaceSchemaLocation="/tmp/example/xml_1/sport.xsd">
# <Name>
# This is a description about a tourament by XML!
# </Name>
# <Type>
# Those are football matches
# </Type>
# <Date>
# 2004-07-08
# </Date>
# <Participants nbrParticipants="2">
# <Name id="1">
# FF
# </Name>
# <Name id="2">
# CC
# </Name>
# </Participants>
# <Teams nbrTeams="2">
# <Team id="x" Name="FIN">
# <Member>
# FF
# </Member>
# </Team>
# <Team id="y" Name="CHN">
# <Member>
# CC
# </Member>
# </Team>
# </Teams>
# <Matches nbrMatches="1">
# <Match id="Friendship">
# <Team>
# FIN
# </Team>
# <Team>
# CHN
# </Team>
# </Match>
# </Matches>
# </Tournament>
#
# sport.xsd
#
# <?xml version="1.0" encoding="UTF-8"?>
# <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
# <xsd:complexType name="Tournament">
# <xsd:sequence>
# <xsd:element name="Name" type="xsd:string"/>
# <xsd:element name="Type">
# <xsd:simpleType>
# <xsd:restriction base="xsd:string">
# <xsd:enumeration value="Singles"/>
# <xsd:enumeration value="Doubles"/>
# </xsd:restriction>
# </xsd:simpleType>
# </xsd:element>
# <xsd:element name="Date" type="xsd:date"/>
# <xsd:element name="Participants" type="Participants"
# minOccurs="0"/>
# <xsd:element name="Teams" type="Teams"/>
# <xsd:element name="Matches" type="Matches"/>
# </xsd:sequence>
# </xsd:complexType>
# <xsd:complexType name="Participants">
# <xsd:sequence>
# <xsd:element name="Name" minOccurs="2" maxOccurs="unbounded">
# <xsd:complexType>
# <xsd:simpleContent>
# <xsd:extension base="xsd:string">
# <xsd:attribute name="id" type="xsd:string" use="required"/>
# </xsd:extension>
# </xsd:simpleContent>
# </xsd:complexType>
# </xsd:element>
# </xsd:sequence>
# <xsd:attribute name="nbrParticipants" type="xsd:positiveInteger"
# use="required"/>
# </xsd:complexType>
# <xsd:complexType name="Teams">
# <xsd:sequence>
# <xsd:element name="Team" minOccurs="2" maxOccurs="unbounded">
# <xsd:complexType>
# <xsd:sequence>
# <xsd:element name="Member" type="xsd:string" maxOccurs="2"/>
# </xsd:sequence>
# <xsd:attribute name="id" type="xsd:string" use="required"/>
# <xsd:attribute name="Name" type="xsd:string"/>
# </xsd:complexType>
# </xsd:element>
# </xsd:sequence>
# <xsd:attribute name="nbrTeams" type="xsd:positiveInteger"
# use="required"/>
# </xsd:complexType>
# <xsd:complexType name="Matches">
# <xsd:sequence>
# <xsd:element name="Match" maxOccurs="unbounded">
# <xsd:complexType>
# <xsd:sequence>
# <xsd:element name="Team" type="xsd:string" minOccurs="2"
# maxOccurs="2"/>
# </xsd:sequence>
# <xsd:attribute name="id" type="xsd:string" use="required"/>
# </xsd:complexType>
# </xsd:element>
# </xsd:sequence>
# <xsd:attribute name="nbrMatches" type="xsd:positiveInteger"
# use="required"/>
# </xsd:complexType>
# <xsd:element name="Tournament" type="Tournament">
# <xsd:key name="key_Participant">
# <!-- Make sure that each Participant has a unique id -->
# <xsd:selector xpath="Participants/Name"/>
# <xsd:field xpath="@id"/>
# </xsd:key>
# <xsd:keyref name="ref_Participant" refer="key_Participant">
# <!-- Make sure that the value of each Member element in
# the Team elements is an identifier for an existing Participant -->
# <xsd:selector xpath="Teams/Team/Member"/>
# <xsd:field xpath="."/>
# </xsd:keyref>
# <xsd:key name="key_Team">
# <!-- Make sure that each Team has a unique id -->
# <xsd:selector xpath="Teams/Team"/>
# <xsd:field xpath="@id"/>
# </xsd:key>
# <xsd:keyref name="ref_Team" refer="key_Team">
# <!-- Make sure that the value of each Team element in the
# Match elements is an identifier for an existing Team -->
# <xsd:selector xpath="Matches/Match/Team"/>
# <xsd:field xpath="."/>
# </xsd:keyref>
# <xsd:unique name="unique_Match">
# <!-- Make sure that each Match has a unique id -->
# <xsd:selector xpath="Matches/Match"/>
# <xsd:field xpath="@id"/>
# </xsd:unique>
# </xsd:element>
# </xsd:schema>
#
# _________________________________________________________________
# STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
# http://join.msn.com/?page=features/junkmail
#
#
# -----------------------------------------------------------------
# The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
# initiative of OASIS <http://www.oasis-open.org>
#
# The list archives are at http://lists.xml.org/archives/xml-dev/
#
# To subscribe or unsubscribe from this list use the subscription
# manager: <http://www.oasis-open.org/mlmanage/index.php>
#
#
|