You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by Eric Ye <er...@locus.apache.org> on 2000/07/06 21:19:43 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema TraverseSchema.java
ericye 00/07/06 12:19:40
Modified: java/src/org/apache/xerces/validators/schema
TraverseSchema.java
Log:
duplicate elementDecl is allowed as long as they have the same type definition.
--ericye
Revision Changes Path
1.34 +16 -7 xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java
Index: TraverseSchema.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- TraverseSchema.java 2000/07/04 01:28:55 1.33
+++ TraverseSchema.java 2000/07/06 19:19:37 1.34
@@ -374,7 +374,7 @@
* Eric Ye
* @see org.apache.xerces.validators.common.Grammar
*
- * @version $Id: TraverseSchema.java,v 1.33 2000/07/04 01:28:55 ericye Exp $
+ * @version $Id: TraverseSchema.java,v 1.34 2000/07/06 19:19:37 ericye Exp $
*/
public class TraverseSchema implements
@@ -424,6 +424,7 @@
private String fCurrentSchemaURL = "";
private XMLAttributeDecl fTempAttributeDecl = new XMLAttributeDecl();
+ private XMLElementDecl fTempElementDecl = new XMLElementDecl();
// REVISIT: maybe need to be moved into SchemaGrammar class
public class ComplexTypeInfo {
@@ -2715,12 +2716,20 @@
}
- //There can never be two elements with the same name in the same scope.
- if (fSchemaGrammar.getElementDeclIndex(localpartIndex, enclosingScope) > -1) {
- noErrorSoFar = false;
- // REVISIT: Localize
- reportGenericSchemaError("duplicate element decl in the same scope : " +
- fStringPool.toString(localpartIndex));
+ //There can never be two elements with the same name and different type in the same scope.
+ int existSuchElementIndex = fSchemaGrammar.getElementDeclIndex(localpartIndex, enclosingScope);
+ if ( existSuchElementIndex > -1) {
+ fSchemaGrammar.getElementDecl(existSuchElementIndex, fTempElementDecl);
+ DatatypeValidator edv = fTempElementDecl.datatypeValidator;
+ ComplexTypeInfo eTypeInfo = fSchemaGrammar.getElementComplexTypeInfo(existSuchElementIndex);
+ if ( ((eTypeInfo != null)&&(eTypeInfo!=typeInfo))
+ || ((edv != null)&&(edv != dv)) ) {
+ noErrorSoFar = false;
+ // REVISIT: Localize
+ reportGenericSchemaError("duplicate element decl in the same scope : " +
+ fStringPool.toString(localpartIndex));
+
+ }
}
QName eltQName = new QName(-1,localpartIndex,elementNameIndex,uriIndex);