APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xerces.internal.impl

public Class XMLDTDScannerImpl

extends XMLScanner
implements XMLDTDScanner, XMLComponent, XMLEntityHandler
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xerces.internal.impl.XMLEntityHandler, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent, com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner, com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource, com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource
Known Direct Subclasses
com.sun.org.apache.xerces.internal.impl.XML11DTDScannerImpl
Imports
com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter, com.sun.org.apache.xerces.internal.util.SymbolTable, .XMLAttributesImpl, .XMLChar, .XMLStringBuffer, com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler, .XMLDTDHandler, .XMLResourceIdentifier, .XMLString, .XNIException, .Augmentations, com.sun.org.apache.xerces.internal.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLDTDScanner, .XMLInputSource, com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar, java.io.EOFException, .IOException, jdk.xml.internal.XMLLimitAnalyzer, .XMLSecurityManager

This class is responsible for scanning the declarations found in the internal and external subsets of a DTD in an XML document. The scanner acts as the sources for the DTD information which is communicated to the DTD handlers.

This component requires the following features and properties from the component manager that uses it:

Authors
Arnaud Le Hors, IBM, Andy Clark, IBM, Glenn Marcy, IBM, Eric Ye, IBM

Field Summary

Modifier and TypeField and Description
private static final boolean
DEBUG_SCANNER_STATE

Debug scanner state.

private XMLAttributesImpl
fAttributes

Default attribute

private int
fContentDepth

Size of content stack.

private int[]
fContentStack

Stack of content operators (either '|' or ',') in children content.

protected XMLDTDContentModelHandler
fDTDContentModelHandler

DTD content model handler.

public XMLDTDHandler
fDTDHandler

DTD handler.

private static final Boolean[]
FEATURE_DEFAULTS

Feature defaults.

private String[]
fEnumeration

Enumeration values.

private int
fEnumerationCount

Enumeration values count.

private int
fExtEntityDepth

Number of opened external entities.

private XMLStringBuffer
fIgnoreConditionalBuffer

Ignore conditional section buffer.

private int
fIncludeSectDepth

Number of opened include sections.

private XMLString
fLiteral

Literal text.

private XMLString
fLiteral2

Literal text.

private int
fMarkUpDepth

Markup depth.

private int
fPEDepth

Number of opened parameter entities.

private boolean[]
fPEReport

Parameter entity stack to report start/end entity calls.

private int[]
fPEStack

Parameter entity stack to check well-formedness.

protected int
fScannerState

Scanner state.

protected boolean
fSeenExternalDTD

Seen external DTD.

protected boolean
fSeenExternalPE

Seen external parameter entity.

protected boolean
fStandalone

Standalone.

private boolean
fStartDTDCalled

Start DTD called.

private XMLString
private XMLStringBuffer
private XMLStringBuffer
private String[]
fStrings

Array of 3 strings.

pack-priv boolean
pack-priv DTDGrammar
nvGrammarInfo

Object contains grammar information for a non-validaing parser.

private static final Object[]
PROPERTY_DEFAULTS

Property defaults.

private static final String[]
RECOGNIZED_FEATURES

Recognized features.

private static final String[]
RECOGNIZED_PROPERTIES

Recognized properties.

protected static final int
SCANNER_STATE_END_OF_INPUT

Scanner state: end of input.

protected static final int
SCANNER_STATE_MARKUP_DECL

Scanner state: markup declaration.

protected static final int
SCANNER_STATE_TEXT_DECL

Scanner state: text declaration.

