sandygao    2002/09/10 10:08:00

  Modified:    java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
  Log:
  1. We don't always need to create a new ValueStoreCache when the parser
  is reset. The startDocument call can reset the ValueStoreCache.
  2. When there is no IDC map, we don't need to clone the empty hashtable
  and push it into the stack. I'm pushing a null now. When the stacked is popped,
  we perform a null-checking to see whether we need to iterate the elements
  in the hashtable.
  
  Revision  Changes    Path
  1.91      +9 -4      
xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
  
  Index: XMLSchemaValidator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- XMLSchemaValidator.java   10 Sep 2002 16:59:56 -0000      1.90
  +++ XMLSchemaValidator.java   10 Sep 2002 17:08:00 -0000      1.91
  @@ -1365,8 +1365,6 @@
           fMatcherStack.clear();
           fBaseURI = null;
   
  -        fValueStoreCache = new ValueStoreCache();
  -
           fState4XsiType.setExtraChecking(false);
           fState4XsiType.setSymbolTable(symbolTable);
           fState4XsiType.setSymbolTable(symbolTable);
  @@ -3578,7 +3576,11 @@
           // startElement:  pushes the current fGlobalIDConstraintMap
           // onto fGlobalMapStack and clears fGlobalIDConstraint map.
           public void startElement() {
  -            fGlobalMapStack.push(fGlobalIDConstraintMap.clone());
  +            // only clone the hashtable when there are elements
  +            if (fGlobalIDConstraintMap.size() > 0)
  +                fGlobalMapStack.push(fGlobalIDConstraintMap.clone());
  +            else
  +                fGlobalMapStack.push(null);
               fGlobalIDConstraintMap.clear();
           } // startElement(void)
   
  @@ -3587,6 +3589,9 @@
           public void endElement() {
               if (fGlobalMapStack.isEmpty()) return; // must be an invalid doc!
               Hashtable oldMap = (Hashtable)fGlobalMapStack.pop();
  +            // return if there is no element
  +            if (oldMap == null) return;
  +            
               Enumeration keys = oldMap.keys();
               while (keys.hasMoreElements()) {
                   IdentityConstraint id = (IdentityConstraint)keys.nextElement();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to