Save This Page
Home » openjdk-7 » com.sun.org.apache.xerces.internal » impl » [javadoc | source]
com.sun.org.apache.xerces.internal.impl
public class: XMLDocumentFragmentScannerImpl [javadoc | source]
java.lang.Object
   com.sun.org.apache.xerces.internal.impl.XMLScanner
      com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl

All Implemented Interfaces:
    XMLComponent, XMLEntityHandler, XMLBufferListener, XMLDocumentScanner

Direct Known Subclasses:
    XML11NSDocumentScannerImpl, XMLDocumentScannerImpl, XMLNSDocumentScannerImpl, XML11DocumentScannerImpl

This class is responsible for scanning the structure and content of document fragments. This class has been modified as per the new design which is more suited to efficiently build pull parser. Lot of improvements have been done and the code has been added to support stax functionality/features.
Nested Class Summary:
protected static final class  XMLDocumentFragmentScannerImpl.Element   
protected class  XMLDocumentFragmentScannerImpl.ElementStack2  Element stack. 
protected 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.Driver  Drives the parser to the next state/event on the input. Parser is guaranteed to stop at the next state/event. Internally XML document is divided into several states. Each state represents a sections of XML document. When this functions returns normally, it has read the section of XML document and returns the state corresponding to section of document which has been read. For optimizations, a particular driver can read ahead of the section of document (state returned) just read and can maintain a different internal state. 
protected class  XMLDocumentFragmentScannerImpl.FragmentContentDriver  Driver to handle content scanning. This driver is capable of reading the fragment of XML document. When it has finished reading fragment of XML documents, it can pass the job of reading to another driver. This class has been modified as per the new design which is more suited to efficiently build pull parser. Lot of performance improvements have been done and the code has been added to support stax functionality/features. 
Field Summary
protected  int fElementAttributeLimit     
protected  ExternalSubsetResolver fExternalSubsetResolver    External subset resolver. 
protected static final  int SCANNER_STATE_START_OF_MARKUP    Scanner state: start of markup. 
protected static final  int SCANNER_STATE_CONTENT    Scanner state: content. 
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_XML_DECL    Scanner state: XML Declaration 
protected static final  int SCANNER_STATE_ROOT_ELEMENT    Scanner state: root element. 
protected static final  int SCANNER_STATE_COMMENT    Scanner state: comment. 
protected static final  int SCANNER_STATE_REFERENCE    Scanner state: reference. 
protected static final  int SCANNER_STATE_ATTRIBUTE     
protected static final  int SCANNER_STATE_ATTRIBUTE_VALUE     
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  int SCANNER_STATE_CHARACTER_DATA    Scanner state: Text declaration. 
protected static final  int SCANNER_STATE_START_ELEMENT_TAG     
protected static final  int SCANNER_STATE_END_ELEMENT_TAG     
protected static final  int SCANNER_STATE_CHAR_REFERENCE     
protected static final  int SCANNER_STATE_BUILT_IN_REFS     
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  char[] cdata     
protected static final  char[] xmlDecl     
protected static final  char[] endTag     
protected static final  boolean DEBUG_START_END_ELEMENT    Debug content driver scanning. 
protected static final  boolean DEBUG_NEXT    Debug driver next 
protected static final  boolean DEBUG    Debug driver next 
protected static final  boolean DEBUG_COALESCE     
protected  XMLDocumentHandler fDocumentHandler    Document handler. 
protected  int fScannerLastState     
protected  XMLEntityStorage fEntityStore    Entity Storage 
protected  int[] fEntityStack    Entity stack. 
protected  int fMarkupDepth    Markup depth. 
protected  boolean fEmptyElement     
protected  boolean fReadingAttributes     
protected  int fScannerState    Scanner state. 
protected  boolean fInScanContent    SubScanner state: inside scanContent method. 
protected  boolean fLastSectionWasCData     
protected  boolean fLastSectionWasEntityReference     
protected  boolean fLastSectionWasCharacterData     
protected  boolean fHasExternalDTD    has external dtd 
protected  boolean fStandalone    Standalone. 
protected  String fVersion     
protected  QName fCurrentElement    Current element. 
protected  XMLDocumentFragmentScannerImpl.ElementStack fElementStack    Element stack. 
protected  XMLDocumentFragmentScannerImpl.ElementStack2 fElementStack2     
protected  String fPITarget    Document system identifier. REVISIT: So what's this used for? - NG protected String fDocumentSystemId; 
protected  XMLString fPIData     
protected  boolean fNotifyBuiltInRefs    Notify built-in references. 
protected  boolean fReplaceEntityReferences     
protected  boolean fSupportExternalEntities     
protected  boolean fReportCdataEvent     
protected  boolean fIsCoalesce     
protected  String fDeclaredEncoding     
protected  XMLDocumentFragmentScannerImpl.Driver fDriver    Active driver. 
protected  XMLDocumentFragmentScannerImpl.Driver fContentDriver    Content driver. 
protected  QName fElementQName    Element QName. 
protected  QName fAttributeQName    Attribute QName. 
protected  XMLAttributesIteratorImpl fAttributes    CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl. This class implements Iterator interface so we can directly give Attributes in the form of iterator. 
protected  XMLString fTempString    String. 
protected  XMLString fTempString2    String. 
protected  XMLStringBuffer fStringBuffer    Making the buffer accesible to derived class -- String buffer. 
protected  XMLStringBuffer fStringBuffer2    Making the buffer accesible to derived class -- String buffer. 
protected  XMLStringBuffer fContentBuffer    Making the buffer accesible to derived class -- stores PI data 
protected  boolean fScanToEnd     
protected  DTDGrammarUtil dtdGrammarUtil     
protected  boolean fAddDefaultAttr     
protected  boolean foundBuiltInRefs     
protected  SecurityManager fSecurityManager     
static final  short MAX_DEPTH_LIMIT     
static final  short ELEMENT_ARRAY_LENGTH     
static final  short MAX_POINTER_AT_A_DEPTH     
static final  boolean DEBUG_SKIP_ALGORITHM     
 String[] fElementArray     
 short fLastPointerLocation     
 short fElementPointer     
 short[][] fPointerInfo     
