Home » Xerces-J-src.2.9.1 » org.apache.xerces » impl » [javadoc | source]
org.apache.xerces.impl
public class: XMLDocumentFragmentScannerImpl [javadoc | source]
java.lang.Object
   org.apache.xerces.impl.XMLScanner
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl

All Implemented Interfaces:
    XMLComponent, XMLEntityHandler, XMLDocumentScanner

Direct Known Subclasses:
    XMLNSDocumentScannerImpl, XML11NSDocumentScannerImpl, XML11DocumentScannerImpl, XMLDocumentScannerImpl

This class is responsible for scanning the structure and content of document fragments. The scanner acts as the source for the document information which is communicated to the document handler.

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

Nested Class Summary:
protected static class  XMLDocumentFragmentScannerImpl.ElementStack  Element stack. This stack operates without synchronization, error checking, and it re-uses objects instead of throwing popped items away. 
protected interface  XMLDocumentFragmentScannerImpl.Dispatcher  This interface defines an XML "event" dispatching model. Classes that implement this interface are responsible for scanning parts of the XML document and dispatching callbacks. 
protected class  XMLDocumentFragmentScannerImpl.FragmentContentDispatcher  Dispatcher to handle content scanning. 
Field Summary
protected static final  int SCANNER_STATE_START_OF_MARKUP    Scanner state: start of markup. 
protected static final  int SCANNER_STATE_COMMENT    Scanner state: comment. 
protected static final  int SCANNER_STATE_PI    Scanner state: processing instruction. 
protected static final  int SCANNER_STATE_DOCTYPE    Scanner state: DOCTYPE. 
protected static final  int SCANNER_STATE_ROOT_ELEMENT    Scanner state: root element. 
protected static final  int SCANNER_STATE_CONTENT    Scanner state: content. 
protected static final  int SCANNER_STATE_REFERENCE    Scanner state: reference. 
protected static final  int SCANNER_STATE_END_OF_INPUT    Scanner state: end of input. 
protected static final  int SCANNER_STATE_TERMINATED    Scanner state: terminated. 
protected static final  int SCANNER_STATE_CDATA    Scanner state: CDATA section. 
protected static final  int SCANNER_STATE_TEXT_DECL    Scanner state: Text declaration. 
protected static final  String NAMESPACES    Feature identifier: namespaces. 
protected static final  String NOTIFY_BUILTIN_REFS    Feature identifier: notify built-in refereces. 
protected static final  String ENTITY_RESOLVER    Property identifier: entity resolver. 
protected static final  boolean DEBUG_CONTENT_SCANNING    Debug content dispatcher scanning. 
protected  XMLDocumentHandler fDocumentHandler    Document handler. 
protected  int[] fEntityStack    Entity stack. 
protected  int fMarkupDepth    Markup depth. 
protected  int fScannerState    Scanner state. 
protected  boolean fInScanContent    SubScanner state: inside scanContent method. 
protected  boolean fHasExternalDTD    has external dtd 
protected  boolean fStandalone    Standalone. 
protected  boolean fIsEntityDeclaredVC    True if [Entity Declared] is a VC; false if it is a WFC. 
protected  ExternalSubsetResolver fExternalSubsetResolver    External subset resolver. 
protected  QName fCurrentElement    Current element. 
protected final  XMLDocumentFragmentScannerImpl.ElementStack fElementStack    Element stack. 
protected  boolean fNotifyBuiltInRefs    Notify built-in references. 
protected  XMLDocumentFragmentScannerImpl.Dispatcher fDispatcher    Active dispatcher. 
protected final  XMLDocumentFragmentScannerImpl.Dispatcher fContentDispatcher    Content dispatcher. 
protected final  QName fElementQName    Element QName. 
protected final  QName fAttributeQName    Attribute QName. 
protected final  XMLAttributesImpl fAttributes    Element attributes. 
protected final  XMLString fTempString    String. 
protected final  XMLString fTempString2    String. 
Fields inherited from org.apache.xerces.impl.XMLScanner:
VALIDATION,  NAMESPACES,  NOTIFY_CHAR_REFS,  PARSER_SETTINGS,  SYMBOL_TABLE,  ERROR_REPORTER,  ENTITY_MANAGER,  DEBUG_ATTR_NORMALIZATION,  fValidation,  fNamespaces,  fNotifyCharRefs,  fParserSettings,  fSymbolTable,  fErrorReporter,  fEntityManager,  fEntityScanner,  fEntityDepth,  fCharRefLiteral,  fScanningAttribute,  fReportEntity,  fVersionSymbol,  fEncodingSymbol,  fStandaloneSymbol,  fAmpSymbol,  fLtSymbol,  fGtSymbol,  fQuotSymbol,  fAposSymbol,  fResourceIdentifier
Constructor:
 public XMLDocumentFragmentScannerImpl() 
