Improve key not found error message
-----------------------------------
Key: XMLBEANS-234
URL: http://issues.apache.org/jira/browse/XMLBEANS-234
Project: XMLBeans
Type: Improvement
Components: Validator
Versions: Version 2, Version 2.1
Reporter: Radu Preotiuc-Pietro
Assigned to: Radu Preotiuc-Pietro
Priority: Minor
Fix For: TBD
I think the idea of appending the two paths (the field to the selector) is
interesting, so I will add a JIRA to track it. The only difficulty that I see
with it is that the key corresponding to a keyref may not be in the same
element, and explictly identifying the element the corresponding key belongs to
becomes exceedingly difficult in complex cases.
Radu
-----Original Message-----
From: Samuel B. Quiring [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 24, 2005 3:08 PM
To: Radu Preotiuc-Pietro
Subject: Re: Key 'Yes' not found for keyref constraint ...
<snip/> Here's an approximation:
The reference "TotalFundForAttachedKeyPersonsExistKeyRef2" requires that:
./RR_Budget:TotalFundForAttachedKeyPersons"@RR_Budget:TotalFundForAttachedKeyPersonsExist"
point to
./RR_Budget:[EMAIL PROTECTED]:TotalFundForAttachedKeyPersonsExist,
but ./RR_Budget:[EMAIL PROTECTED]:TotalFundForAttachedKeyPersonsExist does not
exist
or
The reference "TotalFundForAttachedKeyPersonsExistKeyRef2" refers to an item
that does not exist: ./RR_Budget:[EMAIL
PROTECTED]:TotalFundForAttachedKeyPersonsExist,
I'm not sure if I got the notation right. I believe that either of these
messages would have been far more helpful than:
Key 'Yes' not found for keyref constraint '[EMAIL
PROTECTED]://apply.grants.gov/forms/RR_Budget-V1.0'
<snip/>
I think your problem lies in the fact that keyref
"TotalFundForAttachedKeyPersonsExistKeyRef2" doesn't in fact refer to key
"TotalFundForAttachedKeyPersonsExistKey" as you seem to be thinking, but to
"TotalFundForAttacheKeyPersonsExistKey2", so it looks for the element
"AttachedKeyPersons", which is in fact missing....
Radu
--------------------------------------------------------------------------------
From: Samuel B. Quiring [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 23, 2005 7:35 AM
To: [email protected]
Subject: Re: Key 'Yes' not found for keyref constraint ...
I want to clarify one item in the email below: The 'validation error' comes
from calling:
org.apache.xmlbeans.XmlObject.validate().
We call this routine all over in our code, it is great for debugging. This is
the first time
we've been totally stumped.
----- Original Message -----
From: Samuel B. Quiring
To: [email protected]
Sent: Tuesday, November 22, 2005 3:09 PM
Subject: Key 'Yes' not found for keyref constraint ...
I'm getting a validation error on the XML generated for the schema snippet
below:
validationError: error: cvc-identity-constraint.4.3: Key 'Yes' not found for
keyref constraint '[EMAIL PROTECTED]://apply.grants.gov/forms/RR_Budget-V1.0'
Does anyone have any idea what this means? I've been trying to figure this out
for a couple of hours. Here is the relevant XML that is generated:
--------------------------------------------------------------------------------
<rr:FundsRequested>40</rr:FundsRequested>
<rr:BaseSalary>90</rr:BaseSalary>
</rr:Compensation>
</rr:KeyPerson>
<rr:TotalFundForAttachedKeyPersons
rr:TotalFundForAttachedKeyPersonsExist="Yes">101</rr:TotalFundForAttachedKeyPersons>
<rr:TotalFundForKeyPersons>51</rr:TotalFundForKeyPersons>
</rr:KeyPersons>
--------------------------------------------------------------------------------
Schema Snippet (http://apply.grants.gov/forms/schemas/RR_Budget-V1.0.xsd)
<xs:schema xmlns:RR_Budget="http://apply.grants.gov/forms/RR_Budget-V1.0"
xmlns:att="http://apply.grants.gov/system/Attachments-V1.0"
xmlns:globLib="http://apply.grants.gov/system/GlobalLibrary-V1.0"
. . .
<xs:import namespace="http://apply.grants.gov/system/Global-V1.0"
schemaLocation="http://apply.grants.gov/system/schemas/Global-V1.0.xsd" />
. . .
<xs:element name="KeyPersons">
<xs:complexType>
<xs:sequence>
<xs:element name="KeyPerson" type="RR_Budget:KeyPersonDataType"
maxOccurs="8"/>
<xs:element name="TotalFundForAttachedKeyPersons" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="glob:DecimalMin1Max15Places2Type">
<xs:attribute
name="TotalFundForAttachedKeyPersonsExist" type="globLib:YesNoDataType"
use="required" fixed="Yes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="TotalFundForKeyPersons"
type="glob:DecimalMin1Max15Places2Type"/>
<xs:element name="AttachedKeyPersons" minOccurs="0">
<xs:complexType>
<xs:complexContent>
<xs:extension base="att:AttachedFileDataType">
<xs:attribute
name="TotalFundForAttachedKeyPersonsExist" type="globLib:YesNoDataType"
use="required" fixed="Yes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="TotalFundForAttachedKeyPersonsExistKey">
<xs:selector xpath="./RR_Budget:TotalFundForAttachedKeyPersons"/>
<xs:field xpath="@RR_Budget:TotalFundForAttachedKeyPersonsExist"/>
</xs:key>
<xs:keyref name="TotalFundForAttachedKeyPersonsExistKeyRef"
refer="RR_Budget:TotalFundForAttachedKeyPersonsExistKey">
<xs:selector xpath="./RR_Budget:AttachedKeyPersons"/>
<xs:field xpath="@RR_Budget:TotalFundForAttachedKeyPersonsExist"/>
</xs:keyref>
<xs:key name="TotalFundForAttachedKeyPersonsExistKey2">
<xs:selector xpath="./RR_Budget:AttachedKeyPersons"/>
<xs:field xpath="@RR_Budget:TotalFundForAttachedKeyPersonsExist"/>
</xs:key>
<xs:keyref name="TotalFundForAttachedKeyPersonsExistKeyRef2"
refer="RR_Budget:TotalFundForAttachedKeyPersonsExistKey2">
<xs:selector xpath="./RR_Budget:TotalFundForAttachedKeyPersons"/>
<xs:field xpath="@RR_Budget:TotalFundForAttachedKeyPersonsExist"/>
</xs:keyref>
</xs:element>
>From globLib (http://apply.grants.gov/system/schemas/Global-V1.0.xsd)
<xs:simpleType name="YesNoDataType">
<xs:restriction base="xs:string">
<xs:enumeration value="Yes"/>
<xs:enumeration value="No"/>
</xs:restriction>
</xs:simpleType>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]