Hi,

If a keyref has a declaration:

<xsd:keyref name="ISBNnumber" refer="ISBNnumber">
...
</xsd:keyref>

then its a circular reference, which should not be allowed.

Please find attached a patch for the same.

Cheers,
Rahul.

Sun Microsystems, Inc.
Index: XSDKeyrefTraverser.java
===================================================================
RCS file: 
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDKeyrefTraverser.java,v
retrieving revision 1.8
diff -u -w -r1.8 XSDKeyrefTraverser.java
--- XSDKeyrefTraverser.java     2001/10/17 18:41:33     1.8
+++ XSDKeyrefTraverser.java     2001/10/22 12:04:28
@@ -98,6 +98,17 @@
             fAttrChecker.returnAttrArray(attrValues, schemaDoc);
             return;
         }
+        
+        if ( krName.equals(kName.localpart) &&
+             schemaDoc.fTargetNamespace != null &&
+             kName.uri != null &&
+             schemaDoc.fTargetNamespace.equals(kName.uri) ) {
+            reportGenericSchemaError("circular reference not allowed in keyrefs");
+            //return this array back to pool
+            fAttrChecker.returnAttrArray(attrValues, schemaDoc);
+            return;
+        }
+        
         UniqueOrKey key = (UniqueOrKey)fSchemaHandler.getGlobalDecl(schemaDoc, 
XSDHandler.IDENTITYCONSTRAINT_TYPE, kName);
 
         if(key == null) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to