- From: Gabriele Zannoni <gzannoni@supereva.it>
- Date: Sat, 2 Mar 2002 07:39:49 -0500 (EST)
- To: <xmlschema-dev@w3.org>
Hi, I'm experiencing schemas for a few days and I have some problems understanding the behavior of keys and keyrefs. For example the schema: <schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns:ns="http://tempuri.org/XMLSchema.xsd" xmlns="http://www.w3.org/2001/XMLSchema"> <element name="document"> <complexType> <sequence> <element name="keyList" type="ns:keyListType"> <key name="aKey"> <selector xpath="ns:key" /> <field xpath="." /> </key> </element> <element name="keyRefList" type="ns:keyListType"> <keyref name="aKeyRef" refer="ns:aKey"> <selector xpath="ns:key" /> <field xpath="." /> </keyref> </element> </sequence> </complexType> </element> <complexType name="keyListType"> <sequence> <element name="key" type="string" maxOccurs="unbounded" /> </sequence> </complexType> </schema> runned over the XML: <document xmlns="http://tempuri.org/XMLSchema.xsd"> <keyList> <key>id1</key> <key>id2</key> <key>id3</key> </keyList> <keyRefList> <key>id1</key> <key>id1</key> </keyRefList> </document> rises an error: The keyref '{http://tempuri.org/XMLSchema.xsd}aKey' does not resolve to a key for the Identity Constraint '{http://tempuri.org/XMLSchema.xsd}aKeyRef'. The problem disappear if I declare the keys on the "document" element scope. I hope there's someone who can help me. Cheers, Gabriele
Received on Saturday, 2 March 2002 10:29:53 UTC