protected  String fElementRawname     
protected  boolean fShouldSkip     
protected  boolean fAdd     
protected  boolean fSkip     
protected  boolean fUsebuffer     
Fields inherited from com.sun.org.apache.xerces.internal.impl.XMLScanner:
NAMESPACES,  VALIDATION,  NOTIFY_CHAR_REFS,  PARSER_SETTINGS,  SYMBOL_TABLE,  ERROR_REPORTER,  ENTITY_MANAGER,  DEBUG_ATTR_NORMALIZATION,  attributeValueCache,  stringBufferCache,  fStringBufferIndex,  fAttributeCacheInitDone,  fAttributeCacheUsedCount,  fValidation,  fNamespaces,  fNotifyCharRefs,  fParserSettings,  fPropertyManager,  fSymbolTable,  fErrorReporter,  fEntityManager,  fEntityStore,  fEvent,  fEntityScanner,  fEntityDepth,  fCharRefLiteral,  fScanningAttribute,  fReportEntity,  fVersionSymbol,  fEncodingSymbol,  fStandaloneSymbol,  fAmpSymbol,  fLtSymbol,  fGtSymbol,  fQuotSymbol,  fAposSymbol,  fResourceIdentifier,  initialCacheCount
Constructor:
 public XMLDocumentFragmentScannerImpl() 
