KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xni > parser > NonValidatingParserConfiguration


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.impl.XMLNamespaceBinder;
20 import org.apache.xerces.impl.dtd.XMLDTDValidator;
21 import org.apache.xerces.parsers.StandardParserConfiguration;
22 import org.apache.xerces.xni.parser.XMLComponent;
23 import org.apache.xerces.xni.parser.XMLParserConfiguration;
24
25 /**
26  * Non-validating parser configuration.
27  *
28  * @see XMLComponent
29  * @see XMLParserConfiguration
30  *
31  * @author Andy Clark, IBM
32  *
33  * @version $Id: NonValidatingParserConfiguration.java,v 1.8 2005/01/11 13:47:23 mrglavas Exp $
34  */

35 public class NonValidatingParserConfiguration
36     extends StandardParserConfiguration {
37
38     //
39
// Data
40
//
41

42     // components (configurable)
43

44     /** Namespace binder. */
45     protected XMLNamespaceBinder fNamespaceBinder;
46
47     //
48
// Constructors
49
//
50

51     /**
52      * Constructs a document parser using the default symbol table and grammar
53      * pool or the ones specified by the application (through the properties).
54      */

55     public NonValidatingParserConfiguration() {
56
57         // create and register missing components
58
fNamespaceBinder = new XMLNamespaceBinder();
59         addComponent(fNamespaceBinder);
60
61     } // <init>()
62

63     //
64
// Protected methods
65
//
66

67     /** Configures the pipeline. */
68     protected void configurePipeline() {
69
70         // REVISIT: This should be better designed. In other words, we
71
// need to figure out what is the best way for people to
72
// re-use *most* of the standard configuration but do
73
// common things such as remove a component (e.g.the
74
// validator), insert a new component (e.g. XInclude),
75
// etc... -Ac
76

77         // setup document pipeline
78
fScanner.setDocumentHandler(fNamespaceBinder);
79         fNamespaceBinder.setDocumentHandler(fDocumentHandler);
80         fNamespaceBinder.setDocumentSource(fScanner);
81
82     } // configurePipeline()
83

84     // factory methods
85

86     /** Create a null validator. */
87     protected XMLDTDValidator createDTDValidator() {
88         return null;
89     } // createDTDValidator():XMLDTDValidator
90

91 } // class NonValidatingParserConfiguration
92
Popular Tags