|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.xml.stream.XMLInputFactory
org.codehaus.stax2.XMLInputFactory2
com.ctc.wstx.stax.WstxInputFactory
public final class WstxInputFactory
Factory for creating various StAX objects (stream/event reader, writer).
Currently supported configuration options fall into two categories. First,
all properties from XMLInputFactory (such as, say,
XMLInputFactory.IS_NAMESPACE_AWARE) are at least recognized, and
most are supported. Second, there are additional properties, defined in
constant class WstxInputProperties, that are supported.
See WstxInputProperties for further explanation of these 'custom'
properties.
TODO:
| Field Summary | |
|---|---|
protected javax.xml.stream.util.XMLEventAllocator |
mAllocator
|
protected ReaderConfig |
mConfig
Current configurations for this factory |
protected SimpleCache |
mDTDCache
|
| Fields inherited from class org.codehaus.stax2.XMLInputFactory2 |
|---|
P_AUTO_CLOSE_INPUT, P_INTERN_NAMES, P_INTERN_NS_URIS, P_PRESERVE_LOCATION, P_REPORT_CDATA, P_REPORT_PROLOG_WHITESPACE |
| Fields inherited from class javax.xml.stream.XMLInputFactory |
|---|
ALLOCATOR, IS_COALESCING, IS_NAMESPACE_AWARE, IS_REPLACING_ENTITY_REFERENCES, IS_SUPPORTING_EXTERNAL_ENTITIES, IS_VALIDATING, REPORTER, RESOLVER, SUPPORT_DTD |
| Fields inherited from interface org.codehaus.stax2.XMLStreamProperties |
|---|
XSP_IMPLEMENTATION_NAME, XSP_IMPLEMENTATION_VERSION, XSP_NAMESPACE_AWARE, XSP_PROBLEM_REPORTER, XSP_SUPPORT_XMLID, XSP_SUPPORTS_XML11, XSP_V_XMLID_FULL, XSP_V_XMLID_NONE, XSP_V_XMLID_TYPING |
| Constructor Summary | |
|---|---|
WstxInputFactory()
|
|
| Method Summary | |
|---|---|
void |
addCachedDTD(DTDId id,
DTDSubset extSubset)
|
void |
configureForConvenience()
Method to call to make Reader created be as "convenient" to use as possible; ie try to avoid having to deal with some of things like segmented text chunks. |
void |
configureForLowMemUsage()
Method to call to minimize the memory usage of the stream/event reader; both regarding Objects created, and the temporary memory usage during parsing. |
void |
configureForRoundTripping()
Method to call to make Reader try to preserve as much of input formatting as possible, so that round-tripping would be as lossless as possible. |
void |
configureForSpeed()
Method to call to make the Reader created be as fast as possible reading documents, especially for long-running processes where caching is likely to help. |
void |
configureForXmlConformance()
Method to call to make Reader created conform as closely to XML standard as possible, doing all checks and transformations mandated by the XML specification (linefeed conversions, attr value normalizations). |
protected javax.xml.stream.util.XMLEventAllocator |
createEventAllocator()
|
javax.xml.stream.XMLEventReader |
createFilteredReader(javax.xml.stream.XMLEventReader reader,
javax.xml.stream.EventFilter filter)
|
javax.xml.stream.XMLStreamReader |
createFilteredReader(javax.xml.stream.XMLStreamReader reader,
javax.xml.stream.StreamFilter filter)
|
ReaderConfig |
createPrivateConfig()
Method called to construct a copy of the factory's configuration object, such that two will be unlinked (changes to one are not reflect in the other). |
protected XMLStreamReader2 |
createSR(java.io.File f,
boolean forER,
boolean autoCloseInput)
|
XMLStreamReader2 |
createSR(ReaderConfig cfg,
java.lang.String systemId,
InputBootstrapper bs,
boolean forER,
boolean autoCloseInput)
Method that is eventually called to create a (full) stream read instance. |
protected XMLStreamReader2 |
createSR(ReaderConfig cfg,
java.net.URL src,
boolean forER,
boolean autoCloseInput)
|
protected XMLStreamReader2 |
createSR(javax.xml.transform.Source src,
boolean forER)
Another internal factory method, used when dealing with a generic Source base type. |
protected XMLStreamReader2 |
createSR(java.lang.String systemId,
java.io.InputStream in,
java.lang.String enc,
boolean forER,
boolean autoCloseInput)
|
protected XMLStreamReader2 |
createSR(java.lang.String systemId,
java.io.Reader r,
boolean forER,
boolean autoCloseInput)
|
XMLEventReader2 |
createXMLEventReader(java.io.File f)
Convenience factory method that allows for parsing a document stored in the specified file. |
javax.xml.stream.XMLEventReader |
createXMLEventReader(java.io.InputStream in)
|
javax.xml.stream.XMLEventReader |
createXMLEventReader(java.io.InputStream in,
java.lang.String enc)
|
javax.xml.stream.XMLEventReader |
createXMLEventReader(java.io.Reader r)
|
javax.xml.stream.XMLEventReader |
createXMLEventReader(javax.xml.transform.Source source)
|
javax.xml.stream.XMLEventReader |
createXMLEventReader(java.lang.String systemId,
java.io.InputStream in)
|
javax.xml.stream.XMLEventReader |
createXMLEventReader(java.lang.String systemId,
java.io.Reader r)
|
XMLEventReader2 |
createXMLEventReader(java.net.URL src)
Factory method that allows for parsing a document accessible via specified URL. |
javax.xml.stream.XMLEventReader |
createXMLEventReader(javax.xml.stream.XMLStreamReader sr)
|
XMLStreamReader2 |
createXMLStreamReader(java.io.File f)
Convenience factory method that allows for parsing a document stored in the specified file. |
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.InputStream in)
|
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.InputStream in,
java.lang.String enc)
|
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.io.Reader r)
|
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(javax.xml.transform.Source src)
|
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.lang.String systemId,
java.io.InputStream in)
|
javax.xml.stream.XMLStreamReader |
createXMLStreamReader(java.lang.String systemId,
java.io.Reader r)
|
XMLStreamReader2 |
createXMLStreamReader(java.net.URL src)
Factory method that allows for parsing a document accessible via specified URL. |
DTDSubset |
findCachedDTD(DTDId id)
Method readers created by this factory call, if DTD caching is enabled, to see if an external DTD (subset) has been parsed and cached earlier. |
ReaderConfig |
getConfig()
|
javax.xml.stream.util.XMLEventAllocator |
getEventAllocator()
|
java.lang.Object |
getProperty(java.lang.String name)
|
javax.xml.stream.XMLReporter |
getXMLReporter()
|
javax.xml.stream.XMLResolver |
getXMLResolver()
|
boolean |
isPropertySupported(java.lang.String name)
|
void |
setEventAllocator(javax.xml.stream.util.XMLEventAllocator allocator)
|
void |
setProperty(java.lang.String propName,
java.lang.Object value)
|
void |
setXMLReporter(javax.xml.stream.XMLReporter r)
|
void |
setXMLResolver(javax.xml.stream.XMLResolver r)
Note: it's preferable to use Wstx-specific ReaderConfig.setEntityResolver(javax.xml.stream.XMLResolver)
instead, if possible, since this just wraps passed in resolver. |
void |
updateSymbolTable(SymbolTable t)
Method individual parsers call to pass back symbol table that they updated, which may be useful for other parser to reuse, instead of previous base symbol table. |
| Methods inherited from class javax.xml.stream.XMLInputFactory |
|---|
newInstance, newInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final ReaderConfig mConfig
protected javax.xml.stream.util.XMLEventAllocator mAllocator
protected SimpleCache mDTDCache
| Constructor Detail |
|---|
public WstxInputFactory()
| Method Detail |
|---|
public DTDSubset findCachedDTD(DTDId id)
findCachedDTD in interface ReaderCreatorpublic void updateSymbolTable(SymbolTable t)
Note: parser is only to call this method, if passed-in symbol table was modified, ie new entry/ies were added in addition to whatever was in root table.
updateSymbolTable in interface ReaderCreator
public void addCachedDTD(DTDId id,
DTDSubset extSubset)
addCachedDTD in interface ReaderCreator
public javax.xml.stream.XMLEventReader createFilteredReader(javax.xml.stream.XMLEventReader reader,
javax.xml.stream.EventFilter filter)
createFilteredReader in class javax.xml.stream.XMLInputFactory
public javax.xml.stream.XMLStreamReader createFilteredReader(javax.xml.stream.XMLStreamReader reader,
javax.xml.stream.StreamFilter filter)
throws javax.xml.stream.XMLStreamException
createFilteredReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.io.InputStream in,
java.lang.String enc)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.io.Reader r)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(javax.xml.transform.Source source)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.lang.String systemId,
java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.lang.String systemId,
java.io.Reader r)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(javax.xml.stream.XMLStreamReader sr)
throws javax.xml.stream.XMLStreamException
createXMLEventReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in,
java.lang.String enc)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.Reader r)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(javax.xml.transform.Source src)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.lang.String systemId,
java.io.InputStream in)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.lang.String systemId,
java.io.Reader r)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class javax.xml.stream.XMLInputFactoryjavax.xml.stream.XMLStreamExceptionpublic java.lang.Object getProperty(java.lang.String name)
getProperty in class javax.xml.stream.XMLInputFactory
public void setProperty(java.lang.String propName,
java.lang.Object value)
setProperty in class javax.xml.stream.XMLInputFactorypublic javax.xml.stream.util.XMLEventAllocator getEventAllocator()
getEventAllocator in class javax.xml.stream.XMLInputFactorypublic javax.xml.stream.XMLReporter getXMLReporter()
getXMLReporter in class javax.xml.stream.XMLInputFactorypublic javax.xml.stream.XMLResolver getXMLResolver()
getXMLResolver in class javax.xml.stream.XMLInputFactorypublic boolean isPropertySupported(java.lang.String name)
isPropertySupported in class javax.xml.stream.XMLInputFactorypublic void setEventAllocator(javax.xml.stream.util.XMLEventAllocator allocator)
setEventAllocator in class javax.xml.stream.XMLInputFactorypublic void setXMLReporter(javax.xml.stream.XMLReporter r)
setXMLReporter in class javax.xml.stream.XMLInputFactorypublic void setXMLResolver(javax.xml.stream.XMLResolver r)
ReaderConfig.setEntityResolver(javax.xml.stream.XMLResolver)
instead, if possible, since this just wraps passed in resolver.
setXMLResolver in class javax.xml.stream.XMLInputFactory
public XMLEventReader2 createXMLEventReader(java.net.URL src)
throws javax.xml.stream.XMLStreamException
XMLInputFactory2
createXMLEventReader in class XMLInputFactory2javax.xml.stream.XMLStreamException
public XMLEventReader2 createXMLEventReader(java.io.File f)
throws javax.xml.stream.XMLStreamException
XMLInputFactory2
createXMLEventReader in class XMLInputFactory2javax.xml.stream.XMLStreamException
public XMLStreamReader2 createXMLStreamReader(java.net.URL src)
throws javax.xml.stream.XMLStreamException
XMLInputFactory2
createXMLStreamReader in class XMLInputFactory2javax.xml.stream.XMLStreamException
public XMLStreamReader2 createXMLStreamReader(java.io.File f)
throws javax.xml.stream.XMLStreamException
createXMLStreamReader in class XMLInputFactory2javax.xml.stream.XMLStreamExceptionpublic void configureForXmlConformance()
XMLInputFactory2Regarding the default StAX property settings, implementations are suggested to do following:
SUPPORT_DTD property.
IS_NAMESPACE_AWARE
IS_REPLACING_ENTITY_REFERENCES
IS_SUPPORTING_EXTERNAL_ENTITIES
In addition, implementations should set implementation-dependant settings appropriately, to be as strict as possible with regards to XML specification mandated checks and transformations.
configureForXmlConformance in class XMLInputFactory2public void configureForConvenience()
XMLInputFactory2Regarding the default StAX property settings, implementations are suggested to do following:
IS_COALESCING (text coalescing)
IS_REPLACING_ENTITY_REFERENCES
P_REPORT_PROLOG_WHITESPACE (StAX2); so
that the application need not skip possible SPACE
(and COMMENT, PROCESSING_INSTRUCTION)
events.
P_REPORT_ALL_TEXT_AS_CHARACTERS (StAX2)
P_PRESERVE_LOCATION (StAX2)
In addition, implementations should set implementation-dependant settings appropriately as well.
configureForConvenience in class XMLInputFactory2public void configureForSpeed()
XMLInputFactory2Regarding the default StAX property settings, implementations are suggested to do following:
IS_COALESCING (text coalescing)
P_PRESERVE_LOCATION (StAX2)
P_REPORT_PROLOG_WHITESPACE (StAX2)
P_INTERN_NAMES (StAX2)
P_INTERN_NS_URIS (StAX2)
In addition, implementations should set implementation-dependant settings appropriately as well.
configureForSpeed in class XMLInputFactory2public void configureForLowMemUsage()
XMLInputFactory2Regarding the default StAX property settings, implementations are suggested to do following:
IS_COALECING (text coalescing, can force
longer internal result buffers to be used)
P_PRESERVE_LOCATION (StAX) to reduce
temporary memory usage.
In addition, implementations should set implementation-dependant settings appropriately so that the memory usage is minimized.
configureForLowMemUsage in class XMLInputFactory2public void configureForRoundTripping()
XMLInputFactory2Regarding the default StAX property settings, implementations are suggested to do following:
IS_COALESCING (to prevent CDATA and Text
segments from getting combined)
IS_REPLACING_ENTITY_REFERENCES to allow for
preserving explicitly declared general entity references (that is,
there is no way to preserve character entities, or pre-defined
entities like 'gt', 'lt', 'amp', 'apos' and 'quot').
P_REPORT_ALL_TEXT_AS_CHARACTERS (StAX2)
(so that CDATA sections are not reported as 'normal' text)
P_REPORT_PROLOG_WHITESPACE (StAX2)
In addition, implementations should set implementation-dependant settings appropriately as well.
configureForRoundTripping in class XMLInputFactory2public ReaderConfig getConfig()
public XMLStreamReader2 createSR(ReaderConfig cfg,
java.lang.String systemId,
InputBootstrapper bs,
boolean forER,
boolean autoCloseInput)
throws javax.xml.stream.XMLStreamException
Note: defined as public method because it needs to be called by SAX implementation.
systemId - System id used for this reader (if any)bs - Bootstrapper to use for creating actual underlying
physical readerforER - Flag to indicate whether it will be used via
Event API (will affect some configuration settings), true if it
will be, false if not (or not known)autoCloseInput - Whether the underlying input source should be
actually closed when encountering EOF, or when close()
is called. Will be true for input sources that are automatically
managed by stream reader (input streams created for
URL and File arguments, or when
configuration settings indicate auto-closing is to be enabled
(the default value is false as per Stax 1.0 specs).
javax.xml.stream.XMLStreamException
protected XMLStreamReader2 createSR(java.lang.String systemId,
java.io.InputStream in,
java.lang.String enc,
boolean forER,
boolean autoCloseInput)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected XMLStreamReader2 createSR(ReaderConfig cfg,
java.net.URL src,
boolean forER,
boolean autoCloseInput)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected XMLStreamReader2 createSR(java.lang.String systemId,
java.io.Reader r,
boolean forER,
boolean autoCloseInput)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected XMLStreamReader2 createSR(java.io.File f,
boolean forER,
boolean autoCloseInput)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected XMLStreamReader2 createSR(javax.xml.transform.Source src,
boolean forER)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected javax.xml.stream.util.XMLEventAllocator createEventAllocator()
public ReaderConfig createPrivateConfig()
Note: only public so that other woodstox components outside of this package can access it.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||