public class FullDTDReader extends MinimalDTDReader
There are 2 main modes for DTDReader, depending on whether it is parsing internal or external subset. Parsing of internal subset is somewhat simpler, since no dependency checking is needed. For external subset, handling of parameter entities is bit more complicated, as care has to be taken to distinguish between using PEs defined in int. subset, and ones defined in ext. subset itself. This determines cachability of external subsets.
Reader also implements simple stand-alone functionality for flattening DTD files (expanding all references to their eventual textual form); this is sometimes useful when optimizing modularized DTDs (which are more maintainable) into single monolithic DTDs (which in general can be more performant).
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.Boolean |
ENTITY_EXP_GE |
(package private) static java.lang.Boolean |
ENTITY_EXP_PE |
(package private) static boolean |
INTERN_SHARED_NAMES
Flag that can be changed to enable or disable interning of shared
names; shared names are used for enumerated values to reduce
memory usage.
|
(package private) PrefixedName |
mAccessKey |
(package private) boolean |
mAnyDTDppFeatures
Flag that indicates if any DTD++ features have been encountered
(in DTD++-supporting mode).
|
(package private) boolean |
mCfgFullyValidating
This flag indicates whether we should build a validating 'real'
validator (true, the usual case),
or a simpler pseudo-validator that can do all non-validation tasks
that are based on DTD info (entity expansion, notation references,
default attribute values).
|
(package private) boolean |
mCfgSupportDTDPP |
(package private) boolean |
mCheckForbiddenPEs
This flag is used to catch uses of PEs in the internal subset
within declarations (full declarations are ok, but not other types)
|
(package private) int |
mConfigFlags |
(package private) DefaultAttrValue |
mCurrAttrDefault
This is the attribute default value that is currently being parsed.
|
(package private) java.lang.String |
mCurrDeclaration
Keyword of the declaration being currently parsed (if any).
|
(package private) java.lang.String |
mDefaultNsURI
Currently active default namespace URI.
|
(package private) java.util.LinkedHashMap<PrefixedName,DTDElement> |
mElements
Contains definition of elements and matching content specifications.
|
(package private) DTDEventListener |
mEventListener |
(package private) boolean |
mExpandingPE
Flag that indicates if the currently expanding (or last expanded)
entity is a Parameter Entity or General Entity.
|
(package private) DTDWriter |
mFlattenWriter |
(package private) java.util.HashMap<java.lang.String,EntityDecl> |
mGeneralEntities
Set of generic entities defined so far in this subset.
|
(package private) int |
mIncludeCount
Nesting count for conditionally included sections; 0 means that
we are not inside such a section.
|
(package private) java.util.HashMap<java.lang.String,java.lang.String> |
mNamespaces
Prefix-to-NsURI mappings for this DTD, if any: lazily
constructed when needed
|
(package private) java.util.HashMap<java.lang.String,javax.xml.stream.Location> |
mNotationForwardRefs
Finally, we need to keep track of Notation references that were
made prior to declaration.
|
(package private) java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> |
mNotations
Set of notations defined so far.
|
(package private) java.util.HashMap<java.lang.String,EntityDecl> |
mParamEntities
Set of parameter entities defined so far in the currently parsed
subset.
|
(package private) java.util.HashMap<java.lang.String,EntityDecl> |
mPredefdGEs
Set of general entities already defined for the subset being
parsed; namely, PEs defined in the internal subset passed when
parsing matching external subset.
|
(package private) java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> |
mPredefdNotations
Notations already parsed before current subset; that is,
notations from the internal subset if we are currently
parsing matching external subset.
|
(package private) java.util.HashMap<java.lang.String,EntityDecl> |
mPredefdPEs
Set of parameter entities already defined for the subset being
parsed; namely, PEs defined in the internal subset passed when
parsing matching external subset.
|
(package private) java.util.Set<java.lang.String> |
mRefdGEs
Set of general entities (ids) that have been referenced by this
DTD; only maintained for external subsets, and only as long as
no pre-defined GEs have been referenced.
|
(package private) java.util.Set<java.lang.String> |
mRefdPEs
Set of parameter entities (ids) that have been referenced by this
DTD; only maintained for external subsets, and only as long as
no pre-defined PE has been referenced.
|
(package private) java.util.HashMap<java.lang.String,java.lang.String> |
mSharedEnumValues
Map used for sharing legal enumeration values; used since oftentimes
same enumeration values are used with multiple attributes
|
(package private) java.util.HashMap<PrefixedName,PrefixedName> |
mSharedNames
Map used to shared PrefixedName instances, to reduce memory usage
of (qualified) element and attribute names
|
(package private) TextBuffer |
mTextBuffer |
(package private) boolean |
mUsesPredefdEntities
Flag used to keep track of whether current (external) subset
has referenced at least one PE that was pre-defined.
|
(package private) boolean |
mUsesPredefdNotations
Flag used to keep track of whether current (external) subset
has referenced at least one notation that was defined in internal
subset.
|
(package private) TextBuffer |
mValueBuffer
Text buffer used for constructing expansion value of the internal
entities, and for default attribute values.
|
mIsExternal
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
CHAR_NULL, CHAR_SPACE, INT_NULL, INT_SPACE, MAX_UNICODE_CHAR, mCurrInputProcessed, mCurrInputRow, mCurrInputRowStart, mInputBuffer, mInputEnd, mInputPtr, mXml11
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
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
Modifier | Constructor and Description |
---|---|
private |
FullDTDReader(WstxInputSource input,
ReaderConfig cfg,
boolean isExt,
DTDSubset intSubset,
boolean constructFully,
int xmlVersion)
Common initialization part of int/ext subset constructors.
|
private |
FullDTDReader(WstxInputSource input,
ReaderConfig cfg,
boolean constructFully,
int xmlVersion)
Constructor used for reading/skipping internal subset.
|
private |
FullDTDReader(WstxInputSource input,
ReaderConfig cfg,
DTDSubset intSubset,
boolean constructFully,
int xmlVersion)
Constructor used for reading external subset.
|
Modifier and Type | Method and Description |
---|---|
private void |
_reportBadDirective(java.lang.String dir) |
private void |
_reportUndefinedNotationRefs() |
private void |
_reportVCViolation(java.lang.String msg) |
private void |
_reportWarning(javax.xml.stream.XMLReporter rep,
java.lang.String probType,
java.lang.String msg,
javax.xml.stream.Location loc) |
private void |
_reportWFCViolation(java.lang.String msg) |
private void |
_reportWFCViolation(java.lang.String format,
java.lang.Object arg) |
private java.lang.String |
attrDesc(java.lang.Object elem,
PrefixedName attrName) |
protected java.lang.String |
checkDTDKeyword(java.lang.String exp)
Method called to verify whether input has specified keyword; if it
has, returns null and points to char after the keyword; if not,
returns whatever constitutes a keyword matched, for error
reporting purposes.
|
private void |
checkInclusion() |
private boolean |
checkPublicSystemKeyword(char c) |
protected void |
checkXmlIdAttr(int type) |
protected void |
checkXmlSpaceAttr(int type,
WordResolver enumValues) |
private static char |
combineArities(char arity1,
char arity2) |
private char |
dtdNextIfAvailable() |
private java.lang.String |
elemDesc(java.lang.Object elem) |
protected boolean |
ensureInput(int minAmount)
Method called to make sure current main-level input buffer has at
least specified number of characters available consequtively,
without having to call
StreamScanner.loadMore() . |
private java.lang.String |
entityDesc(WstxInputSource input) |
private void |
expandPE()
Method called to handle expansion of parameter entities.
|
EntityDecl |
findEntity(java.lang.String entName)
Method that may need to be called by attribute default value
validation code, during parsing....
|
protected EntityDecl |
findEntity(java.lang.String id,
java.lang.Object arg)
Abstract method for sub-classes to implement, for finding
a declared general or parsed entity.
|
private PrefixedName |
findSharedName(java.lang.String prefix,
java.lang.String localName)
Method used to 'intern()' qualified names; main benefit is reduced
memory usage as the name objects are shared.
|
static DTDSubset |
flattenExternalSubset(WstxInputSource src,
java.io.Writer flattenWriter,
boolean inclComments,
boolean inclConditionals,
boolean inclPEs)
Method that will parse, process and output contents of an external
DTD subset.
|
private void |
flushFlattenWriter() |
private java.util.LinkedHashMap<PrefixedName,DTDElement> |
getElementMap() |
private char |
getNextExpanded()
Method that will get next character, and either return it as is (for
normal chars), or expand parameter entity that starts with next
character (which has to be '%').
|
private TextBuffer |
getTextBuffer() |
private void |
handleAttlistDecl()
note: when this method is called, the keyword itself has
been succesfully parsed.
|
private void |
handleAttrDecl(DTDElement elem,
char c,
int index,
javax.xml.stream.Location loc) |
private void |
handleDeclaration(char c)
Note: c is known to be a letter (from 'A' to 'Z') at this poit.
|
private void |
handleElementDecl() |
private void |
handleEntityDecl(boolean suppressPEDecl)
This method is tricky to implement, since it can contain parameter
entities in multiple combinations...
|
private EntityDecl |
handleExternalEntityDecl(WstxInputSource inputSource,
boolean isParam,
java.lang.String id,
char c,
javax.xml.stream.Location evtLoc)
Method that handles rest of external entity declaration, after
it's been figured out entity is not internal (does not continue
with a quote).
|
protected void |
handleGreedyEntityProblem(WstxInputSource input) |
private void |
handleIgnored() |
private void |
handleIncluded() |
protected void |
handleIncompleteEntityProblem(WstxInputSource closing)
Handling of PE matching problems is actually intricate; one type
will be a WFC ("PE Between Declarations", which refers to PEs that
start from outside declarations), and another just a VC
("Proper Declaration/PE Nesting", when PE is contained within
declaration)
|
private void |
handleNotationDecl()
Method called to handle
|
private void |
handleSuppressedDeclaration()
Specialized method that handles potentially suppressable entity
declaration.
|
private void |
handleTargetNsDecl()
Method called to handle
|
protected void |
handleUndeclaredEntity(java.lang.String id)
Undeclared parameter entity is a VC, not WFC...
|
protected void |
initInputSource(WstxInputSource newInput,
boolean isExt,
java.lang.String entityId)
Method called when an entity has been expanded (new input source
has been created).
|
protected boolean |
loadMore()
Need to override this method, to check couple of things: first,
that nested input sources are balanced, when expanding parameter
entities inside entity value definitions (as per XML specs), and
secondly, to handle (optional) flattening output.
|
protected boolean |
loadMoreFromCurrent() |
private void |
loadMoreScoped(WstxInputSource currScope,
java.lang.String entityName,
javax.xml.stream.Location loc) |
private void |
parseAttrDefaultValue(DefaultAttrValue defVal,
char quoteChar,
PrefixedName attrName,
javax.xml.stream.Location loc,
boolean gotFixed)
This method is similar to
parseEntityValue(java.lang.String, javax.xml.stream.Location, char) in some ways,
but has some notable differences, due to the way XML specs define
differences. |
protected void |
parseDirective() |
protected void |
parseDirectiveFlattened()
Method similar to
parseDirective() , but one that takes care
to properly output dtd contents via DTDWriter
as necessary. |
protected DTDSubset |
parseDTD() |
private char[] |
parseEntityValue(java.lang.String id,
javax.xml.stream.Location loc,
char quoteChar)
Method that reads and pre-processes replacement text for an internal
entity (parameter or generic).
|
private WordResolver |
parseEnumerated(DTDElement elem,
PrefixedName attrName,
boolean isNotation)
Parsing method that reads a list of one or more space-separated
tokens (nmtoken or name, depending on 'isNotation' argument)
|
private char |
readArity() |
protected void |
readComment(DTDEventListener l)
Method similar to
MinimalDTDReader.skipComment() , but that has to collect
contents, to be reported for a SAX handler. |
private ContentSpec |
readContentSpec(PrefixedName elemName,
boolean mainLevel,
boolean construct) |
protected java.lang.String |
readDTDKeyword(java.lang.String prefix)
Method called usually to indicate an error condition; will read rest
of specified keyword (including characters that can be part of XML
identifiers), append that to passed prefix (which is optional), and
return resulting String.
|
private java.lang.String |
readDTDLocalName(char c,
boolean checkChar) |
private java.lang.String |
readDTDName(char c) |
private java.lang.String |
readDTDNmtoken(char c)
Similar to
readDTDName(char) , except that the rules are bit looser,
ie. |
private PrefixedName |
readDTDQName(char firstChar)
Method that will read an element or attribute name from DTD; depending
on namespace mode, it can have prefix as well.
|
private java.lang.String |
readEnumEntry(char c,
java.util.HashMap<java.lang.String,java.lang.String> sharedEnums) |
static DTDSubset |
readExternalSubset(WstxInputSource src,
ReaderConfig cfg,
DTDSubset intSubset,
boolean constructFully,
int xmlVersion)
Method called to read in the external subset definition.
|
static DTDSubset |
readInternalSubset(WstxInputData srcData,
WstxInputSource input,
ReaderConfig cfg,
boolean constructFully,
int xmlVersion)
Method called to read in the internal subset definition.
|
private StructValidator |
readMixedSpec(PrefixedName elemName,
boolean construct)
Method called to parse what seems like a mixed content specification.
|
private java.lang.String |
readNotationEntry(char c,
PrefixedName attrName,
javax.xml.stream.Location refLoc)
Method called to read a notation reference entry; done both for
attributes of type NOTATION, and for external unparsed entities
that refer to a notation.
|
protected void |
readPI()
Method similar to
MinimalDTDReader.skipPI() , but one that does basic
well-formedness checks. |
void |
setFlattenWriter(java.io.Writer w,
boolean inclComments,
boolean inclConditionals,
boolean inclPEs)
Method that will set specified Writer as the 'flattening writer';
writer used to output flattened version of DTD read in.
|
private char |
skipDtdWs(boolean handlePEs) |
private char |
skipObligatoryDtdWs()
Note: Apparently a parameter entity expansion does also count
as white space (that is, PEs outside of quoted text are considered
to be separated by white spaces on both sides).
|
private void |
throwDTDAttrError(java.lang.String msg,
DTDElement elem,
PrefixedName attrName) |
private void |
throwDTDElemError(java.lang.String msg,
java.lang.Object elem) |
private void |
throwDTDUnexpectedChar(int i,
java.lang.String extraMsg) |
private void |
throwForbiddenPE() |
dtdNextChar, dtdNextFromCurr, getErrorMsg, getLocation, getNextSkippingPEs, handleExpandedSurrogate, skipComment, skipCommentContent, skipInternalSubset, skipInternalSubset, skipPI, throwIllegalCall
_reportProblem, _reportProblem, closeAllInput, constructFromIOE, constructLimitViolation, constructNullCharException, constructWfcException, expandBy50Pct, expandEntity, fullyResolveEntity, getCurrentInput, getCurrentLocation, getIntEntity, getLastCharLocation, getNameBuffer, getNext, getNextAfterWS, getNextChar, getNextCharAfterWS, getNextCharFromCurrent, getNextInCurrAfterWS, getNextInCurrAfterWS, getSource, getStartLocation, getSystemId, inputInBuffer, loadMore, 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
copyBufferStateFrom, findIllegalNameChar, findIllegalNmtokenChar, getCharDesc, isNameChar, isNameChar, isNameStartChar, isNameStartChar, isSpaceChar
static final boolean INTERN_SHARED_NAMES
static final java.lang.Boolean ENTITY_EXP_GE
static final java.lang.Boolean ENTITY_EXP_PE
final int mConfigFlags
final boolean mCfgSupportDTDPP
final boolean mCfgFullyValidating
java.util.HashMap<java.lang.String,EntityDecl> mParamEntities
Keys are entity name Strings; values are instances of EntityDecl
final java.util.HashMap<java.lang.String,EntityDecl> mPredefdPEs
java.util.Set<java.lang.String> mRefdPEs
java.util.HashMap<java.lang.String,EntityDecl> mGeneralEntities
Keys are entity name Strings; values are instances of EntityDecl
Note: this Map only contains entities declared and defined in the subset being parsed; no previously defined values are passed.
final java.util.HashMap<java.lang.String,EntityDecl> mPredefdGEs
java.util.Set<java.lang.String> mRefdGEs
boolean mUsesPredefdEntities
java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> mNotations
Keys are entity name Strings; values are instances of NotationDecl objects
final java.util.HashMap<java.lang.String,javax.xml.stream.events.NotationDeclaration> mPredefdNotations
boolean mUsesPredefdNotations
java.util.HashMap<java.lang.String,javax.xml.stream.Location> mNotationForwardRefs
java.util.HashMap<PrefixedName,PrefixedName> mSharedNames
java.util.LinkedHashMap<PrefixedName,DTDElement> mElements
java.util.HashMap<java.lang.String,java.lang.String> mSharedEnumValues
DefaultAttrValue mCurrAttrDefault
boolean mExpandingPE
TextBuffer mValueBuffer
int mIncludeCount
boolean mCheckForbiddenPEs
java.lang.String mCurrDeclaration
boolean mAnyDTDppFeatures
java.lang.String mDefaultNsURI
java.util.HashMap<java.lang.String,java.lang.String> mNamespaces
DTDWriter mFlattenWriter
final DTDEventListener mEventListener
transient TextBuffer mTextBuffer
final PrefixedName mAccessKey
private FullDTDReader(WstxInputSource input, ReaderConfig cfg, boolean constructFully, int xmlVersion)
private FullDTDReader(WstxInputSource input, ReaderConfig cfg, DTDSubset intSubset, boolean constructFully, int xmlVersion)
private FullDTDReader(WstxInputSource input, ReaderConfig cfg, boolean isExt, DTDSubset intSubset, boolean constructFully, int xmlVersion)
public static DTDSubset readInternalSubset(WstxInputData srcData, WstxInputSource input, ReaderConfig cfg, boolean constructFully, int xmlVersion) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static DTDSubset readExternalSubset(WstxInputSource src, ReaderConfig cfg, DTDSubset intSubset, boolean constructFully, int xmlVersion) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public static DTDSubset flattenExternalSubset(WstxInputSource src, java.io.Writer flattenWriter, boolean inclComments, boolean inclConditionals, boolean inclPEs) throws java.io.IOException, javax.xml.stream.XMLStreamException
readExternalSubset(com.ctc.wstx.io.WstxInputSource, com.ctc.wstx.api.ReaderConfig, com.ctc.wstx.dtd.DTDSubset, boolean, int)
, but additionally will copy its processed
("flattened") input to specified writer.src
- Input source used to read the main external subsetflattenWriter
- Writer to output processed DTD content toinclComments
- If true, will pass comments to the writer; if false,
will strip comments outinclConditionals
- If true, will include conditional block markers,
as well as intervening content; if false, will strip out both markers
and ignorable sections.inclPEs
- If true, will output parameter entity declarations; if
false will parse and use them, but not output.java.io.IOException
javax.xml.stream.XMLStreamException
private TextBuffer getTextBuffer()
public void setFlattenWriter(java.io.Writer w, boolean inclComments, boolean inclConditionals, boolean inclPEs)
private void flushFlattenWriter() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public EntityDecl findEntity(java.lang.String entName)
Note: see base class for some additional remarks about this method.
findEntity
in class MinimalDTDReader
protected DTDSubset parseDTD() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parseDirective() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void parseDirectiveFlattened() throws javax.xml.stream.XMLStreamException
parseDirective()
, but one that takes care
to properly output dtd contents via DTDWriter
as necessary.
Separated to simplify both methods; otherwise would end up with
'if (... flatten...) ... else ...' spaghetti code.javax.xml.stream.XMLStreamException
protected void initInputSource(WstxInputSource newInput, boolean isExt, java.lang.String entityId) throws javax.xml.stream.XMLStreamException
StreamScanner
initInputSource
in class StreamScanner
entityId
- Name of the entity being expandedjavax.xml.stream.XMLStreamException
protected boolean loadMore() throws javax.xml.stream.XMLStreamException
loadMore
in class StreamScanner
javax.xml.stream.XMLStreamException
protected boolean loadMoreFromCurrent() throws javax.xml.stream.XMLStreamException
loadMoreFromCurrent
in class StreamScanner
javax.xml.stream.XMLStreamException
protected boolean ensureInput(int minAmount) throws javax.xml.stream.XMLStreamException
StreamScanner
StreamScanner.loadMore()
. It can only be called
when input comes from main-level buffer; further, call can shift
content in input buffer, so caller has to flush any data still
pending. In short, caller has to know exactly what it's doing. :-)
Note: method does not check for any other input sources than the current one -- if current source can not fulfill the request, a failure is indicated.
ensureInput
in class StreamScanner
javax.xml.stream.XMLStreamException
private void loadMoreScoped(WstxInputSource currScope, java.lang.String entityName, javax.xml.stream.Location loc) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private char dtdNextIfAvailable() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private char getNextExpanded() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private char skipDtdWs(boolean handlePEs) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private char skipObligatoryDtdWs() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void expandPE() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String checkDTDKeyword(java.lang.String exp) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected java.lang.String readDTDKeyword(java.lang.String prefix) throws javax.xml.stream.XMLStreamException
prefix
- Part of keyword already read in.javax.xml.stream.XMLStreamException
private boolean checkPublicSystemKeyword(char c) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String readDTDName(char c) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String readDTDLocalName(char c, boolean checkChar) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String readDTDNmtoken(char c) throws javax.xml.stream.XMLStreamException
readDTDName(char)
, except that the rules are bit looser,
ie. there are no additional restrictions for the first charjavax.xml.stream.XMLStreamException
private PrefixedName readDTDQName(char firstChar) throws javax.xml.stream.XMLStreamException
Note: returned PrefixedName
instances are canonicalized so that
all instances read during parsing of a single DTD subset so that
identity comparison can be used instead of calling equals()
method (but only within a single subset!). This also reduces memory
usage to some extent.
javax.xml.stream.XMLStreamException
private char readArity() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private char[] parseEntityValue(java.lang.String id, javax.xml.stream.Location loc, char quoteChar) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void parseAttrDefaultValue(DefaultAttrValue defVal, char quoteChar, PrefixedName attrName, javax.xml.stream.Location loc, boolean gotFixed) throws javax.xml.stream.XMLStreamException
parseEntityValue(java.lang.String, javax.xml.stream.Location, char)
in some ways,
but has some notable differences, due to the way XML specs define
differences. Main differences are that parameter entities are not
allowed (or rather, recognized as entities), and that general
entities need to be verified, but NOT expanded right away.
Whether forward references are allowed or not is an open question
right now.javax.xml.stream.XMLStreamException
protected void readPI() throws javax.xml.stream.XMLStreamException
MinimalDTDReader.skipPI()
, but one that does basic
well-formedness checks.javax.xml.stream.XMLStreamException
protected void readComment(DTDEventListener l) throws javax.xml.stream.XMLStreamException
MinimalDTDReader.skipComment()
, but that has to collect
contents, to be reported for a SAX handler.javax.xml.stream.XMLStreamException
private void checkInclusion() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleIncluded() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleIgnored() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportUndefinedNotationRefs() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportBadDirective(java.lang.String dir) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportVCViolation(java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportWFCViolation(java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportWFCViolation(java.lang.String format, java.lang.Object arg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void throwDTDElemError(java.lang.String msg, java.lang.Object elem) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void throwDTDAttrError(java.lang.String msg, DTDElement elem, PrefixedName attrName) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void throwDTDUnexpectedChar(int i, java.lang.String extraMsg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void throwForbiddenPE() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String elemDesc(java.lang.Object elem)
private java.lang.String attrDesc(java.lang.Object elem, PrefixedName attrName)
private java.lang.String entityDesc(WstxInputSource input)
private void handleDeclaration(char c) throws javax.xml.stream.XMLStreamException
Note: c is known to be a letter (from 'A' to 'Z') at this poit.
javax.xml.stream.XMLStreamException
private void handleSuppressedDeclaration() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleAttlistDecl() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleElementDecl() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleEntityDecl(boolean suppressPEDecl) throws javax.xml.stream.XMLStreamException
suppressPEDecl
- If true, will need to take of enabling/disabling
of flattened output.javax.xml.stream.XMLStreamException
private void handleNotationDecl() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void handleTargetNsDecl() throws javax.xml.stream.XMLStreamException
Note: only valid for DTD++, in 'plain DTD' mode shouldn't get called.
javax.xml.stream.XMLStreamException
private void handleAttrDecl(DTDElement elem, char c, int index, javax.xml.stream.Location loc) throws javax.xml.stream.XMLStreamException
elem
- Element that contains this attributec
- First character of what should be the attribute nameindex
- Sequential index number of this attribute as children
of the element; used for creating bit masks later on.loc
- Location of the element name in attribute list declarationjavax.xml.stream.XMLStreamException
private WordResolver parseEnumerated(DTDElement elem, PrefixedName attrName, boolean isNotation) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private java.lang.String readNotationEntry(char c, PrefixedName attrName, javax.xml.stream.Location refLoc) throws javax.xml.stream.XMLStreamException
attrName
- Name of attribute in declaration that refers to this entityrefLoc
- Starting location of the DTD component that contains
the referencejavax.xml.stream.XMLStreamException
private java.lang.String readEnumEntry(char c, java.util.HashMap<java.lang.String,java.lang.String> sharedEnums) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private StructValidator readMixedSpec(PrefixedName elemName, boolean construct) throws javax.xml.stream.XMLStreamException
construct
- If true, will build full object for validating content
within mixed content model; if false, will just parse and discard
information (done in non-validating DTD-supporting mode)javax.xml.stream.XMLStreamException
private ContentSpec readContentSpec(PrefixedName elemName, boolean mainLevel, boolean construct) throws javax.xml.stream.XMLStreamException
mainLevel
- Whether this is the main-level content specification or nestedjavax.xml.stream.XMLStreamException
private static char combineArities(char arity1, char arity2)
private EntityDecl handleExternalEntityDecl(WstxInputSource inputSource, boolean isParam, java.lang.String id, char c, javax.xml.stream.Location evtLoc) throws javax.xml.stream.XMLStreamException
inputSource
- Input source for the start of the declaration.
Needed for resolving relative system references, if any.isParam
- True if this a parameter entity declaration; false
if general entity declarationevtLoc
- Location where entity declaration directive started;
needed when construction event Objects for declarations.javax.xml.stream.XMLStreamException
private java.util.LinkedHashMap<PrefixedName,DTDElement> getElementMap()
private PrefixedName findSharedName(java.lang.String prefix, java.lang.String localName)
Note: it is assumed at this point that access is only from a single thread, and non-recursive -- generally valid assumption as readers are not shared. Restriction is needed since the method is not re-entrant: it uses mAccessKey during the method call.
protected EntityDecl findEntity(java.lang.String id, java.lang.Object arg)
StreamScanner
findEntity
in class MinimalDTDReader
arg
- If Boolean.TRUE, we are expanding a general entityid
- Identifier of the entity to findprotected void handleUndeclaredEntity(java.lang.String id) throws javax.xml.stream.XMLStreamException
handleUndeclaredEntity
in class MinimalDTDReader
javax.xml.stream.XMLStreamException
protected void handleIncompleteEntityProblem(WstxInputSource closing) throws javax.xml.stream.XMLStreamException
handleIncompleteEntityProblem
in class MinimalDTDReader
javax.xml.stream.XMLStreamException
protected void handleGreedyEntityProblem(WstxInputSource input) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void checkXmlSpaceAttr(int type, WordResolver enumValues) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void checkXmlIdAttr(int type) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
private void _reportWarning(javax.xml.stream.XMLReporter rep, java.lang.String probType, java.lang.String msg, javax.xml.stream.Location loc) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException