KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xni > parser > PSVIConfiguration


1 /*
2  * Copyright 2001,2002,2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package xni.parser;
18
19 import org.apache.xerces.parsers.XIncludeAwareParserConfiguration;
20 import org.apache.xerces.util.SymbolTable;
21 import org.apache.xerces.xni.grammars.XMLGrammarPool;
22 import org.apache.xerces.xni.parser.XMLComponentManager;
23
24 import xni.PSVIWriter;
25
26 /**
27  * This is the DTD/ XML Schema parser configuration that includes PSVIWriter component.
28  * The document will be fully assessed and will produce PSVI as required by XML Schema specification
29  * configuration including XML Schema Validator in the pipeline.
30  *
31  * @author Elena Litani, IBM
32  * @version $Id: PSVIConfiguration.java,v 1.10 2005/06/14 21:00:09 mrglavas Exp $
33  */

34 public class PSVIConfiguration extends XIncludeAwareParserConfiguration {
35
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
94         fPSVIWriter = createPSVIWriter();
95         if (fPSVIWriter != null) {
96             addComponent(fPSVIWriter);
97         }
98
99     } // <init>(SymbolTable,XMLGrammarPool)
100

101
102     /** Configures the pipeline. */
103     protected void configurePipeline() {
104
105         super.configurePipeline();
106         if (fSchemaValidator != null) {
107             fSchemaValidator.setDocumentHandler(fPSVIWriter);
108             fPSVIWriter.setDocumentHandler(fDocumentHandler);
109             fPSVIWriter.setDocumentSource(fSchemaValidator);
110         }
111
112     } // configurePipeline()
113

114
115     /** Create a PSVIWriter */
116     protected PSVIWriter createPSVIWriter(){
117         return new PSVIWriter();
118     }
119
120 } // class PSVIConfiguration
121
Popular Tags