You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/08/20 04:19:21 UTC

DO NOT REPLY [Bug 11840] New: - keyref validator's error message doesn't show the offending key name

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11840>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11840

keyref validator's error message doesn't show the offending key name

           Summary: keyref validator's error message doesn't show the
                    offending key name
           Product: Xerces-J
           Version: 1.4.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: SAX
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: lzhou@guidewire.com


My xsd file is

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > 

  <xsd:element name="root">
    <xsd:complexType> 
      <xsd:sequence minOccurs="1" maxOccurs="1"> 
        <xsd:element name="AAA" type="myAAA"/> 
        <xsd:element name="BBB" type="myBBB"/> 
      </xsd:sequence> 
    </xsd:complexType> 
    <xsd:key name="myId">
      <xsd:selector xpath="./AAA/a"/> 
      <xsd:field xpath="@id"/> 
    </xsd:key> 
    <xsd:keyref name="myIdref" refer="myId"> 
      <xsd:selector xpath="./BBB/b"/> 
      <xsd:field xpath="@idref"/> 
    </xsd:keyref>
  </xsd:element> 

  <xsd:complexType name="myAAA"> 
    <xsd:sequence minOccurs="1"> 
      <xsd:element name="a" minOccurs="1" maxOccurs="unbounded"> 
        <xsd:complexType> 
          <xsd:attribute name="id" type="xsd:NCName" use="required"/> 
        </xsd:complexType> 
      </xsd:element> 
    </xsd:sequence> 
  </xsd:complexType> 

  <xsd:complexType name="myBBB"> 
    <xsd:sequence minOccurs="1"> 
      <xsd:element name="b" minOccurs="1" maxOccurs="unbounded"> 
        <xsd:complexType> 
          <xsd:attribute name="idref" type="xsd:NCName" use="required"/> 
        </xsd:complexType> 
      </xsd:element> 
    </xsd:sequence> 
  </xsd:complexType> 
</xsd:schema> 

My xml file is
<root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > 
  <AAA> 
    <a id="x"/> 
    <a id="y"/> 
  </AAA> 

  <BBB> 
    <b idref="x"/> 
    <b idref="y"/> 
    <b idref="z"/> 
  </BBB> 
</root>

The result 
Key with value [ID Value:  z] not found for identity constraint of 
element "root".

The desired result
Key[myIdref] with value [ID Value:  z] not found for identity constraint of 
element "root".

Need to edit 
XMLValidator.java line# 5214
                ......
                   reportSchemaError(code, new Object[]{
                      fIdentityConstraint.getIdentityConstraintName(),
                      value,element});
                }
and SchemaMessage.java line#107 to
        { "KeyNotFound", "Key[{0}] with value [{1}] not found for identity 
constraint of element \"{2}\"." },


It's import to make this change otherwise it's impossible to figure out
which xml entry casues the problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org