Method from com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl Summary:
addElement,   canStore,   createContentDriver,   endEntity,   getAttributeIterator,   getCharacterData,   getComment,   getDocumentHandler,   getDriverName,   getElementPointer,   getElementQName,   getEntityName,   getFeatureDefault,   getPIData,   getPITarget,   getPropertyDefault,   getRecognizedFeatures,   getRecognizedProperties,   getScannerStateName,   getString,   hasAttributes,   isStandAlone,   next,   pr,   refresh,   refresh,   reset,   reset,   resetPointer,   scanAttribute,   scanCDATASection,   scanCharReference,   scanComment,   scanContent,   scanDocument,   scanEndElement,   scanEntityReference,   scanPIData,   scanStartElement,   scanXMLDeclOrTextDecl,   seekCloseOfStartTag,   setDocumentHandler,   setDriver,   setFeature,   setInputSource,   setProperty,   setScannerState,   skipElement,   skipElement,   skipFromTheBuffer,   skipQElement,   startEntity,   storePointerForADepth
Methods from com.sun.org.apache.xerces.internal.impl.XMLScanner:
endEntity,   getFeature,   getStringBuffer,   isInvalid,   isInvalidLiteral,   isValidNCName,   isValidNameChar,   isValidNameStartChar,   normalizeWhitespace,   reportFatalError,   reset,   reset,   reset,   scanAttributeValue,   scanCharReferenceValue,   scanComment,   scanExternalID,   scanPI,   scanPIData,   scanPseudoAttribute,   scanPubidLiteral,   scanSurrogates,   scanXMLDeclOrTextDecl,   setFeature,   setProperty,   setPropertyManager,   startEntity,   versionSupported
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl Detail:
  void addElement(String rawname) 
 boolean canStore(short depth,
    short column) 
 protected XMLDocumentFragmentScannerImpl.Driver createContentDriver() 
    Creates a content Driver.
 public  void endEntity(String name,
    Augmentations augs) throws IOException, 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 XMLAttributesIteratorImpl getAttributeIterator() 
    return the attribute iterator implementation
 public XMLString getCharacterData() 
 public String getComment() 
 public XMLDocumentHandler getDocumentHandler() 
    Returns the document handler
 public String getDriverName(XMLDocumentFragmentScannerImpl.Driver driver) 
    Returns the driver name.
 short getElementPointer(short depth,
    short column) 
 public QName getElementQName() 
 public String getEntityName() 
 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 XMLStringBuffer getPIData() 
 public String getPITarget() 
 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 XMLString getString() 
    this function gets an XMLString (which is used to store the attribute value) from the special pool maintained for attributes. fAttributeCacheUsedCount tracks the number of attributes that has been consumed from the pool. if all the attributes has been consumed, it adds a new XMLString inthe pool and returns the same XMLString.
 public boolean hasAttributes() 
 public boolean isStandAlone() 
    return if the doucment is standalone
 public int next() throws IOException, XNIException 
    return the next state on the input
 static  void pr(String str) 
 public  void refresh() 
    Implements XMLBufferListener interface.
 public  void refresh(int refreshPosition) 
 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.
 public  void reset(PropertyManager propertyManager) 
  void resetPointer(short depth,
    short column) 
 protected  void scanAttribute(XMLAttributes attributes) throws IOException, XNIException 
    Scans an attribute name value pair.

    [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(XMLStringBuffer contentBuffer,
    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(XMLStringBuffer content) 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(XMLStringBuffer content) throws IOException, XNIException 
    Scans an entity reference.
 protected  void scanPIData(String target,
    XMLStringBuffer 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. NB: Content in fAttributes is valid only till the state of the parser is XMLEvent.START_ELEMENT

 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 boolean seekCloseOfStartTag() throws IOException, XNIException 
    Looks for the close of start tag, i.e. if it finds '>' or '/>' Characters are consumed.
 public  void setDocumentHandler(XMLDocumentHandler documentHandler) 
    setDocumentHandler
 protected final  void setDriver(XMLDocumentFragmentScannerImpl.Driver driver) 
    Sets the Driver.
 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.
 protected boolean skipElement() throws IOException 
 boolean skipElement(short column) throws IOException 
 boolean skipFromTheBuffer(String rawname) throws IOException 
 boolean skipQElement(String rawname) throws IOException 
 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.
 short storePointerForADepth(short elementPointer)