Is the following the error message you got?
[Error] ...:8:43: cvc-id.3: A field of identity constraint 'ZoneToZoneName'
matched element 'Zone', but this element does not have a simple type.
It's required that all elements that match the "field"s of a "key/keyref"
to have a simple type. In your example, the element <Zone>Unite
States</Zone> matches a field in the keyref, but it has a complex type.
This seems to be a bug fixed after 2.0.1.
HTH,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
"Laura Smith"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]>
com> cc:
Subject: Keyrefs and mixed
content
08/01/2003 11:55
AM
Please respond to
xerces-j-user
The following schema and instance validated properly with the following:
Name: org/apache/xerces
Specification-Title: Java API for XML Processing
Specification-Vendor: Sun Microsystems Inc.
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/xerces2-j
Specification-Version: 1.2
Implementation-Version: Xerces-J_2_0_1_01
Implementation-Title: org.apache.xerces
Comment: Xerces parser implementing JAXP
Why won't it validate properly with this version?
Name: org/apache/xerces/impl/Version
Comment: @impl.name@ for http://xml.apache.org/xerces2-j
Implementation-Title: org.apache.xerces.impl.Version
Implementation-Version: 2.5.0
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/xerces2-j/
Here's the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name="Zones">
<xs:complexType>
<xs:sequence>
<xs:element name="Zone" type="Zone"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="ZoneName">
<xs:selector xpath="./Zone"/>
<xs:field xpath="@name"/>
</xs:key>
<xs:keyref name="ZoneToZoneName" refer="ZoneName">
<xs:selector xpath="./Zone/Zone"/>
<xs:field xpath="."/>
</xs:keyref>
</xs:element>
<xs:complexType name="Zone" mixed="true" >
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Country" type="xs:string"/>
<xs:element name="Zone" type="Zone"/>
</xs:choice>
<xs:attribute name="name" type="xs:string" use="optional"/>
</xs:complexType>
</xs:schema>
And here's the instance:
<?xml version="1.0" encoding="UTF-8"?>
<Zones>
<Zone name="United States">
<Country>US</Country>
</Zone>
<Zone name="United States Plus Mexico">
<Country>MX</Country>
<Zone>United States</Zone>
</Zone>
</Zones>
With the keyref I'm validating that the content of the nested zone (in this
case <Zone>United States</Zone>) matches one of the zone names. Any idea
why this no longer works?
Thanks,
Laura
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]