BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.apache.xerces.impl
Class XMLDTDScannerImpl

java.lang.Object
  |
  +--weblogic.apache.xerces.impl.XMLScanner
        |
        +--weblogic.apache.xerces.impl.XMLDTDScannerImpl
Direct Known Subclasses:
XML11DTDScannerImpl

public class XMLDTDScannerImpl
extends XMLScanner
implements XMLDTDScanner, XMLComponent, XMLEntityHandler

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:


Field Summary
protected  XMLDTDContentModelHandler fDTDContentModelHandler
          DTD content model handler.
protected  XMLDTDHandler fDTDHandler
          DTD handler.
protected  int fScannerState
          Scanner state.
protected  boolean fSeenExternalDTD
          Seen external DTD.
protected  boolean fSeenExternalPE
          Seen external parameter entity.
protected  boolean fStandalone
          Standalone.
protected static int SCANNER_STATE_END_OF_INPUT
          Scanner state: end of input.
protected static int SCANNER_STATE_MARKUP_DECL
          Scanner state: markup declaration.
protected static int SCANNER_STATE_TEXT_DECL
          Scanner state: text declaration.
 
Fields inherited from class weblogic.apache.xerces.impl.XMLScanner
DEBUG_ATTR_NORMALIZATION, ENTITY_MANAGER, ERROR_REPORTER, fAmpSymbol, fAposSymbol, fCharRefLiteral, fEncodingSymbol, fEntityDepth, fEntityManager, fEntityScanner, fErrorReporter, fGtSymbol, fLtSymbol, fNotifyCharRefs, fQuotSymbol, fReportEntity, fResourceIdentifier, fScanningAttribute, fStandaloneSymbol, fSymbolTable, fValidation, fVersionSymbol, NOTIFY_CHAR_REFS, SYMBOL_TABLE, VALIDATION
 
Constructor Summary
XMLDTDScannerImpl()
          Default constructor.
XMLDTDScannerImpl(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)
          Constructor for he use of non-XMLComponentManagers.
 
Method Summary
 void endEntity(java.lang.String name)
          This method notifies the end of an entity.
 java.lang.String[] getRecognizedFeatures()
          Returns a list of feature identifiers that are recognized by this component.
 java.lang.String[] getRecognizedProperties()
          Returns a list of property identifiers that are recognized by this component.
 void reset()
           
 void reset(XMLComponentManager componentManager)
          reset
protected  java.lang.String scanAttDefaultDecl(java.lang.String elName, java.lang.String atName, java.lang.String type, XMLString defaultVal, XMLString nonNormalizedDefaultVal)
          Scans an attribute default declaration
protected  void scanAttlistDecl()
          Scans an attlist declaration
protected  void scanComment()
          Scans a comment.
protected  boolean scanDecls(boolean complete)
          Dispatch an XML "event".
 boolean scanDTDExternalSubset(boolean complete)
          Scans the external subset of the document.
 boolean scanDTDInternalSubset(boolean complete, boolean standalone, boolean hasExternalSubset)
          Scans the internal subset of the document.
protected  void scanElementDecl()
          Scans an element declaration
protected  void scanEntityValue(XMLString value, XMLString nonNormalizedValue)
          Scans an entity value.
protected  boolean scanningInternalSubset()
           
protected  void scanPIData(java.lang.String target, XMLString data)
          Scans a processing data.
protected  boolean scanTextDecl()
          Dispatch an XML "event".
 void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler)
          setDTDContentModelHandler
 void setDTDHandler(XMLDTDHandler dtdHandler)
          setDTDHandler
 void setInputSource(XMLInputSource inputSource)
          Sets the input source.
protected  void setScannerState(int state)
          Sets the scanner state.
 void startEntity(java.lang.String name, XMLResourceIdentifier identifier, java.lang.String encoding)
          This method notifies of the start of an entity.
protected  void startPE(java.lang.String name, boolean literal)
          start a parameter entity dealing with the textdecl if there is any
 
Methods inherited from class weblogic.apache.xerces.impl.XMLScanner
getFeature, normalizeWhitespace, reportFatalError, scanAttributeValue, scanCharReferenceValue, scanComment, scanExternalID, scanPI, scanPseudoAttribute, scanPubidLiteral, scanSurrogates, scanXMLDeclOrTextDecl, setFeature, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCANNER_STATE_END_OF_INPUT

protected static final int SCANNER_STATE_END_OF_INPUT
Scanner state: end of input.

SCANNER_STATE_TEXT_DECL

protected static final int SCANNER_STATE_TEXT_DECL
Scanner state: text declaration.

SCANNER_STATE_MARKUP_DECL

protected static final int SCANNER_STATE_MARKUP_DECL
Scanner state: markup declaration.

fDTDHandler

protected XMLDTDHandler fDTDHandler
DTD handler.

fDTDContentModelHandler

protected XMLDTDContentModelHandler fDTDContentModelHandler
DTD content model handler.

fScannerState

protected int fScannerState
Scanner state.

fStandalone

protected boolean fStandalone
Standalone.

fSeenExternalDTD

protected boolean fSeenExternalDTD
Seen external DTD.

