You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2005/05/25 06:33:08 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java ElementPSVImpl.java

mrglavas    2005/05/24 21:33:08

  Modified:    java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
                        ElementPSVImpl.java
  Log:
  Recover some more performance in the schema validator by deferring creation
  of the XSModel. Only create the XSModel in the PSVI if the application requests it.
  
  Revision  Changes    Path
  1.171     +7 -2      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.170
  retrieving revision 1.171
  diff -u -r1.170 -r1.171
  --- XMLSchemaValidator.java	24 May 2005 22:40:17 -0000	1.170
  +++ XMLSchemaValidator.java	25 May 2005 04:33:07 -0000	1.171
  @@ -1535,6 +1535,10 @@
       // handle start document
       void handleStartDocument(XMLLocator locator, String encoding) {
           fValueStoreCache.startDocument();
  +        if (fAugPSVI) {
  +            fCurrentPSVI.fGrammars = null;
  +            fCurrentPSVI.fSchemaInformation = null;
  +        }
       } // handleStartDocument(XMLLocator,String)
   
       void handleEndDocument() {
  @@ -2302,7 +2306,8 @@
   
               if (root) {
                   // store [schema information] in the PSVI
  -                fCurrentPSVI.fSchemaInformation = new XSModelImpl(grammars);
  +                fCurrentPSVI.fGrammars = grammars;
  +                fCurrentPSVI.fSchemaInformation = null;
               }
           }
   
  
  
  
  1.27      +9 -3      xml-xerces/java/src/org/apache/xerces/impl/xs/ElementPSVImpl.java
  
  Index: ElementPSVImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/ElementPSVImpl.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ElementPSVImpl.java	6 Oct 2004 15:14:55 -0000	1.26
  +++ ElementPSVImpl.java	25 May 2005 04:33:07 -0000	1.27
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2000-2002,2004 The Apache Software Foundation.
  + * Copyright 2000-2002,2004,2005 The Apache Software Foundation.
    * 
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -87,6 +87,9 @@
   
       /** validation context: could be QName or XPath expression*/
       protected String fValidationContext = null;
  +    
  +    /** deferred XSModel **/
  +    protected SchemaGrammar[] fGrammars = null;
   
       /** the schema information property */
       protected XSModel fSchemaInformation = null;
  @@ -220,7 +223,10 @@
        * @return The schema information property if it's the validation root,
        *         null otherwise.
        */
  -    public XSModel getSchemaInformation() {
  +    public synchronized XSModel getSchemaInformation() {
  +        if (fSchemaInformation == null && fGrammars != null) {
  +            fSchemaInformation = new XSModelImpl(fGrammars);
  +        }
           return fSchemaInformation;
       }
       
  
  
  

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