Package com.ctc.wstx.dtd
Class MinimalDTDReader
- java.lang.Object
-
- com.ctc.wstx.io.WstxInputData
-
- com.ctc.wstx.sr.StreamScanner
-
- com.ctc.wstx.dtd.MinimalDTDReader
-
- All Implemented Interfaces:
InputConfigFlags,ParsingErrorMsgs,InputProblemReporter
- Direct Known Subclasses:
FullDTDReader
public class MinimalDTDReader extends StreamScanner
Minimal DTD reader implementation that only knows how to skip internal DTD subsets.
-
-
Field Summary
-
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, mCachedEntities, mCfgNsEnabled, mCfgReplaceEntities, mCfgTreatCharRefsAsEntities, mConfig, mCurrDepth, mCurrEntity, mCurrName, mDocInputEncoding, mDocXmlEncoding, mDocXmlVersion, mEntityExpansionCount, mEntityResolver, mInput, mInputTopDepth, mNameBuffer, mNormalizeLFs, mRootInput, 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, mInputEnd, mInputPtr, mXml11
-
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_NAMES, CFG_INTERN_NS_URIS, 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
-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMinimalDTDReader(WstxInputSource input, ReaderConfig cfg, boolean isExt)Common initialization part of int/ext subset constructors.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected chardtdNextChar()protected chardtdNextFromCurr()EntityDeclfindEntity(String entName)Method that may need to be called by attribute default value validation code, during parsing....protected EntityDeclfindEntity(String id, Object arg)Abstract method for sub-classes to implement, for finding a declared general or parsed entity.protected StringgetErrorMsg()LocationgetLocation()What DTD reader returns doesn't really matter, so let's just return perceived start location (different from what stream readers actually do)protected chargetNextSkippingPEs()protected charhandleExpandedSurrogate(char first, char second)protected voidhandleIncompleteEntityProblem(WstxInputSource closing)Since improper entity/PE nesting is VC, not WFC, let's not react to this failure at all when only skipping the DTD subset.protected voidhandleUndeclaredEntity(String id)This is a VC, not WFC, nothing to do when skipping through DTD in non-supporting mode.protected voidskipComment()protected voidskipCommentContent()protected voidskipInternalSubset()Method that will skip through internal DTD subset, without doing any parsing, except for trying to match end of subset properly.static voidskipInternalSubset(WstxInputData srcData, WstxInputSource input, ReaderConfig cfg)Method that just skims through structure of internal subset, but without doing any sort of validation, or parsing of contents.protected voidskipPI()protected voidthrowIllegalCall()-
Methods inherited from class com.ctc.wstx.sr.StreamScanner
_reportProblem, _reportProblem, closeAllInput, constructFromIOE, constructLimitViolation, constructNullCharException, constructWfcException, ensureInput, expandBy50Pct, expandEntity, fullyResolveEntity, getCurrentInput, getCurrentLocation, getIntEntity, getLastCharLocation, getNameBuffer, getNext, getNextAfterWS, getNextChar, 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, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, reportValidationProblem, resolveCharOnlyEntity, resolveNonCharEntity, resolveSimpleEntity, skipCRLF, skipFullName, throwFromIOE, throwFromStrE, throwInvalidSpace, throwInvalidSpace, throwLazyError, throwNullChar, throwNullParent, throwParseError, throwParseError, throwUnexpectedChar, throwUnexpectedEOB, throwUnexpectedEOF, throwWfcException, tokenTypeDesc, verifyLimit
-
Methods inherited from class com.ctc.wstx.io.WstxInputData
copyBufferStateFrom, findIllegalNameChar, findIllegalNmtokenChar, getCharDesc, isNameChar, isNameChar, isNameStartChar, isNameStartChar, isSpaceChar
-
-
-
-
Constructor Detail
-
MinimalDTDReader
protected MinimalDTDReader(WstxInputSource input, ReaderConfig cfg, boolean isExt)
Common initialization part of int/ext subset constructors.
-
-
Method Detail
-
skipInternalSubset
public static void skipInternalSubset(WstxInputData srcData, WstxInputSource input, ReaderConfig cfg) throws XMLStreamException
Method that just skims through structure of internal subset, but without doing any sort of validation, or parsing of contents. Method may still throw an exception, if skipping causes EOF or there's an I/O problem.- Parameters:
srcData- Link back to the input buffer shared with the owning stream reader.- Throws:
XMLStreamException
-
getLocation
public final Location getLocation()
What DTD reader returns doesn't really matter, so let's just return perceived start location (different from what stream readers actually do)- Specified by:
getLocationin interfaceInputProblemReporter- Specified by:
getLocationin classStreamScanner
-
findEntity
protected EntityDecl findEntity(String id, Object arg)
Description copied from class:StreamScannerAbstract method for sub-classes to implement, for finding a declared general or parsed entity.- Specified by:
findEntityin classStreamScanner- Parameters:
id- Identifier of the entity to findarg- Optional argument passed from caller; needed by DTD reader.
-
handleUndeclaredEntity
protected void handleUndeclaredEntity(String id) throws XMLStreamException
This is a VC, not WFC, nothing to do when skipping through DTD in non-supporting mode.- Specified by:
handleUndeclaredEntityin classStreamScanner- Throws:
XMLStreamException
-
handleIncompleteEntityProblem
protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException
Since improper entity/PE nesting is VC, not WFC, let's not react to this failure at all when only skipping the DTD subset.- Specified by:
handleIncompleteEntityProblemin classStreamScanner- Throws:
XMLStreamException
-
handleExpandedSurrogate
protected char handleExpandedSurrogate(char first, char second)
-
findEntity
public EntityDecl findEntity(String entName)
Method that may need to be called by attribute default value validation code, during parsing....03-Dec-2004, TSa: This is not particularly elegant: should be able to pass the information some other way. But for now it works and is necessary.
-
skipInternalSubset
protected void skipInternalSubset() throws XMLStreamExceptionMethod that will skip through internal DTD subset, without doing any parsing, except for trying to match end of subset properly.- Throws:
XMLStreamException
-
dtdNextFromCurr
protected char dtdNextFromCurr() throws XMLStreamException- Throws:
XMLStreamException
-
dtdNextChar
protected char dtdNextChar() throws XMLStreamException- Throws:
XMLStreamException
-
getNextSkippingPEs
protected char getNextSkippingPEs() throws XMLStreamException- Throws:
XMLStreamException
-
skipComment
protected void skipComment() throws XMLStreamException- Throws:
XMLStreamException
-
skipCommentContent
protected void skipCommentContent() throws XMLStreamException- Throws:
XMLStreamException
-
skipPI
protected void skipPI() throws XMLStreamException- Throws:
XMLStreamException
-
getErrorMsg
protected String getErrorMsg()
-
-