001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 1999 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 org.apache.xerces.readers;
059:
060: import org.apache.xerces.framework.XMLErrorReporter;
061: import org.apache.xerces.utils.StringPool;
062: import org.xml.sax.InputSource;
063: import java.io.InputStream;
064: import java.io.Reader;
065:
066: /**
067: * This is the factory interface used to create readers.
068: *
069: * @version
070: */
071: public interface XMLEntityReaderFactory {
072: /**
073: * Adds a recognizer.
074: *
075: * @param recognizer The XML recognizer to add.
076: */
077: public void addRecognizer(XMLDeclRecognizer recognizer);
078:
079: /**
080: * Set char data processing preference.
081: */
082: public void setSendCharDataAsCharArray(boolean flag);
083:
084: /**
085: *
086: */
087: public void setAllowJavaEncodingName(boolean flag);
088:
089: /**
090: *
091: */
092: public boolean getAllowJavaEncodingName();
093:
094: /**
095: * Create an entity reader for the source.
096: *
097: * @param source The input source.
098: * @param systemId The system identifier for the input.
099: * @param xmlDecl <code>true</code> if an XMLDecl may be present; otherwise
100: * <code>false</code> if a TextDecl may be present.
101: * @param stringPool The string pool.
102: * @return The reader that will process the source.
103: * @exception java.lang.Exception
104: */
105: public XMLEntityHandler.EntityReader createReader(
106: XMLEntityHandler entityHandler,
107: XMLErrorReporter errorReporter, InputSource source,
108: String systemId, boolean xmlDecl, StringPool stringPool)
109: throws Exception;
110:
111: /**
112: * Create an entity reader for a character stream.
113: *
114: * @param enityHandler The entity handler.
115: * @param errorReporter The error reporter.
116: * @param sendCharDataAsCharArray true if char data should be reported using
117: * char arrays instead of string handles.
118: * @param reader The character stream.
119: * @param stringPool The string pool.
120: * @return The reader that will process the character data.
121: * @exception java.lang.Exception
122: */
123: public XMLEntityHandler.EntityReader createCharReader(
124: XMLEntityHandler entityHandler,
125: XMLErrorReporter errorReporter,
126: boolean sendCharDataAsCharArray, Reader reader,
127: StringPool stringPool) throws Exception;
128:
129: /**
130: * Create an entity reader for a byte stream encoded in UTF-8.
131: *
132: * @param enityHandler The entity handler.
133: * @param errorReporter The error reporter.
134: * @param sendCharDataAsCharArray true if char data should be reported using
135: * char arrays instead of string handles.
136: * @param data The byte stream.
137: * @param stringPool The string pool.
138: * @return The reader that will process the UTF-8 data.
139: * @exception java.lang.Exception
140: */
141: public XMLEntityHandler.EntityReader createUTF8Reader(
142: XMLEntityHandler entityHandler,
143: XMLErrorReporter errorReporter,
144: boolean sendCharDataAsCharArray, InputStream data,
145: StringPool stringPool) throws Exception;
146:
147: /**
148: * Create an entity reader for data from a String.
149: *
150: * @param entityHandler The current entity handler.
151: * @param errorReporter The current error reporter.
152: * @param sendCharDataAsCharArray true if char data should be reported using
153: * char arrays instead of string handles.
154: * @param lineNumber The line number to return as our position.
155: * @param columnNumber The column number to return as our position.
156: * @param stringHandle The StringPool handle for the data to process.
157: * @param stringPool The string pool.
158: * @param addEnclosingSpaces If true, treat the data to process as if
159: * there were a leading and trailing space
160: * character enclosing the string data.
161: * @return The reader that will process the string data.
162: * @exception java.lang.Exception
163: */
164: public XMLEntityHandler.EntityReader createStringReader(
165: XMLEntityHandler entityHandler,
166: XMLErrorReporter errorReporter,
167: boolean sendCharDataAsCharArray, int lineNumber,
168: int columnNumber, int stringHandle, StringPool stringPool,
169: boolean addEnclosingSpaces) throws Exception;
170: }
|