Method from org.apache.xerces.impl.XMLDocumentFragmentScannerImpl Summary:
createContentDispatcher,   endEntity,   getDispatcherName,   getDocumentHandler,   getFeatureDefault,   getPropertyDefault,   getRecognizedFeatures,   getRecognizedProperties,   getScannerStateName,   handleEndElement,   reset,   scanAttribute,   scanCDATASection,   scanCharReference,   scanComment,   scanContent,   scanDocument,   scanEndElement,   scanEntityReference,   scanPIData,   scanStartElement,   scanStartElementAfterName,   scanStartElementName,   scanXMLDeclOrTextDecl,   setDispatcher,   setDocumentHandler,   setFeature,   setInputSource,   setProperty,   setScannerState,   startEntity
Methods from org.apache.xerces.impl.XMLScanner:
endEntity,   getFeature,   getVersionNotSupportedKey,   isInvalid,   isInvalidLiteral,   isUnchangedByNormalization,   isValidNCName,   isValidNameChar,   isValidNameStartChar,   isValidNameStartHighSurrogate,   normalizeWhitespace,   normalizeWhitespace,   reportFatalError,   reset,   reset,   scanAttributeValue,   scanCharReferenceValue,   scanComment,   scanExternalID,   scanPI,   scanPIData,   scanPseudoAttribute,   scanPubidLiteral,   scanSurrogates,   scanXMLDeclOrTextDecl,   setFeature,   setProperty,   startEntity,   versionSupported
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xerces.impl.XMLDocumentFragmentScannerImpl Detail:
 protected XMLDocumentFragmentScannerImpl.Dispatcher createContentDispatcher() 
    Creates a content dispatcher.
 public  void endEntity(String name,
    Augmentations augs) 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.
 public String getDispatcherName(XMLDocumentFragmentScannerImpl.Dispatcher dispatcher) 
    Returns the dispatcher name.
 public XMLDocumentHandler getDocumentHandler() 
    Returns the document handler
 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.
 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.
 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.
 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.
 protected String getScannerStateName(int state) 
    Returns the scanner state name.
 protected int handleEndElement(QName element,
    boolean isEmpty) throws XNIException 
    Handles the end element. This method will make sure that the end element name matches the current element and notify the handler about the end of the element and the end of any relevent prefix mappings.

    Note: This method uses the fQName variable. The contents of this variable will be destroyed.

 public  void reset(XMLComponentManager componentManager) throws XMLConfigurationException 
    Resets the component. The component can query the component manager about any features and properties that affect the operation of the component.
 protected  void scanAttribute(XMLAttributes attributes) throws IOException, XNIException 
    Scans an attribute.

    [41] Attribute ::= Name Eq AttValue
    

    Note: This method assumes that the next character on the stream is the first character of the attribute name.

    Note: This method uses the fAttributeQName and fQName variables. The contents of these variables will be destroyed.

 protected boolean scanCDATASection(boolean complete) throws IOException, XNIException 
    Scans a CDATA section.

    Note: This method uses the fTempString and fStringBuffer variables.

 protected  void scanCharReference() throws IOException, XNIException 
    Scans a character reference.

    [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
    
 protected  void scanComment() throws IOException, XNIException 
    Scans a comment.

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

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

 protected int scanContent() throws IOException, XNIException 
    Scans element content.
 public boolean scanDocument(boolean complete) throws IOException, XNIException 
    Scans a document.
 protected int scanEndElement() throws IOException, XNIException 
    Scans an end element.

    [42] ETag ::= '</' Name S? '>'
    

    Note: This method uses the fElementQName variable. The contents of this variable will be destroyed. The caller should copy the needed information out of this variable before calling this method.

 protected  void scanEntityReference() throws IOException, XNIException 
    Scans an entity reference.
 protected  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)
 protected boolean scanStartElement() throws IOException, XNIException 
    Scans a start element. This method will handle the binding of namespace information and notifying the handler of the start of the element.

    [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
    [40] STag ::= '<' Name (S Attribute)* S? '>'
    

    Note: This method assumes that the leading '<' character has been consumed.

    Note: This method uses the fElementQName and fAttributes variables. The contents of these variables will be destroyed. The caller should copy important information out of these variables before calling this method.

 protected boolean scanStartElementAfterName() throws IOException, XNIException 
    Scans the remainder of a start or empty tag after the element name.
 protected  void scanStartElementName() throws IOException, XNIException 
    Scans the name of an element in a start or empty tag.
 protected  void scanXMLDeclOrTextDecl(boolean scanningTextDecl) throws IOException, XNIException 
    Scans an XML or text declaration.

    [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
    [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
    [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" )
    [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
    [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'")
    | ('"' ('yes' | 'no') '"'))
    
    [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
    
 protected final  void setDispatcher(XMLDocumentFragmentScannerImpl.Dispatcher dispatcher) 
    Sets the dispatcher.
 public  void setDocumentHandler(XMLDocumentHandler documentHandler) 
    setDocumentHandler
 public  void setFeature(String featureId,
    boolean state) throws XMLConfigurationException 
    Sets the state of a feature. This method is called by the component manager any time after reset when a feature changes state.

    Note: Components should silently ignore features that do not affect the operation of the component.

 public  void setInputSource(XMLInputSource inputSource) throws IOException 
    Sets the input source.
 public  void setProperty(String propertyId,
    Object value) throws XMLConfigurationException 
    Sets the value of a property. This method is called by the component manager any time after reset when a property changes value.

    Note: Components should silently ignore properties that do not affect the operation of the component.

 protected final  void setScannerState(int state) 
    Sets the scanner state.
 public  void startEntity(String name,
    XMLResourceIdentifier identifier,
    String encoding,
    Augmentations augs) 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.