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 Fri, 02 Feb 2001 20:52:56 GMT
neilg       01/02/02 12:52:56

  Modified:    java/src/org/apache/xerces/validators/schema
                        TraverseSchema.java
  Log:
  fixed a number of bugs caused by the move away from -1 to indicate URI's not corresponding
to a schema targetNamespace
  
  Revision  Changes    Path
  1.93      +21 -23    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.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- TraverseSchema.java	2001/02/02 06:07:54	1.92
  +++ TraverseSchema.java	2001/02/02 20:52:50	1.93
  @@ -121,7 +121,7 @@
    *  
    * @see org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.92 2001/02/02 06:07:54 andyc Exp $
  + * @version $Id: TraverseSchema.java,v 1.93 2001/02/02 20:52:50 neilg Exp $
    */
   public class TraverseSchema implements 
                               NamespacesScope.NamespacesHandler{
  @@ -2771,9 +2771,10 @@
   				// this nasty hack needed to ``override'' the "use" on the 
   				// global attribute with that on the ref'ing attribute.
   				int referredAttName = fStringPool.addSymbol(referredAttribute.getAttribute(SchemaSymbols.ATT_NAME));
  -        		int uriIndex = -1;
  -        		if ( fTargetNSURIString.length() > 0) 
  -            		uriIndex = fTargetNSURI; 
  +        		int uriIndex = StringPool.EMPTY_STRING;
  +        		if ( fTargetNSURIString.length() > 0) {
  +                    	uriIndex = fTargetNSURI;
  +        		}
           		QName referredAttQName = new QName(-1,referredAttName,referredAttName,uriIndex);
   				if (prohibited) {
   	                int tempIndex = fSchemaGrammar.getAttributeDeclIndex(typeInfo.templateElementIndex,
referredAttQName);
  @@ -2991,15 +2992,11 @@
           int uriIndex = StringPool.EMPTY_STRING;
           // refer to 4.3.1 in "XML Schema Part 1: Structures"
           if ( fTargetNSURIString.length() > 0) {
  -                if ( isAttrTopLevel) {
  -                        uriIndex = fTargetNSURI;
  -                }
  -                else if ( !isQName.equals(SchemaSymbols.ATTVAL_UNQUALIFIED)){
  -                        if ( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
  -                            fAttributeDefaultQualified ) {
  -                                uriIndex = fTargetNSURI;
  -                        }
  -                }
  +                if ( isAttrTopLevel || 
  +                		(( !isQName.equals(SchemaSymbols.ATTVAL_UNQUALIFIED)) &&
  +                        ( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
  +                         fAttributeDefaultQualified ))) 
  +                    uriIndex = fTargetNSURI;
           }
           /***
           int uriIndex = fTargetNSURI;
  @@ -3377,7 +3374,7 @@
               QName eltName = new QName(prefix != null ? fStringPool.addSymbol(prefix) :
-1,
                                         localpartIndex,
                                         fStringPool.addSymbol(ref),
  -                                      uriString != null ? fStringPool.addSymbol(uriString)
: -1);
  +                                      uriString != null ? fStringPool.addSymbol(uriString)
: StringPool.EMPTY_STRING);
   
               //if from another schema, just return the element QName
               if (! uriString.equals(fTargetNSURIString) ) {
  @@ -3619,7 +3616,7 @@
                               if (fCurrentTypeNameStack.search((Object)localpart) > -
1) {
                                   //then we found a recursive element using complexType.
                                   // REVISIT: this will be broken when recursing happens
between 2 schemas
  -                                int uriInd = -1;
  +                                int uriInd = StringPool.EMPTY_STRING;
                                   if ( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
                                        fElementDefaultQualified) {
                                       uriInd = fTargetNSURI;
  @@ -3665,8 +3662,10 @@
           else {
               // if there is substitutionGroup affiliation and not type defition found for
this element, 
               // then grab substitutionGroup affiliation's type and give it to this element
  -            if ( typeInfo == null && dv == null ) typeInfo = substitutionGroupEltTypeInfo;
  -            if ( typeInfo == null && dv == null ) dv = substitutionGroupEltDV;
  +            if ( typeInfo == null && dv == null ) {
  +				typeInfo = substitutionGroupEltTypeInfo;
  +				dv = substitutionGroupEltDV;
  +			}
           }
   
           if (typeInfo == null && dv==null) {
  @@ -3704,7 +3703,7 @@
   
           int elementNameIndex     = fStringPool.addSymbol(name);
           int localpartIndex = elementNameIndex;
  -        int uriIndex = -1;
  +        int uriIndex = StringPool.EMPTY_STRING;
           int enclosingScope = fCurrentScope;
   
           //refer to 4.3.2 in "XML Schema Part 1: Structures"
  @@ -3712,11 +3711,10 @@
               uriIndex = fTargetNSURI;
               enclosingScope = TOP_LEVEL_SCOPE;
           }
  -        else if ( !isQName.equals(SchemaSymbols.ATTVAL_UNQUALIFIED)){
  -                if ( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
  -                   fElementDefaultQualified ) {
  -                        uriIndex = fTargetNSURI;
  -                }
  +        else if ( !isQName.equals(SchemaSymbols.ATTVAL_UNQUALIFIED) &&
  +                	(( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
  +                   		fElementDefaultQualified ))) {
  +            uriIndex = fTargetNSURI;
           }
           
           //There can never be two elements with the same name and different type in the
same scope.
  
  
  

Mime
View raw message