|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.axiom.om.util.StAXUtils
public class StAXUtils
Utility class containing StAX related methods.
This class defines a set of methods to get XMLStreamReader and XMLStreamWriter
instances. This class caches the corresponding factories (XMLInputFactory
and XMLOutputFactory objects) by classloader (default) or as singletons.
The behavior can be changed using setFactoryPerClassLoader(boolean).
Default properties for these factories can be specified using XMLInputFactory.properties and XMLOutputFactory.properties files. When a new factory is instantiated, this class will attempt to load the corresponding file using the context classloader. This class supports properties with boolean, integer and string values. Both standard StAX properties and implementation specific properties can be specified. This feature should be used with care since changing some properties to non default values will break Axiom. Good candidates for XMLInputFactory.properties are:
Good candidates for XMLOutputFactory.properties are:
| Constructor Summary | |
|---|---|
StAXUtils()
|
|
| Method Summary | |
|---|---|
static javax.xml.stream.XMLStreamReader |
createNetworkDetachedXMLStreamReader(java.io.InputStream in)
Deprecated. use createXMLStreamReader(StAXParserConfiguration, InputStream)
with StAXParserConfiguration.STANDALONE |
static javax.xml.stream.XMLStreamReader |
createNetworkDetachedXMLStreamReader(java.io.InputStream in,
java.lang.String encoding)
Deprecated. use createXMLStreamReader(StAXParserConfiguration, InputStream, String)
with StAXParserConfiguration.STANDALONE |
static javax.xml.stream.XMLStreamReader |
createNetworkDetachedXMLStreamReader(java.io.Reader in)
Deprecated. use createXMLStreamReader(StAXParserConfiguration, Reader)
with StAXParserConfiguration.STANDALONE |
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.InputStream in)
|
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.InputStream in,
java.lang.String encoding)
|
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.Reader in)
|
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(StAXParserConfiguration configuration,
java.io.InputStream in)
|
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(StAXParserConfiguration configuration,
java.io.InputStream in,
java.lang.String encoding)
|
static javax.xml.stream.XMLStreamReader |
createXMLStreamReader(StAXParserConfiguration configuration,
java.io.Reader in)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(java.io.OutputStream out)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(java.io.OutputStream out,
java.lang.String encoding)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.OutputStream out)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.OutputStream out,
java.lang.String encoding)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.Writer out)
|
static javax.xml.stream.XMLStreamWriter |
createXMLStreamWriter(java.io.Writer out)
|
static java.lang.String |
getEventTypeString(int event)
Deprecated. Use XMLEventUtils.getEventTypeString(int) instead |
static javax.xml.stream.XMLInputFactory |
getNetworkDetachedXMLInputFactory()
Deprecated. use getXMLInputFactory(StAXParserConfiguration) with
StAXParserConfiguration.STANDALONE |
static javax.xml.stream.XMLInputFactory |
getXMLInputFactory()
Get a cached XMLInputFactory instance using the default
configuration and cache policy (i.e. |
static javax.xml.stream.XMLInputFactory |
getXMLInputFactory(boolean factoryPerClassLoaderPolicy)
Get a cached XMLInputFactory instance using the default
configuration and the specified cache policy. |
static javax.xml.stream.XMLInputFactory |
getXMLInputFactory(StAXParserConfiguration configuration)
Get a cached XMLInputFactory instance using the specified
configuration and the default cache policy. |
static javax.xml.stream.XMLInputFactory |
getXMLInputFactory(StAXParserConfiguration configuration,
boolean factoryPerClassLoaderPolicy)
Get a cached XMLInputFactory instance using the specified
configuration and cache policy. |
static javax.xml.stream.XMLOutputFactory |
getXMLOutputFactory()
Get a cached XMLOutputFactory instance using the default
configuration and cache policy (i.e. |
static javax.xml.stream.XMLOutputFactory |
getXMLOutputFactory(boolean factoryPerClassLoaderPolicy)
Get a cached XMLOutputFactory instance using the default
configuration and the specified cache policy. |
static javax.xml.stream.XMLOutputFactory |
getXMLOutputFactory(StAXWriterConfiguration configuration)
Get a cached XMLOutputFactory instance using the specified
configuration and the default cache policy. |
static javax.xml.stream.XMLOutputFactory |
getXMLOutputFactory(StAXWriterConfiguration configuration,
boolean factoryPerClassLoaderPolicy)
Get a cached XMLOutputFactory instance using the specified
configuration and cache policy. |
static void |
releaseXMLInputFactory(javax.xml.stream.XMLInputFactory factory)
Deprecated. Returns an XMLInputFactory instance for reuse. |
static void |
releaseXMLOutputFactory(javax.xml.stream.XMLOutputFactory factory)
Deprecated. Returns an XMLOutputFactory instance for reuse. |
static void |
reset()
Deprecated. |
static void |
setFactoryPerClassLoader(boolean value)
Set the policy for how to maintain the XMLInputFactory and XMLOutputFactory |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StAXUtils()
| Method Detail |
|---|
public static javax.xml.stream.XMLInputFactory getXMLInputFactory()
XMLInputFactory instance using the default
configuration and cache policy (i.e. one instance per class loader).
XMLInputFactory instance.public static javax.xml.stream.XMLInputFactory getXMLInputFactory(StAXParserConfiguration configuration)
XMLInputFactory instance using the specified
configuration and the default cache policy.
configuration - the configuration applied to the requested factory
XMLInputFactory instance.public static javax.xml.stream.XMLInputFactory getXMLInputFactory(boolean factoryPerClassLoaderPolicy)
XMLInputFactory instance using the default
configuration and the specified cache policy.
factoryPerClassLoaderPolicy - the cache policy; see
getXMLInputFactory(StAXParserConfiguration, boolean)
for more details
XMLInputFactory instance.
public static javax.xml.stream.XMLInputFactory getXMLInputFactory(StAXParserConfiguration configuration,
boolean factoryPerClassLoaderPolicy)
XMLInputFactory instance using the specified
configuration and cache policy.
configuration - the configuration applied to the requested factoryfactoryPerClassLoaderPolicy - If set to true, the factory cached for the
current class loader will be returned. If set to
false, the singleton factory (instantiated using
the class loader that loaded StAXUtils) will be
returned.
XMLInputFactory instance.public static void releaseXMLInputFactory(javax.xml.stream.XMLInputFactory factory)
factory - An XMLInputFactory instance that is available for reuse
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in,
java.lang.String encoding)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration,
java.io.InputStream in,
java.lang.String encoding)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration,
java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.Reader in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createXMLStreamReader(StAXParserConfiguration configuration,
java.io.Reader in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic static javax.xml.stream.XMLOutputFactory getXMLOutputFactory()
XMLOutputFactory instance using the default
configuration and cache policy (i.e. one instance per class loader).
XMLOutputFactory instance.public static javax.xml.stream.XMLOutputFactory getXMLOutputFactory(StAXWriterConfiguration configuration)
XMLOutputFactory instance using the specified
configuration and the default cache policy.
configuration - the configuration applied to the requested factory
XMLOutputFactory instance.public static javax.xml.stream.XMLOutputFactory getXMLOutputFactory(boolean factoryPerClassLoaderPolicy)
XMLOutputFactory instance using the default
configuration and the specified cache policy.
factoryPerClassLoaderPolicy - the cache policy; see
getXMLOutputFactory(StAXWriterConfiguration, boolean)
for more details
XMLOutputFactory instance.
public static javax.xml.stream.XMLOutputFactory getXMLOutputFactory(StAXWriterConfiguration configuration,
boolean factoryPerClassLoaderPolicy)
XMLOutputFactory instance using the specified
configuration and cache policy.
configuration - the configuration applied to the requested factoryfactoryPerClassLoaderPolicy - If set to true, the factory cached for the
current class loader will be returned. If set to
false, the singleton factory (instantiated using
the class loader that loaded StAXUtils) will be
returned.
XMLOutputFactory instance.public static void setFactoryPerClassLoader(boolean value)
value - (if false, then one singleton...if true...then singleton per class loader
(default is true)public static void releaseXMLOutputFactory(javax.xml.stream.XMLOutputFactory factory)
factory - An XMLOutputFactory instance that is available for reuse.
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream out)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.OutputStream out)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream out,
java.lang.String encoding)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.OutputStream out,
java.lang.String encoding)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.Writer out)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamWriter createXMLStreamWriter(StAXWriterConfiguration configuration,
java.io.Writer out)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionpublic static void reset()
public static javax.xml.stream.XMLStreamReader createNetworkDetachedXMLStreamReader(java.io.InputStream in,
java.lang.String encoding)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader(StAXParserConfiguration, InputStream, String)
with StAXParserConfiguration.STANDALONE
javax.xml.stream.XMLStreamExceptionpublic static javax.xml.stream.XMLInputFactory getNetworkDetachedXMLInputFactory()
getXMLInputFactory(StAXParserConfiguration) with
StAXParserConfiguration.STANDALONE
public static javax.xml.stream.XMLStreamReader createNetworkDetachedXMLStreamReader(java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader(StAXParserConfiguration, InputStream)
with StAXParserConfiguration.STANDALONE
javax.xml.stream.XMLStreamException
public static javax.xml.stream.XMLStreamReader createNetworkDetachedXMLStreamReader(java.io.Reader in)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader(StAXParserConfiguration, Reader)
with StAXParserConfiguration.STANDALONE
javax.xml.stream.XMLStreamExceptionpublic static java.lang.String getEventTypeString(int event)
XMLEventUtils.getEventTypeString(int) instead
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||