xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmar...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/validators/common XMLValidator.java
Date Thu, 09 Aug 2001 19:21:50 GMT
lmartin     01/08/09 12:21:50

  Modified:    java/src/org/apache/xerces/validators/common
                        XMLValidator.java
  Log:
  Applied a patch submitted by Henry Zongaro to reduce the number of temporary ElementDecl
objects created.   Fixes a regression introduced by a bug fix in 1.4.2
  
  Revision  Changes    Path
  1.186     +19 -14    xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java
  
  Index: XMLValidator.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/XMLValidator.java,v
  retrieving revision 1.185
  retrieving revision 1.186
  diff -u -r1.185 -r1.186
  --- XMLValidator.java	2001/08/08 18:20:19	1.185
  +++ XMLValidator.java	2001/08/09 19:21:49	1.186
  @@ -127,7 +127,7 @@
   /**
    * This class is the super all-in-one validator used by the parser.
    *
  - * @version $Id: XMLValidator.java,v 1.185 2001/08/08 18:20:19 neilg Exp $
  + * @version $Id: XMLValidator.java,v 1.186 2001/08/09 19:21:49 lmartin Exp $
    */
   public final class XMLValidator
       implements DefaultEntityHandler.EventHandler,
  @@ -3245,10 +3245,15 @@
            final int oldElementIndex = elementIndex;
   
            contentSpecType =  getContentSpecType(elementIndex);
  -         XMLElementDecl tempElementDecl = new XMLElementDecl();
  -         if (elementIndex != -1)
  -             fGrammar.getElementDecl(elementIndex, tempElementDecl);
  +         int elementNameLocalPart = StringPool.NULL_STRING;
  +         DatatypeValidator elementDatatypeValidator = null;
   
  +         if (elementIndex != -1) {
  +             fGrammar.getElementDecl(elementIndex, fTempElementDecl);
  +             elementNameLocalPart = fTempElementDecl.name.localpart;
  +             elementDatatypeValidator = fTempElementDecl.datatypeValidator;
  +         }
  +
            if (fGrammarIsSchemaGrammar) {
   
               // handle "xsi:type" right here
  @@ -3308,7 +3313,7 @@
                        else if (elementIndex != -1) {
                           // make sure the new type is related to the
                           // type of the expected element
  -                        DatatypeValidator ancestorValidator = tempElementDecl.datatypeValidator;
  +                        DatatypeValidator ancestorValidator = elementDatatypeValidator;
                           DatatypeValidator tempVal = fXsiTypeValidator;
                           for(; tempVal != null; tempVal = tempVal.getBaseValidator())
                               // WARNING!!!  Comparison by reference.
  @@ -3343,7 +3348,7 @@
                                       reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                           XMLMessages.SCHEMA_GENERIC_ERROR,
                                           "Type : "+uri+","+localpart
  -                                        +" does not derive from the type of element " +
fStringPool.toString(tempElementDecl.name.localpart));
  +                                        +" does not derive from the type of element " +
fStringPool.toString(elementNameLocalPart));
   			                    }
   			                } else
                               if ((ancestorValidator == null &&
  @@ -3355,7 +3360,7 @@
                                   reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                       XMLMessages.SCHEMA_GENERIC_ERROR,
                                       "Type : "+uri+","+localpart
  -                                    +" does not derive from the type of element " + fStringPool.toString(tempElementDecl.name.localpart));
  +                                    +" does not derive from the type of element " + fStringPool.toString(elementNameLocalPart));
                               }
                           } else {
                               // if we have an attribute but xsi:type's type is simple, we
have a problem...
  @@ -3364,13 +3369,13 @@
                                   reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                       XMLMessages.SCHEMA_GENERIC_ERROR,
                                       "Type : "+uri+","+localpart
  -                                    +" does not derive from the type of element " + fStringPool.toString(tempElementDecl.name.localpart));
  +                                    +" does not derive from the type of element " + fStringPool.toString(elementNameLocalPart));
                               }
                               // check if element has block set
                               if((((SchemaGrammar)fGrammar).getElementDeclBlockSet(elementIndex)
& SchemaSymbols.RESTRICTION) != 0) {
                                   reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                       XMLMessages.SCHEMA_GENERIC_ERROR,
  -                                    "Element " + fStringPool.toString(tempElementDecl.name.localpart)
  +                                    "Element " + fStringPool.toString(elementNameLocalPart)
                                       + "does not permit substitution by a type such as "+uri+","+localpart);
                               }
                           }
  @@ -3400,9 +3405,9 @@
                                      XMLMessages.SCHEMA_GENERIC_ERROR,
                                       "Type : "+uri+","+localpart
                                       +" does not derive from the type " + destType.typeName);
  -                         } else if (destType == null && tempElementDecl.datatypeValidator
!= null) {
  +                         } else if (destType == null && elementDatatypeValidator
!= null) {
                               // if the original type is a simple type, check derivation
ok.
  -                            DatatypeValidator ancestorValidator = tempElementDecl.datatypeValidator;
  +                            DatatypeValidator ancestorValidator = elementDatatypeValidator;
                               DatatypeValidator tempVal = fXsiTypeValidator;
                               for(; tempVal != null; tempVal = tempVal.getBaseValidator())
                                   // WARNING!!!  Comparison by reference.
  @@ -3444,13 +3449,13 @@
                                           reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                               XMLMessages.SCHEMA_GENERIC_ERROR,
                                               "Type : "+uri+","+localpart
  -                                            +" does not derive from the type of element
" + fStringPool.toString(tempElementDecl.name.localpart));
  +                                            +" does not derive from the type of element
" + fStringPool.toString(elementNameLocalPart));
   			                        }
   			                    } else {
                                       reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                           XMLMessages.SCHEMA_GENERIC_ERROR,
                                           "Type : "+uri+","+localpart
  -                                        +" does not derive from the type of element " +
fStringPool.toString(tempElementDecl.name.localpart));
  +                                        +" does not derive from the type of element " +
fStringPool.toString(elementNameLocalPart));
                                   }
                               }
                            } else if (typeInfo != destType) { // now check whether the element
or typeInfo's baseType blocks us.
  @@ -3458,7 +3463,7 @@
                               if((((SchemaGrammar)fGrammar).getElementDeclBlockSet(elementIndex)
& derivationMethod) != 0) {
                                   reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                      XMLMessages.SCHEMA_GENERIC_ERROR,
  -                                    "Element " + fStringPool.toString(tempElementDecl.name.localpart)
+
  +                                    "Element " + fStringPool.toString(elementNameLocalPart)
+
                                       " does not permit xsi:type substitution in the manner
required by type "+uri+","+localpart);
                               } else if (typeInfo.baseComplexTypeInfo != null &&
                                          (typeInfo.baseComplexTypeInfo.blockSet & derivationMethod)
!= 0) {
  
  
  

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


Mime
View raw message