001    /*
002     **
003     ** Licensed to the Apache Software Foundation (ASF) under one
004     ** or more contributor license agreements.  See the NOTICE file
005     ** distributed with this work for additional information
006     ** regarding copyright ownership.  The ASF licenses this file
007     ** to you under the Apache License, Version 2.0 (the
008     ** "License"); you may not use this file except in compliance
009     ** with the License.  You may obtain a copy of the License at
010     **
011     **  http://www.apache.org/licenses/LICENSE-2.0
012     **
013     ** Unless required by applicable law or agreed to in writing,
014     ** software distributed under the License is distributed on an
015     ** "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     ** KIND, either express or implied.  See the License for the
017     ** specific language governing permissions and limitations
018     ** under the License.
019     */
020    package javax.xml.stream;
021    
022    import javax.xml.stream.util.XMLEventAllocator;
023    
024    public abstract class XMLInputFactory {
025            public static final java.lang.String ALLOCATOR = "javax.xml.stream.allocator";
026            public static final java.lang.String IS_COALESCING = "javax.xml.stream.isCoalescing";
027            public static final java.lang.String IS_NAMESPACE_AWARE = "javax.xml.stream.isNamespaceAware";
028            public static final java.lang.String IS_REPLACING_ENTITY_REFERENCES = "javax.xml.stream.isReplacingEntityReferences";
029            public static final java.lang.String IS_SUPPORTING_EXTERNAL_ENTITIES = "javax.xml.stream.isSupportingExternalEntities";
030            public static final java.lang.String IS_VALIDATING = "javax.xml.stream.isValidating";
031            public static final java.lang.String REPORTER = "javax.xml.stream.reporter";
032            public static final java.lang.String RESOLVER = "javax.xml.stream.resolver";
033            public static final java.lang.String SUPPORT_DTD = "javax.xml.stream.supportDTD";
034    
035            protected XMLInputFactory() {
036            }
037    
038            public static XMLInputFactory newInstance()
039                            throws FactoryConfigurationError {
040                    // We'll assume the XMLInputFactory from the RI as a backup.
041                    return (XMLInputFactory)FactoryLocator.locate("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
042            }
043    
044            public static XMLInputFactory newFactory()
045                            throws FactoryConfigurationError {
046                    // We'll assume the XMLInputFactory from the RI as a backup.
047                    return (XMLInputFactory)FactoryLocator.locate("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
048            }
049    
050    
051            /**
052             * Create a new XMLInputFactory
053             *
054             * @deprecated to maintain API consistency.  All newInstance methods are
055             * replaced with corresponding newFactory methods.  The replacement
056             * newFactory(String factoryId, ClassLoader classLoader)
057             * method defines no changes in behavior from this method.
058             */
059            public static XMLInputFactory newInstance(java.lang.String factoryId,
060                            java.lang.ClassLoader classLoader) throws FactoryConfigurationError {
061                    // We'll assume the XMLInputFactory from the RI as a backup.
062                    return (XMLInputFactory)FactoryLocator.locate(factoryId, "com.ctc.wstx.stax.WstxInputFactory", classLoader);
063            }
064    
065    
066            public static XMLInputFactory newFactory(java.lang.String factoryId,
067                            java.lang.ClassLoader classLoader) throws FactoryConfigurationError {
068                    // We'll assume the XMLInputFactory from the RI as a backup.
069                    return (XMLInputFactory)FactoryLocator.locate(factoryId, "com.ctc.wstx.stax.WstxInputFactory", classLoader);
070            }
071    
072            public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
073                            throws XMLStreamException;
074    
075            public abstract XMLStreamReader createXMLStreamReader(
076                            javax.xml.transform.Source source) throws XMLStreamException;
077    
078            public abstract XMLStreamReader createXMLStreamReader(
079                            java.io.InputStream stream) throws XMLStreamException;
080    
081            public abstract XMLStreamReader createXMLStreamReader(
082                            java.io.InputStream stream, java.lang.String encoding)
083                            throws XMLStreamException;
084    
085            public abstract XMLStreamReader createXMLStreamReader(
086                            java.lang.String systemId, java.io.InputStream stream)
087                            throws XMLStreamException;
088    
089            public abstract XMLStreamReader createXMLStreamReader(
090                            java.lang.String systemId, java.io.Reader reader)
091                            throws XMLStreamException;
092    
093            public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
094                            throws XMLStreamException;
095    
096            public abstract XMLEventReader createXMLEventReader(
097                            java.lang.String systemId, java.io.Reader reader)
098                            throws XMLStreamException;
099    
100            public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader)
101                            throws XMLStreamException;
102    
103            public abstract XMLEventReader createXMLEventReader(
104                            javax.xml.transform.Source source) throws XMLStreamException;
105    
106            public abstract XMLEventReader createXMLEventReader(
107                            java.io.InputStream stream) throws XMLStreamException;
108    
109            public abstract XMLEventReader createXMLEventReader(
110                            java.io.InputStream stream, java.lang.String encoding)
111                            throws XMLStreamException;
112    
113            public abstract XMLEventReader createXMLEventReader(
114                            java.lang.String systemId, java.io.InputStream stream)
115                            throws XMLStreamException;
116    
117            public abstract XMLStreamReader createFilteredReader(
118                            XMLStreamReader reader, StreamFilter filter)
119                            throws XMLStreamException;
120    
121            public abstract XMLEventReader createFilteredReader(XMLEventReader reader,
122                            EventFilter filter) throws XMLStreamException;
123    
124            public abstract XMLResolver getXMLResolver();
125    
126            public abstract void setXMLResolver(XMLResolver resolver);
127    
128            public abstract XMLReporter getXMLReporter();
129    
130            public abstract void setXMLReporter(XMLReporter reporter);
131    
132            public abstract void setProperty(java.lang.String name,
133                            java.lang.Object value) throws java.lang.IllegalArgumentException;
134    
135            public abstract java.lang.Object getProperty(java.lang.String name)
136                            throws java.lang.IllegalArgumentException;
137    
138            public abstract boolean isPropertySupported(java.lang.String name);
139    
140            public abstract void setEventAllocator(XMLEventAllocator allocator);
141    
142            public abstract XMLEventAllocator getEventAllocator();
143    }