You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by xin wang <xv...@yahoo.com> on 2002/05/24 22:52:15 UTC
error message on keyref constraint violation
In the attached xml file, B.ref should reference A.id.
When it does not, we get:
Error at file keyrefTest.xml, line 6, char 8
Message: The key for identity constraint of element
'test' is not found.
Notice that line 6 is the last line of the file. Is
there any way for the error message to point to the
line where the wrong keyref actually appears (in this
case, line 5 <B ref="ab"/> ).
victoria
The xml file:
<?xml version="1.0"?>
<test
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="keyrefTest.xsd">
<A id="abc"/>
<B ref="ab"/>
</test>
The schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="A">
<xs:complexType>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="B">
<xs:complexType>
<xs:attribute name="ref" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="aid">
<xs:selector xpath="A"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:keyref name="aref" refer="aid">
<xs:selector xpath="B"/>
<xs:field xpath="@ref"/>
</xs:keyref>
</xs:element>
</xs:schema>
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org