001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 2001, 2002 The Apache Software Foundation. All rights
006: * reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by the
023: * Apache Software Foundation (http://www.apache.org/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. The names "Xerces" and "Apache Software Foundation" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written
030: * permission, please contact apache@apache.org.
031: *
032: * 5. Products derived from this software may not be called "Apache",
033: * nor may "Apache" appear in their name, without prior written
034: * permission of the Apache Software Foundation.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This software consists of voluntary contributions made by many
051: * individuals on behalf of the Apache Software Foundation and was
052: * originally based on software copyright (c) 1999, International
053: * Business Machines, Inc., http://www.apache.org. For more
054: * information on the Apache Software Foundation, please see
055: * <http://www.apache.org/>.
056: */
057:
058: package com.sun.xml.stream.xerces.xni.parser;
059:
060: import java.io.IOException;
061:
062: import com.sun.xml.stream.xerces.xni.XNIException;
063:
064: /**
065: * Represents a parser configuration that can be used as the
066: * configuration for a "pull" parser. A pull parser allows the
067: * application to drive the parser instead of having document
068: * information events "pushed" to the registered handlers.
069: * <p>
070: * A pull parser using this type of configuration first calls
071: * the <code>setInputSource</code> method. After the input
072: * source is set, the pull parser repeatedly calls the
073: * <code>parse(boolean):boolean</code> method. This method
074: * returns a value of true if there is more to parse in the
075: * document.
076: * <p>
077: * Calling the <code>parse(XMLInputSource)</code> is equivalent
078: * to setting the input source and calling the
079: * <code>parse(boolean):boolean</code> method with a "complete"
080: * value of <code>true</code>.
081: *
082: * @author Andy Clark, IBM
083: *
084: * @version $Id: XMLPullParserConfiguration.java,v 1.2 2006/04/01 06:01:43 jeffsuttor Exp $
085: */
086: public interface XMLPullParserConfiguration extends
087: XMLParserConfiguration {
088:
089: //
090: // XMLPullParserConfiguration methods
091: //
092:
093: // parsing
094:
095: /**
096: * Sets the input source for the document to parse.
097: *
098: * @param inputSource The document's input source.
099: *
100: * @exception XMLConfigurationException Thrown if there is a
101: * configuration error when initializing the
102: * parser.
103: * @exception IOException Thrown on I/O error.
104: *
105: * @see #parse(boolean)
106: */
107: public void setInputSource(XMLInputSource inputSource)
108: throws XMLConfigurationException, IOException;
109:
110: /**
111: * Parses the document in a pull parsing fashion.
112: *
113: * @param complete True if the pull parser should parse the
114: * remaining document completely.
115: *
116: * @returns True if there is more document to parse.
117: *
118: * @exception XNIException Any XNI exception, possibly wrapping
119: * another exception.
120: * @exception IOException An IO exception from the parser, possibly
121: * from a byte stream or character stream
122: * supplied by the parser.
123: *
124: * @see #setInputSource
125: */
126: public boolean parse(boolean complete) throws XNIException,
127: IOException;
128:
129: /**
130: * If the application decides to terminate parsing before the xml document
131: * is fully parsed, the application should call this method to free any
132: * resource allocated during parsing. For example, close all opened streams.
133: */
134: public void cleanup();
135:
136: } // interface XMLPullParserConfiguration
|