KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > parsers > XMLDocumentParser


1 /*
2  * Copyright 2001-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 org.apache.xerces.parsers;
18
19 import org.apache.xerces.impl.Constants;
20 import org.apache.xerces.util.SymbolTable;
21 import org.apache.xerces.xni.grammars.XMLGrammarPool;
22 import org.apache.xerces.xni.parser.XMLParserConfiguration;
23
24 /**
25  * This is a concrete vanilla XML parser class. It uses the abstract parser
26  * with either a BasicConfiguration object or the one specified by the
27  * application.
28  *
29  * @author Arnaud Le Hors, IBM
30  * @author Andy Clark, IBM
31  *
32  * @version $Id: XMLDocumentParser.java,v 1.11 2005/05/04 04:23:46 mrglavas Exp $
33  */

34 public class XMLDocumentParser
35     extends AbstractXMLDocumentParser {
36
37     //
38
// Constructors
39
//
40

41     /**
42      * Constructs a document parser using the default basic parser
43      * configuration.
44      */

45     public XMLDocumentParser() {
46         super((XMLParserConfiguration)ObjectFactory.createObject(
47             "org.apache.xerces.xni.parser.XMLParserConfiguration",
48             "org.apache.xerces.parsers.XIncludeAwareParserConfiguration"
49             ));
50     } // <init>()
51

52     /**
53      * Constructs a document parser using the specified parser configuration.
54      */

55     public XMLDocumentParser(XMLParserConfiguration config) {
56         super(config);
57     } // <init>(ParserConfiguration)
58

59     /**
60      * Constructs a document parser using the specified symbol table.
61      */

62     public XMLDocumentParser(SymbolTable symbolTable) {
63         super((XMLParserConfiguration)ObjectFactory.createObject(
64             "org.apache.xerces.xni.parser.XMLParserConfiguration",
65             "org.apache.xerces.parsers.XIncludeAwareParserConfiguration"
66             ));
67         fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.SYMBOL_TABLE_PROPERTY, symbolTable);
68     } // <init>(SymbolTable)
69

70     /**
71      * Constructs a document parser using the specified symbol table and
72      * grammar pool.
73      */

74     public XMLDocumentParser(SymbolTable symbolTable,
75                              XMLGrammarPool grammarPool) {
76         super((XMLParserConfiguration)ObjectFactory.createObject(
77             "org.apache.xerces.xni.parser.XMLParserConfiguration",
78             "org.apache.xerces.parsers.XIncludeAwareParserConfiguration"
79             ));
80         fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.SYMBOL_TABLE_PROPERTY, symbolTable);
81         fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.XMLGRAMMAR_POOL_PROPERTY, grammarPool);
82     }
83
84 } // class XMLDocumentParser
85
Popular Tags