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:
- http://xml.org/sax/features/validation
- http://apache.org/xml/features/scanner/notify-char-refs
- http://apache.org/xml/properties/internal/symbol-table
- http://apache.org/xml/properties/internal/error-reporter
- http://apache.org/xml/properties/internal/entity-manager
SCANNER_STATE_END_OF_INPUT
protected static final int SCANNER_STATE_END_OF_INPUT
Scanner state: end of input.
SCANNER_STATE_MARKUP_DECL
protected static final int SCANNER_STATE_MARKUP_DECL
Scanner state: markup declaration.
SCANNER_STATE_TEXT_DECL
protected static final int SCANNER_STATE_TEXT_DECL
Scanner state: text declaration.
fDTDContentModelHandler
protected org.apache.xerces.xni.XMLDTDContentModelHandler fDTDContentModelHandler
DTD content model handler.
fDTDHandler
protected org.apache.xerces.xni.XMLDTDHandler fDTDHandler
DTD handler.
fScannerState
protected int fScannerState
Scanner state.
fSeenExternalDTD
protected boolean fSeenExternalDTD
Seen external DTD.
fSeenExternalPE
protected boolean fSeenExternalPE
Seen external parameter entity.
fStandalone
protected boolean fStandalone
Standalone.
endEntity
public void endEntity(String name,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
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.
- endEntity in interface XMLEntityHandler
- endEntity in interface XMLScanner
name
- The name of the entity.augs
- Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.
getDTDContentModelHandler
public org.apache.xerces.xni.XMLDTDContentModelHandler getDTDContentModelHandler()
getDTDContentModelHandler
- getDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLDTDContentModelSource
- XMLDTDContentModelHandler
getDTDHandler
public org.apache.xerces.xni.XMLDTDHandler getDTDHandler()
getDTDHandler
- getDTDHandler in interface org.apache.xerces.xni.parser.XMLDTDSource
getFeatureDefault
public Boolean getFeatureDefault(String featureId)
Returns the default state for a feature, or null if this
component does not want to report a default value for this
feature.
- getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponent
featureId
- The feature identifier.
getPropertyDefault
public Object getPropertyDefault(String propertyId)
Returns the default state for a property, or null if this
component does not want to report a default value for this
property.
- getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponent
propertyId
- The property identifier.
getRecognizedFeatures
public String[] 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.
- getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
getRecognizedProperties
public String[] 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.
- getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
reset
public void reset(org.apache.xerces.xni.parser.XMLComponentManager componentManager)
throws org.apache.xerces.xni.parser.XMLConfigurationException
reset
- reset in interface org.apache.xerces.xni.parser.XMLComponent
- reset in interface XMLScanner
scanAttDefaultDecl
protected final String scanAttDefaultDecl(String elName,
String atName,
String type,
org.apache.xerces.xni.XMLString defaultVal,
org.apache.xerces.xni.XMLString nonNormalizedDefaultVal)
throws IOException,
org.apache.xerces.xni.XNIException
Scans an attribute default declaration
[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
defaultVal
- The string to fill in with the default value.
scanAttlistDecl
protected final void scanAttlistDecl()
throws IOException,
org.apache.xerces.xni.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'
scanComment
protected final void scanComment()
throws IOException,
org.apache.xerces.xni.XNIException
Scans a comment.
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
scanDTDExternalSubset
public boolean scanDTDExternalSubset(boolean complete)
throws IOException,
org.apache.xerces.xni.XNIException
Scans the external subset of the document.
- scanDTDExternalSubset in interface org.apache.xerces.xni.parser.XMLDTDScanner
complete
- 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.
- True if there is more to scan, false otherwise.
scanDTDInternalSubset
public boolean scanDTDInternalSubset(boolean complete,
boolean standalone,
boolean hasExternalSubset)
throws IOException,
org.apache.xerces.xni.XNIException
Scans the internal subset of the document.
- scanDTDInternalSubset in interface org.apache.xerces.xni.parser.XMLDTDScanner
complete
- 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
- True if the document was specified as standalone.
This value is important for verifying certain
well-formedness constraints.
- True if there is more to scan, false otherwise.
scanDecls
protected final boolean scanDecls(boolean complete)
throws IOException,
org.apache.xerces.xni.XNIException
Dispatch an XML "event".
complete
- True if this method is intended to scan
and dispatch as much as possible.
- True if there is more to scan.
org.apache.xerces.xni.XNIException
- Thrown on parse error.
scanElementDecl
protected final void scanElementDecl()
throws IOException,
org.apache.xerces.xni.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'
scanEntityValue
protected final void scanEntityValue(org.apache.xerces.xni.XMLString value,
org.apache.xerces.xni.XMLString nonNormalizedValue)
throws IOException,
org.apache.xerces.xni.XNIException
Scans an entity value.
value
- The string to fill in with the value.nonNormalizedValue
- 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.
scanPIData
protected final void scanPIData(String target,
org.apache.xerces.xni.XMLString data)
throws IOException,
org.apache.xerces.xni.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)
- scanPIData in interface XMLScanner
target
- The PI targetdata
- The string to fill in with the data
scanTextDecl
protected final boolean scanTextDecl()
throws IOException,
org.apache.xerces.xni.XNIException
Dispatch an XML "event".
- True if a TextDecl was scanned.
org.apache.xerces.xni.XNIException
- Thrown on parse error.
scanningInternalSubset
protected final boolean scanningInternalSubset()
setDTDContentModelHandler
public void setDTDContentModelHandler(org.apache.xerces.xni.XMLDTDContentModelHandler dtdContentModelHandler)
setDTDContentModelHandler
- setDTDContentModelHandler in interface org.apache.xerces.xni.parser.XMLDTDContentModelSource
setDTDHandler
public void setDTDHandler(org.apache.xerces.xni.XMLDTDHandler dtdHandler)
setDTDHandler
- setDTDHandler in interface org.apache.xerces.xni.parser.XMLDTDSource
setInputSource
public void setInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
throws IOException
Sets the input source.
- setInputSource in interface org.apache.xerces.xni.parser.XMLDTDScanner
inputSource
- The input source or null.
setScannerState
protected final void setScannerState(int state)
Sets the scanner state.
state
- The new scanner state.
startEntity
public void startEntity(String name,
org.apache.xerces.xni.XMLResourceIdentifier identifier,
String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
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.
- startEntity in interface XMLEntityHandler
- startEntity in interface XMLScanner
name
- The name of the entity.identifier
- The resource identifier.encoding
- 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
- Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException
- Thrown by handler to signal an error.
startPE
protected void startPE(String name,
boolean literal)
throws IOException,
org.apache.xerces.xni.XNIException
start a parameter entity dealing with the textdecl if there is any
name
- The name of the parameter entity to start (without the '%')literal
- Whether this is happening within a literal