xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ne...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema TraverseSchema.java
Date Thu, 22 Feb 2001 22:32:58 GMT
neilg       01/02/22 14:32:58

  Modified:    java/src/org/apache/xerces/validators/schema
                        TraverseSchema.java
  Log:
  minor bugfixes to <redefine> processing and for <attribute> validity constraint
checking
  
  Revision  Changes    Path
  1.108     +18 -20    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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- TraverseSchema.java	2001/02/21 23:14:46	1.107
  +++ TraverseSchema.java	2001/02/22 22:32:56	1.108
  @@ -124,7 +124,7 @@
    *  
    * @see org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.107 2001/02/21 23:14:46 neilg Exp $
  + * @version $Id: TraverseSchema.java,v 1.108 2001/02/22 22:32:56 neilg Exp $
    */
   public class TraverseSchema implements 
                               NamespacesScope.NamespacesHandler{
  @@ -808,6 +808,7 @@
           }
   
   		if (root == null) return; // nothing to be redefined, so just continue; specs disallow
an error here.
  +
   		// now if root isn't null, it'll contain the root of the schema we need to redefine.
 
   		// We do this in two phases:  first, we look through the children of
   		// redefineDecl.  Each one will correspond to an element of the
  @@ -835,12 +836,7 @@
           else {
   			// targetNamespace is right, so let's do the renaming...
   			// and let's keep in mind that the targetNamespace of the redefined
  -			// elements is that of the redefined schema!
  -			int oldTargetNSURI = fTargetNSURI;
  -			String oldTargetNSURIString = fTargetNSURIString;
  -
  -			fTargetNSURI = fStringPool.addSymbol(redefinedTargetNSURIString);
  -			fTargetNSURIString = redefinedTargetNSURIString;
  +			// elements is that of the redefined schema!  
               boolean saveElementDefaultQualified = fElementDefaultQualified;
               boolean saveAttributeDefaultQualified = fAttributeDefaultQualified;
               int saveScope = fCurrentScope;
  @@ -880,10 +876,7 @@
               fCurrentScope = saveScope;
               fElementDefaultQualified = saveElementDefaultQualified;
               fAttributeDefaultQualified = saveAttributeDefaultQualified;
  -            fSchemaRootElement = saveRoot;
  -			fTargetNSURI = oldTargetNSURI;
  -			fTargetNSURIString = oldTargetNSURIString;
  -
  +            fSchemaRootElement = saveRoot; 
   		}
       } // traverseRedefine
   	// the purpose of this method is twofold:  1.  To find and appropriately modify all information
items
  @@ -941,7 +934,7 @@
               			reportGenericSchemaError("a complexType child of a <redefine> must
have a restriction or extension element as a grandchild");
   					else {
               			String greatGrandKidName = greatGrandKid.getLocalName();
  -						if(!greatGrandKidName.equals(SchemaSymbols.ELT_RESTRICTION) ||
  +						if(!greatGrandKidName.equals(SchemaSymbols.ELT_RESTRICTION) && 
   								!greatGrandKidName.equals(SchemaSymbols.ELT_EXTENSION))
               				// REVISIT: Localize
               				reportGenericSchemaError("a complexType child of a <redefine> must
have a restriction or extension element as a grandchild");
  @@ -3212,7 +3205,9 @@
                       reportGenericSchemaError ( "Couldn't find top level attribute " + ref);
               }
               return -1;
  -        }
  +        } else if (attNameStr.equals(""))
  +			// REVISIT:  localize 
  +       	    reportGenericSchemaError ( "An attribute must have a ref or a name!");
   
           if (datatype.equals("")) {
               if (simpleTypeChild != null) { 
  @@ -3634,15 +3629,15 @@
   	// <annotation> or <simpleType> group is present.
   	private Element findAttributeSimpleType(Element attrDecl) throws Exception {
   		Element child = XUtil.getFirstChildElement(attrDecl);
  -	    	if (child == null)
  +	   	if (child == null)
   	   		return null;
   		if (child.getLocalName().equals(SchemaSymbols.ELT_SIMPLETYPE))
   			return child;
  -			if (child.getLocalName().equals(SchemaSymbols.ELT_ANNOTATION)) {
  -   	 			traverseAnnotationDecl(child);
  -				child = XUtil.getNextSiblingElement(child);
  -			}
  -	    	if (child == null)
  +		if (child.getLocalName().equals(SchemaSymbols.ELT_ANNOTATION)) {
  +   	 		traverseAnnotationDecl(child);
  +			child = XUtil.getNextSiblingElement(child);
  +		}
  +	   	if (child == null)
   	   		return null;
   		if (child.getLocalName().equals(SchemaSymbols.ELT_SIMPLETYPE) &&
   				XUtil.getNextSiblingElement(child) == null) 
  @@ -3825,7 +3820,10 @@
                   }
               }
               return eltName;
  -        }
  +        } else if (name.equals(""))
  +            // REVISIT: Localize
  +            reportGenericSchemaError("a local element must have a name or a ref attribute
present");
  +
                   
           // Handle the substitutionGroup
           Element substitutionGroupElementDecl = null;
  
  
  

Mime
View raw message