public class WstxInputFactory extends org.codehaus.stax2.XMLInputFactory2 implements ReaderCreator, InputConfigFlags
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.
Modifier and Type | Field and Description |
---|---|
protected javax.xml.stream.util.XMLEventAllocator |
mAllocator |
(package private) static int |
MAX_SYMBOL_TABLE_GENERATIONS
Number of generations should not matter as much as raw
size...
|
(package private) static int |
MAX_SYMBOL_TABLE_SIZE
Let's limit max size to 3/4 of 16k, since this corresponds
to 64k main hash index.
|
protected ReaderConfig |
mConfig
Current configurations for this factory
|
protected SimpleCache<DTDId,DTDSubset> |
mDTDCache |
(package private) static SymbolTable |
mRootSymbols
'Root' symbol table, used for creating actual symbol table instances,
but never as is.
|
private SymbolTable |
mSymbols
Actual current 'parent' symbol table; concrete instances will be
created from this instance using
makeChild method |
P_AUTO_CLOSE_INPUT, P_DTD_OVERRIDE, P_INTERN_NAMES, P_INTERN_NS_URIS, P_LAZY_PARSING, P_PRESERVE_LOCATION, P_REPORT_CDATA, P_REPORT_PROLOG_WHITESPACE
ALLOCATOR, IS_COALESCING, IS_NAMESPACE_AWARE, IS_REPLACING_ENTITY_REFERENCES, IS_SUPPORTING_EXTERNAL_ENTITIES, IS_VALIDATING, REPORTER, RESOLVER, SUPPORT_DTD
CFG_ALLOW_XML11_ESCAPED_CHARS_IN_XML10, CFG_AUTO_CLOSE_INPUT, CFG_CACHE_DTDS, CFG_CACHE_DTDS_BY_PUBLIC_ID, CFG_COALESCE_TEXT, CFG_INTERN_NAMES, CFG_INTERN_NS_URIS, CFG_JAXP_FEATURE_SECURE_PROCESSING, CFG_LAZY_PARSING, CFG_NAMESPACE_AWARE, CFG_NORMALIZE_LFS, CFG_PRESERVE_LOCATION, CFG_REPLACE_ENTITY_REFS, CFG_REPORT_CDATA, CFG_REPORT_PROLOG_WS, CFG_SUPPORT_DTD, CFG_SUPPORT_DTDPP, CFG_SUPPORT_EXTERNAL_ENTITIES, CFG_TREAT_CHAR_REFS_AS_ENTS, CFG_VALIDATE_AGAINST_DTD, CFG_XMLID_TYPING, CFG_XMLID_UNIQ_CHECKS
Constructor and Description |
---|
WstxInputFactory() |
Modifier and Type | Method and Description |
---|---|
void |
addCachedDTD(DTDId id,
DTDSubset extSubset) |
void |
addSymbol(java.lang.String symbol)
Method that can be used to ensure that specified symbol is
contained in the shared symbol table.
|
void |
configureForConvenience() |
void |
configureForLowMemUsage() |
void |
configureForRoundTripping() |
void |
configureForSpeed() |
void |
configureForXmlConformance() |
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 org.codehaus.stax2.XMLStreamReader2 |
createSR(java.io.File f,
boolean forER,
boolean autoCloseInput) |
org.codehaus.stax2.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.
|
org.codehaus.stax2.XMLStreamReader2 |
createSR(ReaderConfig cfg,
SystemId systemId,
InputBootstrapper bs,
boolean forER,
boolean autoCloseInput) |
private org.codehaus.stax2.XMLStreamReader2 |
createSR(ReaderConfig cfg,
SystemId systemId,
java.io.InputStream in,
boolean forER,
boolean autoCloseInput) |
protected org.codehaus.stax2.XMLStreamReader2 |
createSR(ReaderConfig cfg,
java.net.URL src,
boolean forER,
boolean autoCloseInput) |
protected org.codehaus.stax2.XMLStreamReader2 |
createSR(javax.xml.transform.Source src,
boolean forER)
Another internal factory method, used when dealing with a generic
Source base type.
|
protected org.codehaus.stax2.XMLStreamReader2 |
createSR(SystemId systemId,
java.io.InputStream in,
java.lang.String enc,
boolean forER,
boolean autoCloseInput) |
protected org.codehaus.stax2.XMLStreamReader2 |
createSR(SystemId systemId,
java.io.Reader r,
boolean forER,
boolean autoCloseInput) |
org.codehaus.stax2.XMLEventReader2 |
createXMLEventReader(java.io.File f) |
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) |
org.codehaus.stax2.XMLEventReader2 |
createXMLEventReader(java.net.URL src) |
javax.xml.stream.XMLEventReader |
createXMLEventReader(javax.xml.stream.XMLStreamReader sr) |
org.codehaus.stax2.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) |
org.codehaus.stax2.XMLStreamReader2 |
createXMLStreamReader(java.net.URL src) |
private org.codehaus.stax2.XMLStreamReader2 |
doCreateSR(ReaderConfig cfg,
SystemId systemId,
InputBootstrapper bs,
boolean forER,
boolean autoCloseInput)
Bottleneck method used for creating ALL full stream reader instances
(via other createSR() methods and directly)
|
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.
|
static final int MAX_SYMBOL_TABLE_SIZE
static final int MAX_SYMBOL_TABLE_GENERATIONS
protected final ReaderConfig mConfig
protected javax.xml.stream.util.XMLEventAllocator mAllocator
protected SimpleCache<DTDId,DTDSubset> mDTDCache
static final SymbolTable mRootSymbols
private SymbolTable mSymbols
makeChild
methodpublic void addSymbol(java.lang.String symbol)
public DTDSubset findCachedDTD(DTDId id)
findCachedDTD
in interface ReaderCreator
public 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.XMLInputFactory
javax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.io.InputStream in) throws javax.xml.stream.XMLStreamException
createXMLEventReader
in class javax.xml.stream.XMLInputFactory
javax.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.XMLInputFactory
javax.xml.stream.XMLStreamException
public javax.xml.stream.XMLEventReader createXMLEventReader(java.io.Reader r) throws javax.xml.stream.XMLStreamException
createXMLEventReader
in class javax.xml.stream.XMLInputFactory
javax.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.XMLInputFactory
javax.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.XMLInputFactory
javax.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.XMLInputFactory
javax.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.XMLInputFactory
javax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in) throws javax.xml.stream.XMLStreamException
createXMLStreamReader
in class javax.xml.stream.XMLInputFactory
javax.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.XMLInputFactory
javax.xml.stream.XMLStreamException
public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.Reader r) throws javax.xml.stream.XMLStreamException
createXMLStreamReader
in class javax.xml.stream.XMLInputFactory
javax.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.XMLInputFactory
javax.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.XMLInputFactory
javax.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.XMLInputFactory
javax.xml.stream.XMLStreamException
public 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.XMLInputFactory
public javax.xml.stream.util.XMLEventAllocator getEventAllocator()
getEventAllocator
in class javax.xml.stream.XMLInputFactory
public javax.xml.stream.XMLReporter getXMLReporter()
getXMLReporter
in class javax.xml.stream.XMLInputFactory
public javax.xml.stream.XMLResolver getXMLResolver()
getXMLResolver
in class javax.xml.stream.XMLInputFactory
public boolean isPropertySupported(java.lang.String name)
isPropertySupported
in class javax.xml.stream.XMLInputFactory
public void setEventAllocator(javax.xml.stream.util.XMLEventAllocator allocator)
setEventAllocator
in class javax.xml.stream.XMLInputFactory
public void setXMLReporter(javax.xml.stream.XMLReporter r)
setXMLReporter
in class javax.xml.stream.XMLInputFactory
public 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 org.codehaus.stax2.XMLEventReader2 createXMLEventReader(java.net.URL src) throws javax.xml.stream.XMLStreamException
createXMLEventReader
in class org.codehaus.stax2.XMLInputFactory2
javax.xml.stream.XMLStreamException
public org.codehaus.stax2.XMLEventReader2 createXMLEventReader(java.io.File f) throws javax.xml.stream.XMLStreamException
createXMLEventReader
in class org.codehaus.stax2.XMLInputFactory2
javax.xml.stream.XMLStreamException
public org.codehaus.stax2.XMLStreamReader2 createXMLStreamReader(java.net.URL src) throws javax.xml.stream.XMLStreamException
createXMLStreamReader
in class org.codehaus.stax2.XMLInputFactory2
javax.xml.stream.XMLStreamException
public org.codehaus.stax2.XMLStreamReader2 createXMLStreamReader(java.io.File f) throws javax.xml.stream.XMLStreamException
createXMLStreamReader
in class org.codehaus.stax2.XMLInputFactory2
javax.xml.stream.XMLStreamException
public void configureForXmlConformance()
configureForXmlConformance
in class org.codehaus.stax2.XMLInputFactory2
public void configureForConvenience()
configureForConvenience
in class org.codehaus.stax2.XMLInputFactory2
public void configureForSpeed()
configureForSpeed
in class org.codehaus.stax2.XMLInputFactory2
public void configureForLowMemUsage()
configureForLowMemUsage
in class org.codehaus.stax2.XMLInputFactory2
public void configureForRoundTripping()
configureForRoundTripping
in class org.codehaus.stax2.XMLInputFactory2
public ReaderConfig getConfig()
private org.codehaus.stax2.XMLStreamReader2 doCreateSR(ReaderConfig cfg, SystemId systemId, InputBootstrapper bs, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
forER
- True, if the reader is being constructed to be used
by an event reader; false if it is not (or the purpose is 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
public org.codehaus.stax2.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
public org.codehaus.stax2.XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, InputBootstrapper bs, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected org.codehaus.stax2.XMLStreamReader2 createSR(SystemId systemId, java.io.InputStream in, java.lang.String enc, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected org.codehaus.stax2.XMLStreamReader2 createSR(ReaderConfig cfg, java.net.URL src, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private org.codehaus.stax2.XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, java.io.InputStream in, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected org.codehaus.stax2.XMLStreamReader2 createSR(SystemId systemId, java.io.Reader r, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected org.codehaus.stax2.XMLStreamReader2 createSR(java.io.File f, boolean forER, boolean autoCloseInput) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected org.codehaus.stax2.XMLStreamReader2 createSR(javax.xml.transform.Source src, boolean forER) throws javax.xml.stream.XMLStreamException
forER
- True, if the reader is being constructed to be used
by an event reader; false if it is not (or the purpose is not known)javax.xml.stream.XMLStreamException
protected javax.xml.stream.util.XMLEventAllocator createEventAllocator()
public ReaderConfig createPrivateConfig()
Note: only public so that other woodstox components outside of this package can access it.