Hi,

Please find attached patch for IDDatatypeValidator. The content should be 
validated first, before you check the constraints on ID.

Cheers,
Rahul.

Sun Microsystems, Inc.

IDDatatypeValidator.java

Index: IDDatatypeValidator.java
===================================================================
RCS file: 
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/impl/v2/datatypes/IDDatatypeValidator.java,v
retrieving revision 1.6
diff -u -w -r1.6 IDDatatypeValidator.java
--- IDDatatypeValidator.java    2001/10/16 17:21:39     1.6
+++ IDDatatypeValidator.java    2001/10/18 08:44:41
@@ -61,7 +61,7 @@
 import java.util.Enumeration;
 import java.util.Vector;
 import org.apache.xerces.util.XMLChar;
-import org.apache.xerces.impl.v2.msg.XMLMessages;
+//import org.apache.xerces.impl.v2.msg.XMLMessages;
 import org.apache.xerces.impl.v2.SchemaSymbols;
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.impl.v2.XSMessageFormatter;
@@ -121,14 +121,19 @@
         //          since we don't inherit pattern for now.
         // 
 
+       // First the type of content should be validated
+       super.validate(content,null);
 
         if (state != null) {
             if (state.isIdDeclared(content)) {
-                throw new InvalidDatatypeValueException( "ID '" + content +"'  has to 
be unique" );
+               fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
+                                           "cvc-id.2", new Object [] {content},
+                                           XMLErrorReporter.SEVERITY_ERROR);          
+          
+               return null;
+                //throw new InvalidDatatypeValueException( "ID '" + content +"'  has 
+to be unique" );
             }
             state.addId(content);
         }
-
         return content;
     }
 

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

Reply via email to