KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xni > parser > XMLPullParserConfiguration


1 /*
2  * Copyright 2001, 2002,2004 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.xni.parser;
18
19 import java.io.IOException JavaDoc;
20
21 import org.apache.xerces.xni.XNIException;
22
23 /**
24  * Represents a parser configuration that can be used as the
25  * configuration for a "pull" parser. A pull parser allows the
26  * application to drive the parser instead of having document
27  * information events "pushed" to the registered handlers.
28  * <p>
29  * A pull parser using this type of configuration first calls
30  * the <code>setInputSource</code> method. After the input
31  * source is set, the pull parser repeatedly calls the
32  * <code>parse(boolean):boolean</code> method. This method
33  * returns a value of true if there is more to parse in the
34  * document.
35  * <p>
36  * Calling the <code>parse(XMLInputSource)</code> is equivalent
37  * to setting the input source and calling the
38  * <code>parse(boolean):boolean</code> method with a "complete"
39  * value of <code>true</code>.
40  *
41  * @author Andy Clark, IBM
42  *
43  * @version $Id: XMLPullParserConfiguration.java,v 1.6 2004/02/24 23:15:56 mrglavas Exp $
44  */

45 public interface XMLPullParserConfiguration
46     extends XMLParserConfiguration {
47
48     //
49
// XMLPullParserConfiguration methods
50
//
51

52     // parsing
53

54     /**
55      * Sets the input source for the document to parse.
56      *
57      * @param inputSource The document's input source.
58      *
59      * @exception XMLConfigurationException Thrown if there is a
60      * configuration error when initializing the
61      * parser.
62      * @exception IOException Thrown on I/O error.
63      *
64      * @see #parse(boolean)
65      */

66     public void setInputSource(XMLInputSource inputSource)
67         throws XMLConfigurationException, IOException JavaDoc;
68
69     /**
70      * Parses the document in a pull parsing fashion.
71      *
72      * @param complete True if the pull parser should parse the
73      * remaining document completely.
74      *
75      * @return True if there is more document to parse.
76      *
77      * @exception XNIException Any XNI exception, possibly wrapping
78      * another exception.
79      * @exception IOException An IO exception from the parser, possibly
80      * from a byte stream or character stream
81      * supplied by the parser.
82      *
83      * @see #setInputSource
84      */

85     public boolean parse(boolean complete) throws XNIException, IOException JavaDoc;
86
87     /**
88      * If the application decides to terminate parsing before the xml document
89      * is fully parsed, the application should call this method to free any
90      * resource allocated during parsing. For example, close all opened streams.
91      */

92     public void cleanup();
93     
94 } // interface XMLPullParserConfiguration
95
Popular Tags