1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xerces.internal.xni.parser;
23
24import java.io.IOException;
25
26import com.sun.org.apache.xerces.internal.xni.XNIException;
27
28/**
29 * Represents a parser configuration that can be used as the
30 * configuration for a "pull" parser. A pull parser allows the
31 * application to drive the parser instead of having document
32 * information events "pushed" to the registered handlers.
33 * <p>
34 * A pull parser using this type of configuration first calls
35 * the <code>setInputSource</code> method. After the input
36 * source is set, the pull parser repeatedly calls the
37 * <code>parse(boolean):boolean</code> method. This method
38 * returns a value of true if there is more to parse in the
39 * document.
40 * <p>
41 * Calling the <code>parse(XMLInputSource)</code> is equivalent
42 * to setting the input source and calling the
43 * <code>parse(boolean):boolean</code> method with a "complete"
44 * value of <code>true</code>.
45 *
46 * @author Andy Clark, IBM
47 *
48 */
49public interface XMLPullParserConfiguration
50    extends XMLParserConfiguration {
51
52    //
53    // XMLPullParserConfiguration methods
54    //
55
56    // parsing
57
58    /**
59     * Sets the input source for the document to parse.
60     *
61     * @param inputSource The document's input source.
62     *
63     * @exception XMLConfigurationException Thrown if there is a
64     *                        configuration error when initializing the
65     *                        parser.
66     * @exception IOException Thrown on I/O error.
67     *
68     * @see #parse(boolean)
69     */
70    public void setInputSource(XMLInputSource inputSource)
71        throws XMLConfigurationException, IOException;
72
73    /**
74     * Parses the document in a pull parsing fashion.
75     *
76     * @param complete True if the pull parser should parse the
77     *                 remaining document completely.
78     *
79     * @return True if there is more document to parse.
80     *
81     * @exception XNIException Any XNI exception, possibly wrapping
82     *                         another exception.
83     * @exception IOException  An IO exception from the parser, possibly
84     *                         from a byte stream or character stream
85     *                         supplied by the parser.
86     *
87     * @see #setInputSource
88     */
89    public boolean parse(boolean complete) throws XNIException, IOException;
90
91    /**
92     * If the application decides to terminate parsing before the xml document
93     * is fully parsed, the application should call this method to free any
94     * resource allocated during parsing. For example, close all opened streams.
95     */
96    public void cleanup();
97
98} // interface XMLPullParserConfiguration
99