< prev index next >

src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java

Print this page


   1 /*
   2  * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 118    * The property used to
 119    * set/get the implementation of the XMLReporter interface
 120    */
 121   public static final String REPORTER=
 122     "javax.xml.stream.reporter";
 123 
 124   /**
 125    * The property used to set/get the implementation of the XMLResolver
 126    */
 127   public static final String RESOLVER=
 128     "javax.xml.stream.resolver";
 129 
 130   /**
 131    * The property used to set/get the implementation of the allocator
 132    */
 133   public static final String ALLOCATOR=
 134     "javax.xml.stream.allocator";
 135 
 136   static final String DEFAULIMPL = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
 137 




 138   protected XMLInputFactory(){}
 139 
 140   /**
 141    * Creates a new instance of the {@code XMLInputFactory} builtin
 142    * system-default implementation.
 143    *
 144    * @return A new instance of the {@code XMLInputFactory} builtin
 145    *         system-default implementation.
 146    *
 147    * @since 9
 148    */
 149   public static XMLInputFactory newDefaultFactory() {
 150       return new XMLInputFactoryImpl();
 151   }
 152 
 153   /**
 154    * Creates a new instance of the factory in exactly the same manner as the
 155    * {@link #newFactory()} method.

 156    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 157    */
 158   public static XMLInputFactory newInstance()
 159     throws FactoryConfigurationError
 160   {
 161     return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL);
 162   }
 163 
 164   /**
 165    * Create a new instance of the factory.
 166    * <p>
 167    * This static method creates a new factory instance.
 168    * This method uses the following ordered lookup procedure to determine
 169    * the XMLInputFactory implementation class to load:
 170    *
 171    * <ul>
 172    * <li>
 173    *   <p>Use the javax.xml.stream.XMLInputFactory system property.
 174    * </li>
 175    * <li>


 193    * <li>
 194    *   <p>Use the service-provider loading facility, defined by the
 195    *   {@link java.util.ServiceLoader} class, to attempt to locate and load an
 196    *   implementation of the service using the {@linkplain
 197    *   java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
 198    *   the service-provider loading facility will use the {@linkplain
 199    *   java.lang.Thread#getContextClassLoader() current thread's context class loader}
 200    *   to attempt to load the service. If the context class
 201    *   loader is null, the {@linkplain
 202    *   ClassLoader#getSystemClassLoader() system class loader} will be used.
 203    * </li>
 204    * <li>
 205    * <p>Otherwise, the {@linkplain #newDefaultFactory() system-default}
 206    *    implementation is returned.
 207    * </li>
 208    * </ul>
 209    * <p>
 210    *   Once an application has obtained a reference to a XMLInputFactory it
 211    *   can use the factory to configure and obtain stream instances.
 212    *

 213    * @throws FactoryConfigurationError in case of {@linkplain
 214    *   java.util.ServiceConfigurationError service configuration error} or if
 215    *   the implementation is not available or cannot be instantiated.
 216    */
 217   public static XMLInputFactory newFactory()
 218     throws FactoryConfigurationError
 219   {
 220     return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL);
 221   }
 222 
 223   /**
 224    * Create a new instance of the factory
 225    *
 226    * @param factoryId             Name of the factory to find, same as
 227    *                              a property name
 228    * @param classLoader           classLoader to use
 229    * @return the factory implementation
 230    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 231    *
 232    * @deprecated  This method has been deprecated to maintain API consistency.
 233    *              All newInstance methods have been replaced with corresponding
 234    *              newFactory methods. The replacement {@link
 235    *              #newFactory(java.lang.String, java.lang.ClassLoader)} method
 236    *              defines no changes in behavior.
 237    */
 238   @Deprecated(since="1.7")
 239   public static XMLInputFactory newInstance(String factoryId,
 240           ClassLoader classLoader)
 241           throws FactoryConfigurationError {
 242       //do not fallback if given classloader can't find the class, throw exception
 243       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 244   }


 307    * of other JAXP factories where the first parameter is fully qualified
 308    * factory class name that provides implementation of the factory.
 309    *
 310    * @param factoryId             Name of the factory to find, same as
 311    *                              a property name
 312    * @param classLoader           classLoader to use
 313    * @return the factory implementation
 314    * @throws FactoryConfigurationError in case of {@linkplain
 315    *   java.util.ServiceConfigurationError service configuration error} or if
 316    *   the implementation is not available or cannot be instantiated.
 317    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 318    */
 319   public static XMLInputFactory newFactory(String factoryId,
 320           ClassLoader classLoader)
 321           throws FactoryConfigurationError {
 322       //do not fallback if given classloader can't find the class, throw exception
 323       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 324   }
 325 
 326   /**
 327    * Create a new XMLStreamReader from a reader
 328    * @param reader the XML data to read from
 329    * @throws XMLStreamException

 330    */
 331   public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
 332     throws XMLStreamException;
 333 
 334   /**
 335    * Create a new XMLStreamReader from a JAXP source.  This method is optional.
 336    * @param source the source to read from

 337    * @throws UnsupportedOperationException if this method is not
 338    * supported by this XMLInputFactory
 339    * @throws XMLStreamException
 340    */
 341   public abstract XMLStreamReader createXMLStreamReader(Source source)
 342     throws XMLStreamException;
 343 
 344   /**
 345    * Create a new XMLStreamReader from a java.io.InputStream
 346    * @param stream the InputStream to read from
 347    * @throws XMLStreamException

 348    */
 349   public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
 350     throws XMLStreamException;
 351 
 352   /**
 353    * Create a new XMLStreamReader from a java.io.InputStream
 354    * @param stream the InputStream to read from
 355    * @param encoding the character encoding of the stream
 356    * @throws XMLStreamException

 357    */
 358   public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream, String encoding)
 359     throws XMLStreamException;
 360 
 361   /**
 362    * Create a new XMLStreamReader from a java.io.InputStream
 363    * @param systemId the system ID of the stream
 364    * @param stream the InputStream to read from


 365    */
 366   public abstract XMLStreamReader createXMLStreamReader(String systemId, java.io.InputStream stream)
 367     throws XMLStreamException;
 368 
 369   /**
 370    * Create a new XMLStreamReader from a java.io.InputStream
 371    * @param systemId the system ID of the stream
 372    * @param reader the InputStream to read from


 373    */
 374   public abstract XMLStreamReader createXMLStreamReader(String systemId, java.io.Reader reader)
 375     throws XMLStreamException;
 376 
 377   /**
 378    * Create a new XMLEventReader from a reader
 379    * @param reader the XML data to read from
 380    * @throws XMLStreamException

 381    */
 382   public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
 383     throws XMLStreamException;
 384 
 385   /**
 386    * Create a new XMLEventReader from a reader
 387    * @param systemId the system ID of the input
 388    * @param reader the XML data to read from
 389    * @throws XMLStreamException

 390    */
 391   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.Reader reader)
 392     throws XMLStreamException;
 393 
 394   /**
 395    * Create a new XMLEventReader from an XMLStreamReader.  After being used
 396    * to construct the XMLEventReader instance returned from this method
 397    * the XMLStreamReader must not be used.
 398    * @param reader the XMLStreamReader to read from (may not be modified)
 399    * @return a new XMLEventReader
 400    * @throws XMLStreamException
 401    */
 402   public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader)
 403     throws XMLStreamException;
 404 
 405   /**
 406    * Create a new XMLEventReader from a JAXP source.
 407    * Support of this method is optional.
 408    * @param source the source to read from


 409    * @throws UnsupportedOperationException if this method is not
 410    * supported by this XMLInputFactory
 411    */
 412   public abstract XMLEventReader createXMLEventReader(Source source)
 413     throws XMLStreamException;
 414 
 415   /**
 416    * Create a new XMLEventReader from a java.io.InputStream
 417    * @param stream the InputStream to read from
 418    * @throws XMLStreamException

 419    */
 420   public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream)
 421     throws XMLStreamException;
 422 
 423   /**
 424    * Create a new XMLEventReader from a java.io.InputStream
 425    * @param stream the InputStream to read from
 426    * @param encoding the character encoding of the stream
 427    * @throws XMLStreamException

 428    */
 429   public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding)
 430     throws XMLStreamException;
 431 
 432   /**
 433    * Create a new XMLEventReader from a java.io.InputStream
 434    * @param systemId the system ID of the stream
 435    * @param stream the InputStream to read from
 436    * @throws XMLStreamException

 437    */
 438   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.InputStream stream)
 439     throws XMLStreamException;
 440 
 441   /**
 442    * Create a filtered reader that wraps the filter around the reader
 443    * @param reader the reader to filter
 444    * @param filter the filter to apply to the reader
 445    * @throws XMLStreamException

 446    */
 447   public abstract XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
 448     throws XMLStreamException;
 449 
 450   /**
 451    * Create a filtered event reader that wraps the filter around the event reader
 452    * @param reader the event reader to wrap
 453    * @param filter the filter to apply to the event reader
 454    * @throws XMLStreamException

 455    */
 456   public abstract XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
 457     throws XMLStreamException;
 458 
 459   /**
 460    * The resolver that will be set on any XMLStreamReader or XMLEventReader created
 461    * by this factory instance.

 462    */
 463   public abstract XMLResolver getXMLResolver();
 464 
 465   /**
 466    * The resolver that will be set on any XMLStreamReader or XMLEventReader created
 467    * by this factory instance.
 468    * @param resolver the resolver to use to resolve references
 469    */
 470   public abstract void  setXMLResolver(XMLResolver resolver);
 471 
 472   /**
 473    * The reporter that will be set on any XMLStreamReader or XMLEventReader created
 474    * by this factory instance.

 475    */
 476   public abstract XMLReporter getXMLReporter();
 477 
 478   /**
 479    * The reporter that will be set on any XMLStreamReader or XMLEventReader created
 480    * by this factory instance.
 481    * @param reporter the resolver to use to report non fatal errors
 482    */
 483   public abstract void setXMLReporter(XMLReporter reporter);
 484 
 485   /**
 486    * Allows the user to set specific feature/property on the underlying
 487    * implementation. The underlying implementation is not required to support
 488    * every setting of every property in the specification and may use
 489    * IllegalArgumentException to signal that an unsupported property may not be
 490    * set with the specified value.
 491    * <p>
 492    * All implementations that implement JAXP 1.5 or newer are required to
 493    * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
 494    * <ul>


 518   public abstract Object getProperty(java.lang.String name)
 519     throws java.lang.IllegalArgumentException;
 520 
 521 
 522   /**
 523    * Query the set of properties that this factory supports.
 524    *
 525    * @param name The name of the property (may not be null)
 526    * @return true if the property is supported and false otherwise
 527    */
 528   public abstract boolean isPropertySupported(String name);
 529 
 530   /**
 531    * Set a user defined event allocator for events
 532    * @param allocator the user defined allocator
 533    */
 534   public abstract void setEventAllocator(XMLEventAllocator allocator);
 535 
 536   /**
 537    * Gets the allocator used by streams created with this factory

 538    */
 539   public abstract XMLEventAllocator getEventAllocator();
 540 
 541 }
   1 /*
   2  * Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 118    * The property used to
 119    * set/get the implementation of the XMLReporter interface
 120    */
 121   public static final String REPORTER=
 122     "javax.xml.stream.reporter";
 123 
 124   /**
 125    * The property used to set/get the implementation of the XMLResolver
 126    */
 127   public static final String RESOLVER=
 128     "javax.xml.stream.resolver";
 129 
 130   /**
 131    * The property used to set/get the implementation of the allocator
 132    */
 133   public static final String ALLOCATOR=
 134     "javax.xml.stream.allocator";
 135 
 136   static final String DEFAULIMPL = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
 137 
 138     /**
 139      * Protected constructor to prevent instantiation.
 140      * Use {@link #newFactory()} instead.
 141      */
 142   protected XMLInputFactory(){}
 143 
 144   /**
 145    * Creates a new instance of the {@code XMLInputFactory} builtin
 146    * system-default implementation.
 147    *
 148    * @return A new instance of the {@code XMLInputFactory} builtin
 149    *         system-default implementation.
 150    *
 151    * @since 9
 152    */
 153   public static XMLInputFactory newDefaultFactory() {
 154       return new XMLInputFactoryImpl();
 155   }
 156 
 157   /**
 158    * Creates a new instance of the factory in exactly the same manner as the
 159    * {@link #newFactory()} method.
 160    * @return an instance of the {@code XMLInputFactory}
 161    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 162    */
 163   public static XMLInputFactory newInstance()
 164     throws FactoryConfigurationError
 165   {
 166     return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL);
 167   }
 168 
 169   /**
 170    * Create a new instance of the factory.
 171    * <p>
 172    * This static method creates a new factory instance.
 173    * This method uses the following ordered lookup procedure to determine
 174    * the XMLInputFactory implementation class to load:
 175    *
 176    * <ul>
 177    * <li>
 178    *   <p>Use the javax.xml.stream.XMLInputFactory system property.
 179    * </li>
 180    * <li>


 198    * <li>
 199    *   <p>Use the service-provider loading facility, defined by the
 200    *   {@link java.util.ServiceLoader} class, to attempt to locate and load an
 201    *   implementation of the service using the {@linkplain
 202    *   java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
 203    *   the service-provider loading facility will use the {@linkplain
 204    *   java.lang.Thread#getContextClassLoader() current thread's context class loader}
 205    *   to attempt to load the service. If the context class
 206    *   loader is null, the {@linkplain
 207    *   ClassLoader#getSystemClassLoader() system class loader} will be used.
 208    * </li>
 209    * <li>
 210    * <p>Otherwise, the {@linkplain #newDefaultFactory() system-default}
 211    *    implementation is returned.
 212    * </li>
 213    * </ul>
 214    * <p>
 215    *   Once an application has obtained a reference to a XMLInputFactory it
 216    *   can use the factory to configure and obtain stream instances.
 217    *
 218    * @return an instance of the {@code XMLInputFactory}
 219    * @throws FactoryConfigurationError in case of {@linkplain
 220    *   java.util.ServiceConfigurationError service configuration error} or if
 221    *   the implementation is not available or cannot be instantiated.
 222    */
 223   public static XMLInputFactory newFactory()
 224     throws FactoryConfigurationError
 225   {
 226     return FactoryFinder.find(XMLInputFactory.class, DEFAULIMPL);
 227   }
 228 
 229   /**
 230    * Create a new instance of the factory.
 231    *
 232    * @param factoryId             Name of the factory to find, same as
 233    *                              a property name
 234    * @param classLoader           classLoader to use
 235    * @return the factory implementation
 236    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 237    *
 238    * @deprecated  This method has been deprecated to maintain API consistency.
 239    *              All newInstance methods have been replaced with corresponding
 240    *              newFactory methods. The replacement {@link
 241    *              #newFactory(java.lang.String, java.lang.ClassLoader)} method
 242    *              defines no changes in behavior.
 243    */
 244   @Deprecated(since="1.7")
 245   public static XMLInputFactory newInstance(String factoryId,
 246           ClassLoader classLoader)
 247           throws FactoryConfigurationError {
 248       //do not fallback if given classloader can't find the class, throw exception
 249       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 250   }


 313    * of other JAXP factories where the first parameter is fully qualified
 314    * factory class name that provides implementation of the factory.
 315    *
 316    * @param factoryId             Name of the factory to find, same as
 317    *                              a property name
 318    * @param classLoader           classLoader to use
 319    * @return the factory implementation
 320    * @throws FactoryConfigurationError in case of {@linkplain
 321    *   java.util.ServiceConfigurationError service configuration error} or if
 322    *   the implementation is not available or cannot be instantiated.
 323    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
 324    */
 325   public static XMLInputFactory newFactory(String factoryId,
 326           ClassLoader classLoader)
 327           throws FactoryConfigurationError {
 328       //do not fallback if given classloader can't find the class, throw exception
 329       return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
 330   }
 331 
 332   /**
 333    * Create a new XMLStreamReader from a reader.
 334    * @param reader the XML data to read from
 335    * @return an instance of the {@code XMLStreamReader}
 336    * @throws XMLStreamException if an error occurs
 337    */
 338   public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
 339     throws XMLStreamException;
 340 
 341   /**
 342    * Create a new XMLStreamReader from a JAXP source.  This method is optional.
 343    * @param source the source to read from
 344    * @return an instance of the {@code XMLStreamReader}
 345    * @throws UnsupportedOperationException if this method is not
 346    * supported by this XMLInputFactory
 347    * @throws XMLStreamException if an error occurs
 348    */
 349   public abstract XMLStreamReader createXMLStreamReader(Source source)
 350     throws XMLStreamException;
 351 
 352   /**
 353    * Create a new XMLStreamReader from a java.io.InputStream.
 354    * @param stream the InputStream to read from
 355    * @return an instance of the {@code XMLStreamReader}
 356    * @throws XMLStreamException if an error occurs
 357    */
 358   public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
 359     throws XMLStreamException;
 360 
 361   /**
 362    * Create a new XMLStreamReader from a java.io.InputStream.
 363    * @param stream the InputStream to read from
 364    * @param encoding the character encoding of the stream
 365    * @return an instance of the {@code XMLStreamReader}
 366    * @throws XMLStreamException if an error occurs
 367    */
 368   public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream, String encoding)
 369     throws XMLStreamException;
 370 
 371   /**
 372    * Create a new XMLStreamReader from a java.io.InputStream.
 373    * @param systemId the system ID of the stream
 374    * @param stream the InputStream to read from
 375    * @return an instance of the {@code XMLStreamReader}
 376    * @throws XMLStreamException if an error occurs
 377    */
 378   public abstract XMLStreamReader createXMLStreamReader(String systemId, java.io.InputStream stream)
 379     throws XMLStreamException;
 380 
 381   /**
 382    * Create a new XMLStreamReader from a java.io.InputStream.
 383    * @param systemId the system ID of the stream
 384    * @param reader the InputStream to read from
 385    * @return an instance of the {@code XMLStreamReader}
 386    * @throws XMLStreamException if an error occurs
 387    */
 388   public abstract XMLStreamReader createXMLStreamReader(String systemId, java.io.Reader reader)
 389     throws XMLStreamException;
 390 
 391   /**
 392    * Create a new XMLEventReader from a reader.
 393    * @param reader the XML data to read from
 394    * @return an instance of the {@code XMLEventReader}
 395    * @throws XMLStreamException if an error occurs
 396    */
 397   public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
 398     throws XMLStreamException;
 399 
 400   /**
 401    * Create a new XMLEventReader from a reader.
 402    * @param systemId the system ID of the input
 403    * @param reader the XML data to read from
 404    * @return an instance of the {@code XMLEventReader}
 405    * @throws XMLStreamException if an error occurs
 406    */
 407   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.Reader reader)
 408     throws XMLStreamException;
 409 
 410   /**
 411    * Create a new XMLEventReader from an XMLStreamReader.  After being used
 412    * to construct the XMLEventReader instance returned from this method
 413    * the XMLStreamReader must not be used.
 414    * @param reader the XMLStreamReader to read from (may not be modified)
 415    * @return a new XMLEventReader
 416    * @throws XMLStreamException if an error occurs
 417    */
 418   public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader)
 419     throws XMLStreamException;
 420 
 421   /**
 422    * Create a new XMLEventReader from a JAXP source.
 423    * Support of this method is optional.
 424    * @param source the source to read from
 425    * @return an instance of the {@code XMLEventReader}
 426    * @throws XMLStreamException if an error occurs
 427    * @throws UnsupportedOperationException if this method is not
 428    * supported by this XMLInputFactory
 429    */
 430   public abstract XMLEventReader createXMLEventReader(Source source)
 431     throws XMLStreamException;
 432 
 433   /**
 434    * Create a new XMLEventReader from a java.io.InputStream
 435    * @param stream the InputStream to read from
 436    * @return an instance of the {@code XMLEventReader}
 437    * @throws XMLStreamException if an error occurs
 438    */
 439   public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream)
 440     throws XMLStreamException;
 441 
 442   /**
 443    * Create a new XMLEventReader from a java.io.InputStream
 444    * @param stream the InputStream to read from
 445    * @param encoding the character encoding of the stream
 446    * @return an instance of the {@code XMLEventReader}
 447    * @throws XMLStreamException if an error occurs
 448    */
 449   public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding)
 450     throws XMLStreamException;
 451 
 452   /**
 453    * Create a new XMLEventReader from a java.io.InputStream
 454    * @param systemId the system ID of the stream
 455    * @param stream the InputStream to read from
 456    * @return an instance of the {@code XMLEventReader}
 457    * @throws XMLStreamException if an error occurs
 458    */
 459   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.InputStream stream)
 460     throws XMLStreamException;
 461 
 462   /**
 463    * Create a filtered reader that wraps the filter around the reader
 464    * @param reader the reader to filter
 465    * @param filter the filter to apply to the reader
 466    * @return an instance of the {@code XMLEventReader}
 467    * @throws XMLStreamException if an error occurs
 468    */
 469   public abstract XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
 470     throws XMLStreamException;
 471 
 472   /**
 473    * Create a filtered event reader that wraps the filter around the event reader
 474    * @param reader the event reader to wrap
 475    * @param filter the filter to apply to the event reader
 476    * @return an instance of the {@code XMLEventReader}
 477    * @throws XMLStreamException if an error occurs
 478    */
 479   public abstract XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
 480     throws XMLStreamException;
 481 
 482   /**
 483    * The resolver that will be set on any XMLStreamReader or XMLEventReader created
 484    * by this factory instance.
 485    * @return an instance of the {@code XMLResolver}
 486    */
 487   public abstract XMLResolver getXMLResolver();
 488 
 489   /**
 490    * The resolver that will be set on any XMLStreamReader or XMLEventReader created
 491    * by this factory instance.
 492    * @param resolver the resolver to use to resolve references
 493    */
 494   public abstract void  setXMLResolver(XMLResolver resolver);
 495 
 496   /**
 497    * The reporter that will be set on any XMLStreamReader or XMLEventReader created
 498    * by this factory instance.
 499    * @return an instance of the {@code XMLReporter}
 500    */
 501   public abstract XMLReporter getXMLReporter();
 502 
 503   /**
 504    * The reporter that will be set on any XMLStreamReader or XMLEventReader created
 505    * by this factory instance.
 506    * @param reporter the resolver to use to report non fatal errors
 507    */
 508   public abstract void setXMLReporter(XMLReporter reporter);
 509 
 510   /**
 511    * Allows the user to set specific feature/property on the underlying
 512    * implementation. The underlying implementation is not required to support
 513    * every setting of every property in the specification and may use
 514    * IllegalArgumentException to signal that an unsupported property may not be
 515    * set with the specified value.
 516    * <p>
 517    * All implementations that implement JAXP 1.5 or newer are required to
 518    * support the {@link javax.xml.XMLConstants#ACCESS_EXTERNAL_DTD} property.
 519    * <ul>


 543   public abstract Object getProperty(java.lang.String name)
 544     throws java.lang.IllegalArgumentException;
 545 
 546 
 547   /**
 548    * Query the set of properties that this factory supports.
 549    *
 550    * @param name The name of the property (may not be null)
 551    * @return true if the property is supported and false otherwise
 552    */
 553   public abstract boolean isPropertySupported(String name);
 554 
 555   /**
 556    * Set a user defined event allocator for events
 557    * @param allocator the user defined allocator
 558    */
 559   public abstract void setEventAllocator(XMLEventAllocator allocator);
 560 
 561   /**
 562    * Gets the allocator used by streams created with this factory
 563    * @return an instance of the {@code XMLEventAllocator}
 564    */
 565   public abstract XMLEventAllocator getEventAllocator();
 566 
 567 }
< prev index next >