com.ctc.wstx.stax
Class MinimalInputFactory

java.lang.Object
  extended by com.ctc.wstx.stax.MinimalInputFactory
All Implemented Interfaces:
InputConfigFlags, ReaderCreator

public class MinimalInputFactory
extends java.lang.Object
implements ReaderCreator, InputConfigFlags

Minimalistic input factory, which implements just the basic XML parsing functionality, including namespace handling. It does not support any DTD handling beyond simple skipping of internal subset; it also does not implement the Event API part of StAX specs. It is intended as the smallest valid (J2ME) subset of StAX as suggested by the specs.

Unfortunately, the way StAX 1.0 is defined, this class can NOT be the base class of the full input factory, without getting references to most of StAX event classes. It does however have lots of shared (cut'n pasted code) with WstxInputFactory. Hopefully in future this problem can be resolved.

Regarding Stax2 extensions: they are not included either (since just like stax 1.0, it does have event API extensions) in this minimal subset.

Implementation note: since entity objects are built directly on top of StAX events Objects, couple of event classes (specifically, EntityDeclaration and the generic base class, XMLEvent, and Woodstox classes that implement them) will still need to be included in the subset.


Field Summary
protected  ReaderConfig mConfig
           
protected  boolean mIsMinimal
          Flag used to distinguish "real" minimal implementations and extending non-minimal ones
 
Fields inherited from interface com.ctc.wstx.cfg.InputConfigFlags
CFG_AUTO_CLOSE_INPUT, CFG_CACHE_DTDS, CFG_CACHE_DTDS_BY_PUBLIC_ID, CFG_COALESCE_TEXT, CFG_INTERN_NS_URIS, CFG_LAZY_PARSING, CFG_NAMESPACE_AWARE, CFG_NORMALIZE_ATTR_VALUES, 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_VALIDATE_AGAINST_DTD, CFG_VALIDATE_TEXT_CHARS, CFG_XMLID_TYPING, CFG_XMLID_UNIQ_CHECKS
 
Constructor Summary
  MinimalInputFactory()
           
protected MinimalInputFactory(boolean minimal)
           
 
Method Summary
 void addCachedDTD(DTDId id, DTDSubset extSubset)
           
 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 source)
           
 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)
           
protected  javax.xml.stream.XMLStreamReader doCreateSR(BranchingReaderSource input, ReaderConfig cfg, InputBootstrapper bs)
           
 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()
           
 java.lang.Object getProperty(java.lang.String name)
           
 javax.xml.stream.XMLReporter getXMLReporter()
           
 javax.xml.stream.XMLResolver getXMLResolver()
           
 boolean isPropertySupported(java.lang.String name)
           
static MinimalInputFactory newMinimalInstance()
          Need to add this method, since we have no base class to do it...
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mIsMinimal

protected final boolean mIsMinimal
Flag used to distinguish "real" minimal implementations and extending non-minimal ones


mConfig

protected final ReaderConfig mConfig
Constructor Detail

MinimalInputFactory

public MinimalInputFactory()

MinimalInputFactory

protected MinimalInputFactory(boolean minimal)
Method Detail

newMinimalInstance

public static MinimalInputFactory newMinimalInstance()
Need to add this method, since we have no base class to do it...


findCachedDTD

public 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.

Specified by:
findCachedDTD in interface ReaderCreator

updateSymbolTable

public 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.

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.

Specified by:
updateSymbolTable in interface ReaderCreator

addCachedDTD

public void addCachedDTD(DTDId id,
                         DTDSubset extSubset)
Specified by:
addCachedDTD in interface ReaderCreator

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.InputStream in,
                                                              java.lang.String enc)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.io.Reader r)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(javax.xml.transform.Source source)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                              java.io.InputStream in)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

createXMLStreamReader

public javax.xml.stream.XMLStreamReader createXMLStreamReader(java.lang.String systemId,
                                                              java.io.Reader r)
                                                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getProperty

public java.lang.Object getProperty(java.lang.String name)

setProperty

public void setProperty(java.lang.String propName,
                        java.lang.Object value)

getXMLReporter

public javax.xml.stream.XMLReporter getXMLReporter()

getXMLResolver

public javax.xml.stream.XMLResolver getXMLResolver()

isPropertySupported

public boolean isPropertySupported(java.lang.String name)

setXMLReporter

public void setXMLReporter(javax.xml.stream.XMLReporter r)

setXMLResolver

public 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.


getConfig

public ReaderConfig getConfig()

doCreateSR

protected javax.xml.stream.XMLStreamReader doCreateSR(BranchingReaderSource input,
                                                      ReaderConfig cfg,
                                                      InputBootstrapper bs)
                                               throws java.io.IOException,
                                                      javax.xml.stream.XMLStreamException
Throws:
java.io.IOException
javax.xml.stream.XMLStreamException