com.ctc.wstx.sr
Class FullStreamReader

java.lang.Object
  extended bycom.ctc.wstx.io.WstxInputData
      extended bycom.ctc.wstx.sr.StreamScanner
          extended bycom.ctc.wstx.sr.WstxStreamReader
              extended bycom.ctc.wstx.sr.FullStreamReader
All Implemented Interfaces:
DTDInfo, InputConfigFlags, InputProblemReporter, LocationInfo, ParsingErrorMsgs, StreamReaderImpl, javax.xml.stream.XMLStreamConstants, javax.xml.stream.XMLStreamReader, XMLStreamReader2

public class FullStreamReader
extends WstxStreamReader

Implementation of XMLStreamReader that builds on WstxStreamReader, but adds full DTD-handling, including DTD validation


Field Summary
 
Fields inherited from class com.ctc.wstx.sr.WstxStreamReader
DEFAULT_NS_PREFIX, mAttrCollector, mCfgCoalesceText, mCfgLazyParsing, mCfgNormalizeAttrs, mCfgNormalizeLFs, mCfgReplaceEntities, mCfgReportTextAsChars, mConfigFlags, mCurrEntity, mCurrToken, mDocStandalone, mDtdPublicId, mDtdSystemId, mElementStack, mGeneralEntities, mOwner, mShortestTextSegment, mStDoctypeFound, mStEmptyElem, mStTextThreshold, mTokenState, mVldContent, sPrefixXml, sPrefixXmlns
 
Fields inherited from class com.ctc.wstx.sr.StreamScanner
CHAR_CR_LF_OR_NULL, CHAR_FIRST_PURE_TEXT, CHAR_LOWEST_LEGAL_LOCALNAME_CHAR, INT_CR_LF_OR_NULL, mCfgNsEnabled, mConfig, mInput, mNameBuffer, mReporter, mRootInput, mTextBuffer, mTokenInputCol, mTokenInputRow, mTokenInputTotal
 
Fields inherited from class com.ctc.wstx.io.WstxInputData
CHAR_NULL, CHAR_SPACE, INT_NULL, INT_SPACE, MAX_UNICODE_CHAR, mCurrInputProcessed, mCurrInputRow, mCurrInputRowStart, mInputBuffer, mInputLen, mInputPtr
 
Fields inherited from interface org.codehaus.stax2.XMLStreamReader2
FEATURE_DTD_OVERRIDE
 
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
 
Fields inherited from interface com.ctc.wstx.cfg.InputConfigFlags
CFG_CACHE_DTDS, 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_ALL_TEXT_AS_CHARACTERS, CFG_REPORT_PROLOG_WS, CFG_SUPPORT_DTD, CFG_SUPPORT_DTDPP, CFG_SUPPORT_EXTERNAL_ENTITIES, CFG_VALIDATE_AGAINST_DTD, CFG_VALIDATE_TEXT_CHARS, CONTENT_ALLOW_DTD_ANY, CONTENT_ALLOW_MIXED, CONTENT_ALLOW_NON_MIXED, CONTENT_ALLOW_NONE, CONTENT_ALLOW_UNDEFINED
 
Fields inherited from interface com.ctc.wstx.cfg.ParsingErrorMsgs
SUFFIX_EOF_EXP_NAME, SUFFIX_IN_ATTR_VALUE, SUFFIX_IN_CDATA, SUFFIX_IN_CLOSE_ELEMENT, SUFFIX_IN_COMMENT, SUFFIX_IN_DEF_ATTR_VALUE, SUFFIX_IN_DOC, SUFFIX_IN_DTD, SUFFIX_IN_DTD_EXTERNAL, SUFFIX_IN_DTD_INTERNAL, SUFFIX_IN_ELEMENT, SUFFIX_IN_ENTITY_REF, SUFFIX_IN_EPILOG, SUFFIX_IN_NAME, SUFFIX_IN_PROC_INSTR, SUFFIX_IN_PROLOG, SUFFIX_IN_TEXT, SUFFIX_IN_XML_DECL
 
Method Summary
protected  DTDId constructDtdId(java.lang.String pubId, java.lang.String sysId)
           
protected  DTDId constructDtdId(java.net.URL sysId)
           
static FullStreamReader createFullStreamReader(BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputBootstrapper bs)
          Factory method for constructing readers.
protected  void finishDTD(boolean copyContents)
          This method gets called to handle remainder of DOCTYPE declaration, essentially the optional internal subset.
 java.lang.Object getProcessedDTD()
           Note: DTD-handling sub-classes need to override this method.
 java.lang.Object getProperty(java.lang.String name)
           
protected  void reportInvalidContent(int evtType)
          Method called by lower-level parsing code when invalid content (anything inside element with 'empty' content spec; text inside non-mixed element etc) is found during basic scanning.
 void setFeature(java.lang.String name, java.lang.Object value)
          Method that can be used to set per-reader features such as configuration settings; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.
protected  DTDSubset setFeatureDTDOverride(java.lang.Object value)
          Actual method for setting override for DOCTYPE declaration override.
 
