You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2001/05/30 17:38:20 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/validators/datatype IDREFDatatypeValidator.java

neilg       01/05/30 08:38:19

  Modified:    java/src/org/apache/xerces/validators/schema
                        SchemaGrammar.java TraverseSchema.java
               java/src/org/apache/xerces/validators/datatype
                        IDREFDatatypeValidator.java
  Log:
  bugfixes from Elena Litani (whose CVS is malfunctioning)
  
  Revision  Changes    Path
  1.27      +3 -1      xml-xerces/java/src/org/apache/xerces/validators/schema/SchemaGrammar.java
  
  Index: SchemaGrammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/SchemaGrammar.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- SchemaGrammar.java	2001/05/29 22:19:16	1.26
  +++ SchemaGrammar.java	2001/05/30 15:38:04	1.27
  @@ -60,7 +60,7 @@
    * @author Eric Ye
    *         
    * @see    
  - * @version $Id: SchemaGrammar.java,v 1.26 2001/05/29 22:19:16 neilg Exp $
  + * @version $Id: SchemaGrammar.java,v 1.27 2001/05/30 15:38:04 neilg Exp $
    */
   package org.apache.xerces.validators.schema;
   
  @@ -133,6 +133,8 @@
       Hashtable topLevelNotationDecls = new Hashtable();
       Hashtable topLevelAttrDecls  = new Hashtable();
       Hashtable topLevelAttrGrpDecls = new Hashtable();
  +    Hashtable topLevelElemDecls = new Hashtable();
  +    Hashtable topLevelTypeDecls = new Hashtable();
   
       private NamespacesScope fNamespacesScope = null;
       private String fTargetNamespaceURI = "";
  
  
  
  1.180     +50 -12    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.179
  retrieving revision 1.180
  diff -u -r1.179 -r1.180
  --- TraverseSchema.java	2001/05/29 22:19:16	1.179
  +++ TraverseSchema.java	2001/05/30 15:38:06	1.180
  @@ -128,7 +128,7 @@
    *  
    * @see org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.179 2001/05/29 22:19:16 neilg Exp $
  + * @version $Id: TraverseSchema.java,v 1.180 2001/05/30 15:38:06 neilg Exp $
    */
   public class TraverseSchema implements 
                               NamespacesScope.NamespacesHandler{
  @@ -663,8 +663,6 @@
           fCurrentScope = -1;
   
   
  -        checkTopLevelDuplicateNames(root);
  -
           //extract all top-level attribute, attributeGroup, and group Decls and put them in the 3 hasn table in the SchemaGrammar.
           extractTopLevel3Components(root);
   
  @@ -752,9 +750,6 @@
   
       } // traverseSchema(Element)
   
  -    private void checkTopLevelDuplicateNames(Element root) {
  -        //TO DO : !!!
  -    }
   
       private void extractTopLevel3Components(Element root) throws Exception {
           
  @@ -763,19 +758,64 @@
   
               String name = child.getLocalName();
               String compName = child.getAttribute(SchemaSymbols.ATT_NAME);
  -            if (name.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
  +            if (name.equals(SchemaSymbols.ELT_ELEMENT)) {
  +                // Check if the element has already been declared
  +                if (fSchemaGrammar.topLevelElemDecls.get(compName) != null) {
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for an element " +
  +                                             compName);
  +                }
  +                else {                
  +                    fSchemaGrammar.topLevelElemDecls.put(compName, child);
  +                }
  +            }
  +            else if (name.equals(SchemaSymbols.ELT_SIMPLETYPE) ||
  +                     name.equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
  +                 // Check for dublicate declaration
  +                if (fSchemaGrammar.topLevelTypeDecls.get(compName) != null) {
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for a type " +
  +                                             compName);
  +                }
  +                else {                
  +                    fSchemaGrammar.topLevelTypeDecls.put(compName, child);
  +                }
  +            }
  +            else if (name.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP)) {
  +                 // Check for dublicate declaration
  +                if (fSchemaGrammar.topLevelAttrGrpDecls.get(compName) != null) {
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for an attribute group " +
  +                                             compName);
  +                }
  +                else {                
                   fSchemaGrammar.topLevelAttrGrpDecls.put(compName, child);
  +                }
               } else if (name.equals( SchemaSymbols.ELT_ATTRIBUTE ) ) {
  -                fSchemaGrammar.topLevelAttrDecls.put(compName, child);
  +                // Check for dublicate declaration
  +                if (fSchemaGrammar.topLevelAttrGrpDecls.get(compName) != null) {
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for an attribute " +
  +                                             compName);
  +                }
  +                else {                
  +                    fSchemaGrammar.topLevelAttrGrpDecls.put(compName, child);
  +                }
               } else if ( name.equals(SchemaSymbols.ELT_GROUP) ) {
                   // Check if the group has already been declared
  -                if (fSchemaGrammar.topLevelGroupDecls.get(compName) != null) 
  -                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for group " +
  +                if (fSchemaGrammar.topLevelGroupDecls.get(compName) != null){ 
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for a group " +
                                                compName);
  +                }
  +                else {                
                   fSchemaGrammar.topLevelGroupDecls.put(compName, child);
  +                }
               } else if ( name.equals(SchemaSymbols.ELT_NOTATION) ) {
  +                // Check for dublicate declaration
  +                if (fSchemaGrammar.topLevelNotationDecls.get(compName) != null) {
  +                   reportGenericSchemaError("sch-props-correct: Duplicate declaration for a notation " +
  +                                             compName);
  +                }
  +                else {                
                   fSchemaGrammar.topLevelNotationDecls.put(compName, child);
               }
  +            }
           } // for each child node
       }
   
  @@ -1038,8 +1078,6 @@
           // General Attribute Checking
           int scope = GeneralAttrCheck.ELE_CONTEXT_GLOBAL;
           Hashtable attrValues = fGeneralAttrCheck.checkAttributes(root, scope);
  -
  -        checkTopLevelDuplicateNames(root);
   
           //extract all top-level attribute, attributeGroup, and group Decls and put them in the 3 hasn table in the SchemaGrammar.
           extractTopLevel3Components(root);
  
  
  
  1.20      +1 -13     xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java
  
  Index: IDREFDatatypeValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/datatype/IDREFDatatypeValidator.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- IDREFDatatypeValidator.java	2001/05/10 21:25:08	1.19
  +++ IDREFDatatypeValidator.java	2001/05/30 15:38:16	1.20
  @@ -71,7 +71,7 @@
    *
    * @author Jeffrey Rodriguez-
    * @author Mark Swinkles - List Validation refactoring
  - * @version $Id: IDREFDatatypeValidator.java,v 1.19 2001/05/10 21:25:08 elena Exp $
  + * @version $Id: IDREFDatatypeValidator.java,v 1.20 2001/05/30 15:38:16 neilg Exp $
    */
   public class IDREFDatatypeValidator extends StringDatatypeValidator {
       private static StringDatatypeValidator  fgStrValidator  = null;
  @@ -187,18 +187,6 @@
           return null;
       }
   
  -
  -    /**
  -     * REVISIT
  -     * Compares two Datatype for order
  -     *
  -     * @param o1
  -     * @param o2
  -     * @return
  -     */
  -    public int compare( String content1, String content2) {
  -        return -1;
  -    }
   
       /**
          * Returns a copy of this object.
  
  
  

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