Inherited from com.sun.org.apache.xerces.internal.impl.XMLScanner:
attributeValueCacheDEBUG_ATTR_NORMALIZATIONENTITY_MANAGERERROR_REPORTERfAmpSymbolfAposSymbolfAttributeCacheInitDonefAttributeCacheUsedCountfCharRefLiteralfEncodingSymbolfEntityDepthfEntityManagerfEntityScannerfEntityStorefErrorReporterfEventfGtSymbolfLimitAnalyzerfLtSymbolfNamespacesfNotifyCharRefsfParserSettingsfPropertyManagerfQuotSymbolfReportEntityfResourceIdentifierfScanningAttributefSecurityManagerfStandaloneSymbolfStringBufferIndexfSymbolTablefValidationfVersionSymbolinitialCacheCountNAMESPACESNOTIFY_CHAR_REFSPARSER_SETTINGSstringBufferCacheSYMBOL_TABLEVALIDATION

Constructor Summary

AccessConstructor and Description
public
XMLDTDScannerImpl()

Default constructor.

public
XMLDTDScannerImpl(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)

Constructor for he use of non-XMLComponentManagers.

Method Summary

Modifier and TypeMethod and Description
public void
endEntity(String
The name of the entity.
name
,
Augmentations augs)

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.endEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.endEntity.

This method notifies the end of an entity.