fSeenExternalPE

protected boolean fSeenExternalPE
Seen external parameter entity.
Constructor Detail

XMLDTDScannerImpl

public XMLDTDScannerImpl()
Default constructor.

XMLDTDScannerImpl

public XMLDTDScannerImpl(SymbolTable symbolTable,
                         XMLErrorReporter errorReporter,
                         XMLEntityManager entityManager)
Constructor for he use of non-XMLComponentManagers.
Method Detail

setInputSource

public void setInputSource(XMLInputSource inputSource)
                    throws java.io.IOException
Sets the input source.
Specified by:
setInputSource in interface XMLDTDScanner

Parameters:
inputSource - The input source or null.
Throws:
java.io.IOException - Thrown on i/o error.

scanDTDExternalSubset

public boolean scanDTDExternalSubset(boolean complete)
                              throws java.io.IOException,
                                     XNIException
Scans the external subset of the document.
Specified by:
scanDTDExternalSubset in interface XMLDTDScanner

Parameters:
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.

scanDTDInternalSubset

public boolean scanDTDInternalSubset(boolean complete,
                                     boolean standalone,
                                     boolean hasExternalSubset)
                              throws java.io.IOException,
                                     XNIException
Scans the internal subset of the document.
Specified by:
scanDTDInternalSubset in interface XMLDTDScanner

Parameters:
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.
hasExternalDTD - 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.

reset

public void reset(XMLComponentManager componentManager)
           throws XMLConfigurationException
reset
Specified by:
reset in interface XMLComponent

Parameters:
componentManager -  
Overrides:
reset in class XMLScanner

reset

public void reset()

Overrides:
reset in class XMLScanner

getRecognizedFeatures

public java.lang.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.
Specified by:
getRecognizedFeatures in interface XMLComponent


getRecognizedProperties

public java.lang.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.
Specified by:
getRecognizedProperties in interface XMLComponent


setDTDHandler

public void setDTDHandler(XMLDTDHandler dtdHandler)
setDTDHandler

Parameters:
dtdHandler -  

setDTDContentModelHandler

public void setDTDContentModelHandler(XMLDTDContentModelHandler dtdContentModelHandler)
setDTDContentModelHandler

Parameters:
dtdContentModelHandler -  

startEntity

public void startEntity(java.lang.String name,
                        XMLResourceIdentifier identifier,
                        java.lang.String encoding)
                 throws 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.
Specified by:
startEntity in interface XMLEntityHandler

Parameters:
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).
Throws:
XNIException - Thrown by handler to signal an error.
Overrides:
startEntity in class XMLScanner

endEntity

public void endEntity(java.lang.String name)
               throws 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.
Specified by:
endEntity in interface XMLEntityHandler

Parameters:
name - The name of the entity.
Throws:
XNIException - Thrown by handler to signal an error.
Overrides:
endEntity in class XMLScanner

setScannerState

protected final void setScannerState(int state)
Sets the scanner state.

Parameters:
state - The new scanner state.

scanningInternalSubset

protected final boolean scanningInternalSubset()


startPE

protected void startPE(java.lang.String name,
                       boolean literal)
                throws java.io.IOException,
                       XNIException
start a parameter entity dealing with the textdecl if there is any

Parameters:
name - The name of the parameter entity to start (without the '%')
literal - Whether this is happening within a literal

scanTextDecl

protected final boolean scanTextDecl()
                              throws java.io.IOException,
                                     XNIException
Dispatch an XML "event".

Parameters:
complete - True if this method is intended to scan and dispatch as much as possible.
Throws:
java.io.IOException - Thrown on i/o error.
XNIException - Thrown on parse error.

scanPIData

protected final void scanPIData(java.lang.String target,
                                XMLString data)
                         throws java.io.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 - The PI target
data - The string to fill in with the data
Overrides:
scanPIData in class XMLScanner

scanComment

protected final void scanComment()
                          throws java.io.IOException,
                                 XNIException
Scans a comment.

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

Note: Called after scanning past '<!--'


scanElementDecl

protected final void scanElementDecl()
                              throws java.io.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'


scanAttlistDecl

protected final void scanAttlistDecl()
                              throws java.io.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'


scanAttDefaultDecl

protected final java.lang.String scanAttDefaultDecl(java.lang.String elName,
                                                    java.lang.String atName,
                                                    java.lang.String type,
                                                    XMLString defaultVal,
                                                    XMLString nonNormalizedDefaultVal)
                                             throws java.io.IOException,
                                                    XNIException
Scans an attribute default declaration

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

Parameters:
name - The name of the attribute being scanned.
defaultVal - The string to fill in with the default value.

scanEntityValue

protected final void scanEntityValue(XMLString value,
                                     XMLString nonNormalizedValue)
                              throws java.io.IOException,
                                     XNIException
Scans an entity value.

Parameters:
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.

scanDecls

protected final boolean scanDecls(boolean complete)
                           throws java.io.IOException,
                                  XNIException
Dispatch an XML "event".

Parameters:
complete - True if this method is intended to scan and dispatch as much as possible.
Throws:
java.io.IOException - Thrown on i/o error.
XNIException - Thrown on parse error.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81