Home » Xerces-J-src.2.9.1 » xni » parser » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   package xni.parser;
   19   
   20   import org.apache.xerces.parsers.XIncludeAwareParserConfiguration;
   21   import org.apache.xerces.util.SymbolTable;
   22   import org.apache.xerces.xni.grammars.XMLGrammarPool;
   23   import org.apache.xerces.xni.parser.XMLComponentManager;
   24   
   25   import xni.PSVIWriter;
   26   
   27   /**
   28    * This is the DTD/ XML Schema parser configuration that includes PSVIWriter component.
   29    * The document will be fully assessed and will produce PSVI as required by XML Schema specification
   30    * configuration including XML Schema Validator in the pipeline.
   31    * 
   32    * @author Elena Litani, IBM
   33    * @version $Id: PSVIConfiguration.java 447690 2006-09-19 02:41:53Z mrglavas $
   34    */
   35   public class PSVIConfiguration extends XIncludeAwareParserConfiguration {
   36   
   37       /** PSVI Writer */
   38       protected PSVIWriter fPSVIWriter;
   39       
   40       //
   41       // Constructors
   42       //
   43   
   44       /**
   45        * Constructs a document parser using the default symbol table and grammar
   46        * pool or the ones specified by the application (through the properties).
   47        */
   48       public PSVIConfiguration() {
   49           this(null, null);
   50       } // <init>()
   51   
   52       /**
   53        * Constructs a document parser using the specified symbol table.
   54        *
   55        * @param symbolTable    The symbol table to use.
   56        */
   57       public PSVIConfiguration(SymbolTable symbolTable) {
   58           this(symbolTable, null);
   59       } // <init>(SymbolTable)
   60   
   61       /**
   62        * Constructs a document parser using the specified symbol table and
   63        * grammar pool.
   64        * <p>
   65        * <strong>REVISIT:</strong>
   66        * Grammar pool will be updated when the new validation engine is
   67        * implemented.
   68        *
   69        * @param symbolTable    The symbol table to use.
   70        * @param grammarPool    The grammar pool to use.
   71        */
   72       public PSVIConfiguration(SymbolTable symbolTable,
   73                                        XMLGrammarPool grammarPool) {
   74           this(symbolTable, grammarPool, null);
   75       } // <init>(SymbolTable,XMLGrammarPool)
   76   
   77       /**
   78        * Constructs a parser configuration using the specified symbol table,
   79        * grammar pool, and parent settings.
   80        * <p>
   81        * <strong>REVISIT:</strong>
   82        * Grammar pool will be updated when the new validation engine is
   83        * implemented.
   84        *
   85        * @param symbolTable    The symbol table to use.
   86        * @param grammarPool    The grammar pool to use.
   87        * @param parentSettings The parent settings.
   88        */
   89       public PSVIConfiguration(SymbolTable symbolTable,
   90                                       XMLGrammarPool grammarPool,
   91                                       XMLComponentManager parentSettings) {
   92           super(symbolTable, grammarPool, parentSettings);
   93           fPSVIWriter = createPSVIWriter();
   94           if (fPSVIWriter != null) {
   95               addCommonComponent(fPSVIWriter);
   96           }
   97   
   98       } // <init>(SymbolTable,XMLGrammarPool)
   99   
  100       /** Configures the pipeline. */
  101       protected void configurePipeline() {
  102           super.configurePipeline();
  103           addPSVIWriterToPipeline();
  104       } // configurePipeline()
  105       
  106       /** Configures the XML 1.1 pipeline. */
  107       protected void configureXML11Pipeline() {
  108           super.configureXML11Pipeline();
  109           addPSVIWriterToPipeline();
  110       } // configureXML11Pipeline()
  111       
  112       /** Adds PSVI writer to the pipeline. */
  113       protected void addPSVIWriterToPipeline() {
  114           if (fSchemaValidator != null) {
  115               fSchemaValidator.setDocumentHandler(fPSVIWriter);
  116               fPSVIWriter.setDocumentSource(fSchemaValidator);
  117               fPSVIWriter.setDocumentHandler(fDocumentHandler);
  118               if (fDocumentHandler != null) {
  119                   fDocumentHandler.setDocumentSource(fPSVIWriter);
  120               }
  121           }
  122       } // addPSVIWriterToPipeline()
  123   
  124       /** Create a PSVIWriter */
  125       protected PSVIWriter createPSVIWriter(){
  126           return new PSVIWriter();
  127       }
  128   
  129   } // class PSVIConfiguration

Home » Xerces-J-src.2.9.1 » xni » parser » [javadoc | source]