private final void
public XMLDTDContentModelHandler
public XMLDTDHandler
public Boolean
getFeatureDefault(String
The feature identifier.
featureId
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getFeatureDefault.

Returns the default state for a feature, or null if this component does not want to report a default value for this feature.

public DTDGrammar
public Object
getPropertyDefault(String
The property identifier.
propertyId
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getPropertyDefault.

Returns the default state for a property, or null if this component does not want to report a default value for this property.

public String[]
getRecognizedFeatures()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedFeatures.

Returns a list of feature identifiers that are recognized by this component.

public String[]
getRecognizedProperties()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedProperties.

Returns a list of property identifiers that are recognized by this component.

private static String
getScannerStateName(int state)

Returns the scanner state name.

private void
private final boolean
peekReportEntity()

look at the top of the stack

private final int
private final int
popPEStack()

pop the stack

private final void
private final void
pushPEStack(int depth, boolean report)

public void
public void
public void
protected final String
scanAttDefaultDecl(String elName, String atName, String type, XMLString
The string to fill in with the default value.
defaultVal
,
XMLString nonNormalizedDefaultVal)

Scans an attribute default declaration

[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)?
protected final void
scanAttlistDecl()

Scans an attlist declaration

[52]  AttlistDecl    ::=   '<!ATTLIST' S Name AttDef* S?
private final String
scanAttType(String
The element type name this declaration is about.
elName
,
String
The attribute name this declaration is about.
atName
)

Scans an attribute type definition

[54]  AttType        ::=   StringType | TokenizedType | EnumeratedType
[55]  StringType     ::=   'CDATA'
[56]  TokenizedType  ::=   'ID'
                         | 'IDREF'
                         | 'IDREFS'
                         | 'ENTITY'
                         | 'ENTITIES'
                         | 'NMTOKEN'
                         | 'NMTOKENS'
[57]  EnumeratedType ::=    NotationType | Enumeration
[58]  NotationType ::= 'NOTATION' S '(' S?
private final void
scanChildren(String
The element type name this declaration is about

Note

Called after scanning past the first open paranthesis.

elName
)

scan children content model This assumes it can simply append to fStringBuffer.

protected final void
scanComment()

Scans a comment.

private final void
scanConditionalSect(int currPEDepth)

Scans a conditional section.

protected final boolean

Returns:

True if there is more to scan.
scanDecls
(boolean
True if this method is intended to scan and dispatch as much as possible.
complete
)

Dispatch an XML "event".

public boolean

Returns:

True if there is more to scan, false otherwise.
scanDTDExternalSubset
(boolean
True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.
complete
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.scanDTDExternalSubset.

Scans the external subset of the document.

public boolean

Returns:

True if there is more to scan, false otherwise.
scanDTDInternalSubset
(boolean
True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.
complete
,
boolean
True if the document was specified as standalone. This value is important for verifying certain well-formedness constraints.
standalone
,
boolean hasExternalSubset)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.scanDTDInternalSubset.

Scans the internal subset of the document.

protected final void
scanElementDecl()

Scans an element declaration

[45]    elementdecl    ::=    '<!ELEMENT' S Name S contentspec S?
private final void
scanEntityDecl()

Scans an entity declaration

[70]    EntityDecl  ::=    GEDecl | PEDecl
[71]    GEDecl      ::=    '<!ENTITY' S Name S EntityDef S?
protected final void
scanEntityValue(String entityName, boolean isPEDecl, XMLString
The string to fill in with the value.
value
,
XMLString
The string to fill in with the non-normalized value

Note

This method uses fString, fStringBuffer (through the use of scanCharReferenceValue), and fStringBuffer2, anything in them at the time of calling is lost.

nonNormalizedValue
)

Scans an entity value.

private final void
scanMixed(String
The element type name this declaration is about

Note

Called after scanning past '(#PCDATA'.

elName
)

scan Mixed content model This assumes the content model has been parsed up to #PCDATA and can simply append to fStringBuffer.

protected final boolean
private final void
scanNotationDecl()

Scans a notation declaration

[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID|PublicID) S?
protected final void
scanPIData(String
The PI target
target
,
XMLString
The string to fill in with the data
data
)

Scans a processing data.

protected final boolean

Returns:

True if a TextDecl was scanned.
scanTextDecl
()

Dispatch an XML "event".

public void
public void
public void
setInputSource(XMLInputSource
The input source or null.
inputSource
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.setInputSource.

Sets the input source.

public void
protected final void
setScannerState(int
The new scanner state.
state
)

Sets the scanner state.

public boolean

Returns:

true if DTD is skipped, false otherwise.
skipDTD
(boolean
The value of the property javax.xml.stream.supportDTD.
supportDTD
)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.skipDTD.

Skip the DTD if javax.xml.stream.supportDTD is false.

private boolean

Returns:

True if any leading whitespace was found or the end of a parameter entity was crossed.
skipSeparator
(boolean
Specify whether some leading whitespace should be found
spaceRequired
,
boolean
Specify whether parameter entity references should be looked for
lookForPERefs
)

Skip separator.

public void
startEntity(String
The name of the entity.
name
,
XMLResourceIdentifier
The resource identifier.
identifier
,
String
The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).
encoding
,
Augmentations
Additional information that may include infoset augmentations
augs
)

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.startEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.startEntity.

This method notifies of the start of an entity.

protected void
startPE(String
The name of the parameter entity to start (without the '%')
name
,
boolean
Whether this is happening within a literal
literal
)

start a parameter entity dealing with the textdecl if there is any

Inherited from com.sun.org.apache.xerces.internal.impl.XMLScanner:
checkEntityLimitcheckEntityLimitgetFeaturegetStringBufferisInvalidisInvalidLiteralisValidNameCharisValidNameStartCharisValidNameStartHighSurrogateisValidNCNamenormalizeWhitespacereportFatalErrorresolveCharacterscanAttributeValuescanCharReferenceValuescanCommentscanExternalIDscanPIscanPIDatascanPseudoAttributescanPubidLiteralscanSurrogatesscanXMLDeclOrTextDeclsetFeaturesetPropertysetPropertyManagerversionSupported

Field Detail

DEBUG_SCANNER_STATEback to summary
private static final boolean DEBUG_SCANNER_STATE

Debug scanner state.

fAttributesback to summary
private XMLAttributesImpl fAttributes

Default attribute

fContentDepthback to summary
private int fContentDepth

Size of content stack.

fContentStackback to summary
private int[] fContentStack

Stack of content operators (either '|' or ',') in children content.

fDTDContentModelHandlerback to summary
protected XMLDTDContentModelHandler fDTDContentModelHandler

DTD content model handler.

fDTDHandlerback to summary
public XMLDTDHandler fDTDHandler

DTD handler.

FEATURE_DEFAULTSback to summary
private static final Boolean[] FEATURE_DEFAULTS

Feature defaults.

fEnumerationback to summary
private String[] fEnumeration

Enumeration values.

fEnumerationCountback to summary
private int fEnumerationCount

Enumeration values count.

fExtEntityDepthback to summary
private int fExtEntityDepth

Number of opened external entities.

fIgnoreConditionalBufferback to summary
private XMLStringBuffer fIgnoreConditionalBuffer

Ignore conditional section buffer.

fIncludeSectDepthback to summary
private int fIncludeSectDepth

Number of opened include sections.

fLiteralback to summary
private XMLString fLiteral

Literal text.

fLiteral2back to summary
private XMLString fLiteral2

Literal text.

fMarkUpDepthback to summary
private int fMarkUpDepth

Markup depth.

fPEDepthback to summary
private int fPEDepth

Number of opened parameter entities.

fPEReportback to summary
private boolean[] fPEReport

Parameter entity stack to report start/end entity calls.

fPEStackback to summary
private int[] fPEStack

Parameter entity stack to check well-formedness.

fScannerStateback to summary
protected int fScannerState

Scanner state.

fSeenExternalDTDback to summary
protected boolean fSeenExternalDTD

Seen external DTD.

fSeenExternalPEback to summary
protected boolean fSeenExternalPE

Seen external parameter entity.

fStandaloneback to summary
protected boolean fStandalone

Standalone.

fStartDTDCalledback to summary
private boolean fStartDTDCalled

Start DTD called.

fStringback to summary
private XMLString fString

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.fString.

String.

fStringBufferback to summary
private XMLStringBuffer fStringBuffer

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.fStringBuffer.

String buffer.

fStringBuffer2back to summary
private XMLStringBuffer fStringBuffer2

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.fStringBuffer2.

String buffer.

fStringsback to summary
private String[] fStrings

Array of 3 strings.

nonValidatingModeback to summary
pack-priv boolean nonValidatingMode
nvGrammarInfoback to summary
pack-priv DTDGrammar nvGrammarInfo

Object contains grammar information for a non-validaing parser.

PROPERTY_DEFAULTSback to summary
private static final Object[] PROPERTY_DEFAULTS

Property defaults.

RECOGNIZED_FEATURESback to summary
private static final String[] RECOGNIZED_FEATURES

Recognized features.

RECOGNIZED_PROPERTIESback to summary
private static final String[] RECOGNIZED_PROPERTIES

Recognized properties.

SCANNER_STATE_END_OF_INPUTback to summary
protected static final int SCANNER_STATE_END_OF_INPUT

Scanner state: end of input.

SCANNER_STATE_MARKUP_DECLback to summary
protected static final int SCANNER_STATE_MARKUP_DECL

Scanner state: markup declaration.

SCANNER_STATE_TEXT_DECLback to summary
protected static final int SCANNER_STATE_TEXT_DECL

Scanner state: text declaration.

Constructor Detail

XMLDTDScannerImplback to summary
public XMLDTDScannerImpl()

Default constructor.

XMLDTDScannerImplback to summary
public XMLDTDScannerImpl(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)

Constructor for he use of non-XMLComponentManagers.

Method Detail

endEntityback to summary
public void endEntity(String name, Augmentations augs) throws XNIException, IOException

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.endEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.endEntity.

This method notifies the end of an entity. The DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Parameters
name:String

The name of the entity.

Exceptions
XNIException:
Thrown by handler to signal an error.
IOException:

Doc from com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.endEntity.

This exception might be thrown when there is premature end of entity

ensureEnumerationSizeback to summary
private final void ensureEnumerationSize(int size)
getDTDContentModelHandlerback to summary
public XMLDTDContentModelHandler getDTDContentModelHandler()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource.getDTDContentModelHandler.

getDTDContentModelHandler

Returns:XMLDTDContentModelHandler

XMLDTDContentModelHandler

getDTDHandlerback to summary
public XMLDTDHandler getDTDHandler()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource.getDTDHandler.

getDTDHandler

Returns:XMLDTDHandler

the XMLDTDHandler

getFeatureDefaultback to summary
public Boolean getFeatureDefault(String featureId)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getFeatureDefault.

Returns the default state for a feature, or null if this component does not want to report a default value for this feature.

Parameters
featureId:String

The feature identifier.

Since
Xerces 2.2.0
getGrammarback to summary
public DTDGrammar getGrammar()
getPropertyDefaultback to summary
public Object getPropertyDefault(String propertyId)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getPropertyDefault.

Returns the default state for a property, or null if this component does not want to report a default value for this property.

Parameters
propertyId:String

The property identifier.

Since
Xerces 2.2.0
getRecognizedFeaturesback to summary
public String[] getRecognizedFeatures()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedFeatures.

Returns a list of feature identifiers that are recognized by this component. This method may return null if no features are recognized by this component.

getRecognizedPropertiesback to summary
public String[] getRecognizedProperties()

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.getRecognizedProperties.

Returns a list of property identifiers that are recognized by this component. This method may return null if no properties are recognized by this component.

getScannerStateNameback to summary
private static String getScannerStateName(int state)

Returns the scanner state name.

initback to summary
private void init()

Hides com.sun.org.apache.xerces.internal.impl.XMLScanner.init.

peekReportEntityback to summary
private final boolean peekReportEntity()

look at the top of the stack

popContentStackback to summary
private final int popContentStack()
popPEStackback to summary
private final int popPEStack()

pop the stack

pushContentStackback to summary
private final void pushContentStack(int c)
pushPEStackback to summary
private final void pushPEStack(int depth, boolean report)
resetback to summary
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.reset.

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLComponent.reset.

reset

resetback to summary
public void reset()

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.reset.

resetback to summary
public void reset(PropertyManager props)

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.reset.

scanAttDefaultDeclback to summary
protected final String scanAttDefaultDecl(String elName, String atName, String type, XMLString defaultVal, XMLString nonNormalizedDefaultVal) throws IOException, XNIException

Scans an attribute default declaration

[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
Parameters
defaultVal:XMLString

The string to fill in with the default value.

scanAttlistDeclback to summary
protected final void scanAttlistDecl() throws IOException, XNIException

Scans an attlist declaration

[52]  AttlistDecl    ::=   '<!ATTLIST' S Name AttDef* S? '>'
[53]  AttDef         ::=   S Name S AttType S DefaultDecl

Note

Called after scanning past '<!ATTLIST'

scanAttTypeback to summary
private final String scanAttType(String elName, String atName) throws IOException, XNIException

Scans an attribute type definition

[54]  AttType        ::=   StringType | TokenizedType | EnumeratedType
[55]  StringType     ::=   'CDATA'
[56]  TokenizedType  ::=   'ID'
                         | 'IDREF'
                         | 'IDREFS'
                         | 'ENTITY'
                         | 'ENTITIES'
                         | 'NMTOKEN'
                         | 'NMTOKENS'
[57]  EnumeratedType ::=    NotationType | Enumeration
[58]  NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
[59]  Enumeration    ::=    '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'

Note

Called after scanning past '<!ATTLIST'

Parameters
elName:String

The element type name this declaration is about.

atName:String

The attribute name this declaration is about.

scanChildrenback to summary
private final void scanChildren(String elName) throws IOException, XNIException

scan children content model This assumes it can simply append to fStringBuffer.

[47]    children  ::=    (choice | seq) ('?' | '*' | '+')?
[48]    cp        ::=    (Name | choice | seq) ('?' | '*' | '+')?
[49]    choice    ::=    '(' S? cp ( S? '|' S? cp )+ S? ')'
[50]    seq       ::=    '(' S? cp ( S? ',' S? cp )* S? ')'
Parameters
elName:String

The element type name this declaration is about

Note

Called after scanning past the first open paranthesis.

scanCommentback to summary
protected final void scanComment() throws IOException, XNIException

Scans a comment.

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

Note

Called after scanning past '<!--'

scanConditionalSectback to summary
private final void scanConditionalSect(int currPEDepth) throws IOException, XNIException

Scans a conditional section. If it's a section to ignore the whole section gets scanned through and this method only returns after the closing bracket has been found. When it's an include section though, it returns to let the main loop take care of scanning it. In that case the end of the section if handled by the main loop (scanDecls).

[61] conditionalSect   ::= includeSect | ignoreSect
[62] includeSect       ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'
[63] ignoreSect   ::= '<![' S? 'IGNORE' S? '[' ignoreSectContents* ']]>'
[64] ignoreSectContents ::= Ignore ('<![' ignoreSectContents ']]>' Ignore)*
[65] Ignore            ::=    Char* - (Char* ('<![' | ']]>') Char*)

Note

Called after scanning past '<!['

scanDeclsback to summary
protected final boolean scanDecls(boolean complete) throws IOException, XNIException

Dispatch an XML "event".

Parameters
complete:boolean

True if this method is intended to scan and dispatch as much as possible.

Returns:boolean

True if there is more to scan.

Exceptions
IOException:
Thrown on i/o error.
XNIException:
Thrown on parse error.
scanDTDExternalSubsetback to summary
public boolean scanDTDExternalSubset(boolean complete) throws IOException, XNIException

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.scanDTDExternalSubset.

Scans the external subset of the document.

Parameters
complete:boolean

True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.

Returns:boolean

True if there is more to scan, false otherwise.

scanDTDInternalSubsetback to summary
public boolean scanDTDInternalSubset(boolean complete, boolean standalone, boolean hasExternalSubset) throws IOException, XNIException

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.scanDTDInternalSubset.

Scans the internal subset of the document.

Parameters
complete:boolean

True if the scanner should scan the document completely, pushing all events to the registered document handler. A value of false indicates that that the scanner should only scan the next portion of the document and return. A scanner instance is permitted to completely scan a document if it does not support this "pull" scanning model.

standalone:boolean

True if the document was specified as standalone. This value is important for verifying certain well-formedness constraints.

Returns:boolean

True if there is more to scan, false otherwise.

scanElementDeclback to summary
protected final void scanElementDecl() throws IOException, XNIException

Scans an element declaration

[45]    elementdecl    ::=    '<!ELEMENT' S Name S contentspec S? '>'
[46]    contentspec    ::=    'EMPTY' | 'ANY' | Mixed | children

Note

Called after scanning past '<!ELEMENT'

scanEntityDeclback to summary
private final void scanEntityDecl() throws IOException, XNIException

Scans an entity declaration

[70]    EntityDecl  ::=    GEDecl | PEDecl
[71]    GEDecl      ::=    '<!ENTITY' S Name S EntityDef S? '>'
[72]    PEDecl      ::=    '<!ENTITY' S '%' S Name S PEDef S? '>'
[73]    EntityDef   ::=    EntityValue | (ExternalID NDataDecl?)
[74]    PEDef       ::=    EntityValue | ExternalID
[75]    ExternalID  ::=    'SYSTEM' S SystemLiteral
                         | 'PUBLIC' S PubidLiteral S SystemLiteral
[76]    NDataDecl   ::=    S 'NDATA' S Name

Note

Called after scanning past '<!ENTITY'

scanEntityValueback to summary
protected final void scanEntityValue(String entityName, boolean isPEDecl, XMLString value, XMLString nonNormalizedValue) throws IOException, XNIException

Scans an entity value.

Parameters
value:XMLString

The string to fill in with the value.

nonNormalizedValue:XMLString

The string to fill in with the non-normalized value

Note

This method uses fString, fStringBuffer (through the use of scanCharReferenceValue), and fStringBuffer2, anything in them at the time of calling is lost.

scanMixedback to summary
private final void scanMixed(String elName) throws IOException, XNIException

scan Mixed content model This assumes the content model has been parsed up to #PCDATA and can simply append to fStringBuffer.

[51]    Mixed    ::=    '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*'
                      | '(' S? '#PCDATA' S? ')'
Parameters
elName:String

The element type name this declaration is about

Note

Called after scanning past '(#PCDATA'.

scanningInternalSubsetback to summary
protected final boolean scanningInternalSubset()
scanNotationDeclback to summary
private final void scanNotationDecl() throws IOException, XNIException

Scans a notation declaration

[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID|PublicID) S? '>'
[83]  PublicID    ::= 'PUBLIC' S PubidLiteral

Note

Called after scanning past '<!NOTATION'

scanPIDataback to summary
protected final void scanPIData(String target, XMLString data) throws IOException, XNIException

Scans a processing data. This is needed to handle the situation where a document starts with a processing instruction whose target name starts with "xml". (e.g. xmlfoo)

Parameters
target:String

The PI target

data:XMLString

The string to fill in with the data

scanTextDeclback to summary
protected final boolean scanTextDecl() throws IOException, XNIException

Dispatch an XML "event".

Returns:boolean

True if a TextDecl was scanned.

Exceptions
IOException:
Thrown on i/o error.
XNIException:
Thrown on parse error.
setDTDContentModelHandlerback to summary
public void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource.setDTDContentModelHandler.

setDTDContentModelHandler

setDTDHandlerback to summary
public void setDTDHandler(XMLDTDHandler dtdHandler)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource.setDTDHandler.

setDTDHandler

setInputSourceback to summary
public void setInputSource(XMLInputSource inputSource) throws IOException

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.setInputSource.

Sets the input source.

Parameters
inputSource:XMLInputSource

The input source or null.

Exceptions
IOException:
Thrown on i/o error.
setLimitAnalyzerback to summary
public void setLimitAnalyzer(XMLLimitAnalyzer limitAnalyzer)

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.setLimitAnalyzer.

setScannerStateback to summary
protected final void setScannerState(int state)

Sets the scanner state.

Parameters
state:int

The new scanner state.

skipDTDback to summary
public boolean skipDTD(boolean supportDTD) throws IOException

Implements com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner.skipDTD.

Skip the DTD if javax.xml.stream.supportDTD is false.

Parameters
supportDTD:boolean

The value of the property javax.xml.stream.supportDTD.

Returns:boolean

true if DTD is skipped, false otherwise.

Annotations
@Override
Exceptions
IOException:
if i/o error occurs
skipSeparatorback to summary
private boolean skipSeparator(boolean spaceRequired, boolean lookForPERefs) throws IOException, XNIException

Skip separator. This is typically just whitespace but it can also be one or more parameter entity references.

If there are some it "expands them" by calling the corresponding entity from the entity manager.

This is recursive and will process has many refs as possible.

Parameters
spaceRequired:boolean

Specify whether some leading whitespace should be found

lookForPERefs:boolean

Specify whether parameter entity references should be looked for

Returns:boolean

True if any leading whitespace was found or the end of a parameter entity was crossed.

startEntityback to summary
public void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException

Overrides com.sun.org.apache.xerces.internal.impl.XMLScanner.startEntity.

Implements com.sun.org.apache.xerces.internal.impl.XMLEntityHandler.startEntity.

This method notifies of the start of an entity. The DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name.

Parameters
name:String

The name of the entity.

identifier:XMLResourceIdentifier

The resource identifier.

encoding:String

The auto-detected IANA encoding name of the entity stream. This value will be null in those situations where the entity encoding is not auto-detected (e.g. internal entities or a document entity that is parsed from a java.io.Reader).

augs:Augmentations

Additional information that may include infoset augmentations

Exceptions
XNIException:
Thrown by handler to signal an error.
startPEback to summary
protected void startPE(String name, boolean literal) throws IOException, XNIException

start a parameter entity dealing with the textdecl if there is any

Parameters
name:String

The name of the parameter entity to start (without the '%')

literal:boolean

Whether this is happening within a literal