Methods inherited from class com.ctc.wstx.sr.WstxStreamReader
checkCData, checkEquals, checkKeyword, close, createBasicStreamReader, createElementStack, ensureFinishToken, finishToken, getAttributeCollector, getAttributeCount, getAttributeInfo, getAttributeLocalName, getAttributeName, getAttributeNamespace, getAttributePrefix, getAttributeType, getAttributeValue, getAttributeValue, getCharacterEncodingScheme, getCurrentEntityDecl, getDepth, getDTDInfo, getDTDInternalSubset, getDTDPublicId, getDTDRootName, getDTDSystemId, getElementText, getEncoding, getEndingByteOffset, getEndingCharOffset, getEndLocation, getEventType, getFeature, getInputElementStack, getLocalName, getLocation, getLocationInfo, getName, getNamespaceContext, getNamespaceCount, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNamespaceURI, getPIData, getPITarget, getPrefix, getStartingByteOffset, getStartingCharOffset, getSymbolTable, getText, getText, getTextCharacters, getTextCharacters, getTextLength, getTextStart, getVersion, hasConfigFlags, hasName, hasNext, hasText, initProlog, isAttributeSpecified, isCharacters, isEmptyElement, isEndElement, isNamespaceAware, isStandalone, isStartElement, isWhiteSpace, next, nextTag, parseNonNormalizedAttrValue, parseNormalizedAttrValue, require, safeEnsureFinishToken, safeFinishToken, skipElement, standaloneSet, withStartElement, wrappedFinishToken
 
Methods inherited from class com.ctc.wstx.sr.StreamScanner
ensureInput, expandBy50Pct, expandEntity, expandEntity, fullyResolveEntity, getCurrentInput, getCurrentLocation, getLastCharLocation, getNameBuffer, getNext, getNextAfterWS, getNextAfterWS, getNextChar, getNextCharAfterWS, getNextCharAfterWS, getNextCharFromCurrent, getNextInCurrAfterWS, getNextInCurrAfterWS, getSource, getStartLocation, getSystemId, initInputSource, inputInBuffer, loadMore, loadMore, loadMoreFromCurrent, loadMoreFromCurrent, markLF, markLF, parseEntityName, parseFNameForError, parseFullName, parseFullName, parseFullName2, parseLocalName, parseLocalName2, parsePublicId, parseSystemId, parseUntil, peekNext, pushback, reportProblem, reportProblem, reportProblem, reportProblem, reportProblem, resolveCharOnlyEntity, resolveNonCharEntity, resolveSimpleEntity, skipCRLF, skipFullName, skipWS, throwFromIOE, throwFromStrE, throwLazyError, throwNullChar, throwParseError, throwParseError, throwParseError, throwParseError, throwUnexpectedChar, throwUnexpectedEOB, throwUnexpectedEOF, tokenTypeDesc
 
Methods inherited from class com.ctc.wstx.io.WstxInputData
copyBufferStateFrom, getCharDesc, is11NameChar, is11NameStartChar, isSpaceChar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.stax2.LocationInfo
getCurrentLocation, getStartLocation
 

Method Detail

createFullStreamReader

public static FullStreamReader createFullStreamReader(BranchingReaderSource input,
                                                      ReaderCreator owner,
                                                      ReaderConfig cfg,
                                                      InputBootstrapper bs)
                                               throws java.io.IOException,
                                                      javax.xml.stream.XMLStreamException
Factory method for constructing readers.

Parameters:
owner - "Owner" of this reader, factory that created the reader; needed for returning updated symbol table information after parsing.
input - Input source used to read the XML document.
cfg - Object that contains reader configuration info.
Throws:
java.io.IOException
javax.xml.stream.XMLStreamException

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface javax.xml.stream.XMLStreamReader
Overrides:
getProperty in class WstxStreamReader

setFeature

public void setFeature(java.lang.String name,
                       java.lang.Object value)
Description copied from interface: XMLStreamReader2
Method that can be used to set per-reader features such as configuration settings; both generic ones (names for which are defined as constants in this class), and implementation dependant ones.

Note: although some feature names are shared with XMLStreamReader2.getFeature(java.lang.String), not all are: some features are read-only, some write-only

Specified by:
setFeature in interface XMLStreamReader2
Overrides:
setFeature in class WstxStreamReader

setFeatureDTDOverride

protected final DTDSubset setFeatureDTDOverride(java.lang.Object value)
                                         throws java.io.IOException,
                                                javax.xml.stream.XMLStreamException
Actual method for setting override for DOCTYPE declaration override.

Throws:
java.io.IOException
javax.xml.stream.XMLStreamException

getProcessedDTD

public java.lang.Object getProcessedDTD()
Description copied from class: WstxStreamReader

Note: DTD-handling sub-classes need to override this method.

Specified by:
getProcessedDTD in interface DTDInfo
Overrides:
getProcessedDTD in class WstxStreamReader

finishDTD

protected void finishDTD(boolean copyContents)
                  throws java.io.IOException,
                         javax.xml.stream.XMLStreamException
This method gets called to handle remainder of DOCTYPE declaration, essentially the optional internal subset. Internal subset, if such exists, is always read, but whether its contents are added to the read buffer depend on passed-in argument.

NOTE: Since this method overrides the default implementation, make sure you do NOT change the method signature.

Overrides:
finishDTD in class WstxStreamReader
Parameters:
copyContents - If true, will copy contents of the internal subset of DOCTYPE declaration in the text buffer (in addition to parsing it for actual use); if false, will only do parsing.
Throws:
java.io.IOException
javax.xml.stream.XMLStreamException

constructDtdId

protected DTDId constructDtdId(java.lang.String pubId,
                               java.lang.String sysId)
                        throws java.io.IOException
Throws:
java.io.IOException

constructDtdId

protected DTDId constructDtdId(java.net.URL sysId)
                        throws java.io.IOException
Throws:
java.io.IOException

reportInvalidContent

protected void reportInvalidContent(int evtType)
                             throws WstxException
Method called by lower-level parsing code when invalid content (anything inside element with 'empty' content spec; text inside non-mixed element etc) is found during basic scanning. Note that actual DTD element structure problems are not reported through this method.

Overrides:
reportInvalidContent in class WstxStreamReader
Throws:
WstxException