Top Description Fields Constructors Methods
org.apache.xerces.impl

public Class XMLDTDScannerImpl

extends XMLScanner
implements XMLDTDScanner, XMLComponent, XMLEntityHandler
Class Inheritance
All Implemented Interfaces
org.apache.xerces.impl.XMLEntityHandler, org.apache.xerces.xni.parser.XMLComponent, org.apache.xerces.xni.parser.XMLDTDScanner, org.apache.xerces.xni.parser.XMLDTDContentModelSource, org.apache.xerces.xni.parser.XMLDTDSource
Known Direct Subclasses
org.apache.xerces.impl.XML11DTDScannerImpl
Imports
java.io.IOException, org.apache.xerces.impl.msg.XMLMessageFormatter, org.apache.xerces.util.SymbolTable, .XMLChar, .XMLStringBuffer, .XMLSymbols, org.apache.xerces.xni.Augmentations, .XMLDTDContentModelHandler, .XMLDTDHandler, .XMLResourceIdentifier, .XMLString, .XNIException, org.apache.xerces.xni.parser.XMLComponent, .XMLComponentManager, .XMLConfigurationException, .XMLDTDScanner, .XMLInputSource

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
Version
$Id: XMLDTDScannerImpl.java 1514806 2013-08-16 17:29:02Z mrglavas $

Field Summary

Modifier and TypeField and Description
private static final boolean
DEBUG_SCANNER_STATE

Debug scanner state.

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.

protected 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 final XMLStringBuffer
fIgnoreConditionalBuffer

Ignore conditional section buffer.

private int
fIncludeSectDepth

Number of opened include sections.

private final XMLString
fLiteral

Literal text.

private final 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
fSeenPEReferences

Seen a parameter entity reference.

protected boolean
fStandalone

Standalone.

private boolean
fStartDTDCalled

Start DTD called.

private final XMLString
private final XMLStringBuffer
private final XMLStringBuffer
private final String[]
fStrings

Array of 3 strings.

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 org.apache.xerces.impl.XMLScanner:
DEBUG_ATTR_NORMALIZATIONENTITY_MANAGERERROR_REPORTERfAmpSymbolfAposSymbolfCharRefLiteralfEncodingSymbolfEntityDepthfEntityManagerfEntityScannerfErrorReporterfGtSymbolfLtSymbolfNamespacesfNotifyCharRefsfParserSettingsfQuotSymbolfReportEntityfResourceIdentifierfScanningAttributefStandaloneSymbolfSymbolTablefValidationfVersionSymbolNAMESPACESNOTIFY_CHAR_REFSPARSER_SETTINGSSYMBOL_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
Additional information that may include infoset augmentations
augs
)

Overrides org.apache.xerces.impl.XMLScanner.endEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.endEntity.

This method notifies the end of an entity.
private final void
public XMLDTDContentModelHandler

Returns:

XMLDTDContentModelHandler
getDTDContentModelHandler
()

Implements org.apache.xerces.xni.parser.XMLDTDContentModelSource.getDTDContentModelHandler.

getDTDContentModelHandler
public XMLDTDHandler

Returns:

the XMLDTDHandler
getDTDHandler
()

Implements org.apache.xerces.xni.parser.XMLDTDSource.getDTDHandler.

getDTDHandler
public Boolean
getFeatureDefault(String
The feature identifier.
featureId
)

Implements org.apache.xerces.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 Object
getPropertyDefault(String
The property identifier.
propertyId
)

Implements org.apache.xerces.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 org.apache.xerces.xni.parser.XMLComponent.getRecognizedFeatures.

Returns a list of feature identifiers that are recognized by this component.
public String[]
getRecognizedProperties()

Implements org.apache.xerces.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
protected final String
scanAttDefaultDecl(String elName, String
The name of the attribute being scanned.
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 org.apache.xerces.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
True if the document has an external DTD. This allows the scanner to properly notify the handler of the end of the DTD in the absence of an external subset.
hasExternalSubset
)

Implements org.apache.xerces.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 int

Returns:

Count of direct and indirect references to parameter entities in the value of the entity.
scanEntityValue
(XMLString
The string to fill in with the value.
value
,
XMLString
The string to fill in with the non-normalized value.
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
)

Overrides org.apache.xerces.impl.XMLScanner.scanPIData.

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 org.apache.xerces.xni.parser.XMLDTDScanner.setInputSource.

Sets the input source.
protected final void
setScannerState(int
The new scanner state.
state
)

Sets the scanner state.

private int
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 org.apache.xerces.impl.XMLScanner.startEntity.

Implements org.apache.xerces.impl.XMLEntityHandler.startEntity.

This method notifies of the start of an entity.
protected String

Returns:

The name of the parameter entity (with the '%')
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 org.apache.xerces.impl.XMLScanner:
getFeaturegetVersionNotSupportedKeyisInvalidisInvalidLiteralisUnchangedByNormalizationisValidNameCharisValidNameStartCharisValidNameStartHighSurrogateisValidNCNamenormalizeWhitespacenormalizeWhitespacereportFatalErrorscanAttributeValuescanCharReferenceValuescanCommentscanExternalIDscanPIscanPseudoAttributescanPubidLiteralscanSurrogatesscanXMLDeclOrTextDeclsetFeaturesetPropertyversionSupported

Field Detail

DEBUG_SCANNER_STATEback to summary
private static final boolean DEBUG_SCANNER_STATE

Debug scanner state.

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
protected 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 final XMLStringBuffer fIgnoreConditionalBuffer

Ignore conditional section buffer.

fIncludeSectDepthback to summary
private int fIncludeSectDepth

Number of opened include sections.

fLiteralback to summary
private final XMLString fLiteral

Literal text.

fLiteral2back to summary
private final 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.

fSeenPEReferencesback to summary
protected boolean fSeenPEReferences

Seen a parameter entity reference.

fStandaloneback to summary
protected boolean fStandalone

Standalone.

fStartDTDCalledback to summary
private boolean fStartDTDCalled

Start DTD called.

fStringback to summary
private final XMLString fString

Hides org.apache.xerces.impl.XMLScanner.fString.

String.

fStringBufferback to summary
private final XMLStringBuffer fStringBuffer

Hides org.apache.xerces.impl.XMLScanner.fStringBuffer.

String buffer.

fStringBuffer2back to summary
private final XMLStringBuffer fStringBuffer2

Hides org.apache.xerces.impl.XMLScanner.fStringBuffer2.

String buffer.

fStringsback to summary
private final String[] fStrings

Array of 3 strings.

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

Overrides org.apache.xerces.impl.XMLScanner.endEntity.

Implements org.apache.xerces.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.

augs:Augmentations

Additional information that may include infoset augmentations

Exceptions
XNIException:
Thrown by handler to signal an error.
ensureEnumerationSizeback to summary
private final void ensureEnumerationSize(int size)
getDTDContentModelHandlerback to summary
public XMLDTDContentModelHandler getDTDContentModelHandler()

Implements org.apache.xerces.xni.parser.XMLDTDContentModelSource.getDTDContentModelHandler.

getDTDContentModelHandler

Returns:XMLDTDContentModelHandler

XMLDTDContentModelHandler

getDTDHandlerback to summary
public XMLDTDHandler getDTDHandler()

Implements org.apache.xerces.xni.parser.XMLDTDSource.getDTDHandler.

getDTDHandler

Returns:XMLDTDHandler

the XMLDTDHandler

getFeatureDefaultback to summary
public Boolean getFeatureDefault(String featureId)

Implements org.apache.xerces.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
getPropertyDefaultback to summary
public Object getPropertyDefault(String propertyId)

Implements org.apache.xerces.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 org.apache.xerces.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 org.apache.xerces.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 org.apache.xerces.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 org.apache.xerces.impl.XMLScanner.reset.

Implements org.apache.xerces.xni.parser.XMLComponent.reset.

reset

resetback to summary
public void reset()

Overrides org.apache.xerces.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
atName:String

The name of the attribute being scanned.

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 org.apache.xerces.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 org.apache.xerces.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.

hasExternalSubset:boolean

True if the document has an external DTD. This allows the scanner to properly notify the handler of the end of the DTD in the absence of an external subset.

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 int scanEntityValue(XMLString value, XMLString nonNormalizedValue) throws IOException, XNIException

Scans an entity value.

Note

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

Parameters
value:XMLString

The string to fill in with the value.

nonNormalizedValue:XMLString

The string to fill in with the non-normalized value.

Returns:int

Count of direct and indirect references to parameter entities in the value of the entity.

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

Overrides org.apache.xerces.impl.XMLScanner.scanPIData.

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 org.apache.xerces.xni.parser.XMLDTDContentModelSource.setDTDContentModelHandler.

setDTDContentModelHandler

setDTDHandlerback to summary
public void setDTDHandler(XMLDTDHandler dtdHandler)

Implements org.apache.xerces.xni.parser.XMLDTDSource.setDTDHandler.

setDTDHandler

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

Implements org.apache.xerces.xni.parser.XMLDTDScanner.setInputSource.

Sets the input source.

Parameters
inputSource:XMLInputSource

The input source or null.

Exceptions
IOException:
Thrown on i/o error.
setScannerStateback to summary
protected final void setScannerState(int state)

Sets the scanner state.

Parameters
state:int

The new scanner state.

skipInvalidEnumerationValueback to summary
private int skipInvalidEnumerationValue() throws IOException
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 org.apache.xerces.impl.XMLScanner.startEntity.

Implements org.apache.xerces.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 String 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

Returns:String

The name of the parameter entity (with the '%')