| |
|
| java.lang.Object com.sun.xml.stream.XMLScanner com.sun.xml.stream.XMLDocumentFragmentScannerImpl
All known Subclasses: com.sun.xml.stream.XMLDocumentScannerImpl,
XMLDocumentFragmentScannerImpl | public class XMLDocumentFragmentScannerImpl extends XMLScanner implements XMLDocumentScanner,XMLComponent,XMLEntityHandler(Code) | | 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.
author: Neeraj Bajaj SUN Microsystems author: K.Venugopal SUN Microsystems author: Glenn Marcy, IBM author: Andy Clark, IBM author: Arnaud Le Hors, IBM author: Eric Ye, IBM author: Sunitha Reddy SUN Microsystems version: $Id: XMLDocumentFragmentScannerImpl.java,v 1.5 2006/11/29 22:01:32 spericas Exp $ |
Inner Class :final protected static class Element | |
Inner Class :protected class ElementStack2 | |
Inner Class :protected class ElementStack | |
Inner Class :protected interface Driver | |
Inner Class :protected class FragmentContentDriver implements Driver | |
Method Summary | |
void | addElement(String rawname) | boolean | canStore(short depth, short column) | protected Driver | createContentDriver() Creates a content Driver. | public void | endEntity(String name) This method notifies the end of an entity. | public XMLAttributesIteratorImpl | getAttributeIterator() | public XMLString | getCharacterData() | public String | getComment() | public XMLDocumentHandler | getDocumentHandler() | public String | getDriverName(Driver driver) Returns the driver name. | short | getElementPointer(short depth, short column) | 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. | public String[] | getRecognizedProperties() Returns a list of property identifiers that are recognized by
this component. | protected String | getScannerStateName(int state) Returns the scanner state name. | public boolean | hasAttributes() | public boolean | isStandAlone() | public int | next() | static void | pr(String str) | public void | reset(XMLComponentManager componentManager) Resets the component. | public void | reset(PropertyManager propertyManager) | void | resetPointer(short depth, short column) | protected void | scanAttribute(XMLAttributes attributes) 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. | protected boolean | scanCDATASection(XMLStringBuffer contentBuffer, boolean complete) Scans a CDATA section.
Note: This method uses the fTempString and
fStringBuffer variables.
Parameters: complete - True if the CDATA section is to be scannedcompletely. | protected void | scanCharReference() Scans a character reference. | protected void | scanComment() Scans a comment. | protected int | scanContent(XMLStringBuffer content) Scans element content. | public boolean | scanDocument(boolean complete) Scans a document.
Parameters: complete - True if the scanner should scan the documentcompletely, pushing all events to the registereddocument handler. | protected int | scanEndElement() Scans an end element.
[42] ETag ::= '</' Name S? '>'
Note: This method uses the fElementQName variable.
The contents of this variable will be destroyed. | protected void | scanEntityReference(XMLStringBuffer content) Scans an entity reference.
returns true if the new entity is started. | protected void | scanPIData(String target, XMLStringBuffer data) Scans a processing data. | protected boolean | scanStartElement() Scans a start element. | protected void | scanXMLDeclOrTextDecl(boolean scanningTextDecl) Scans an XML or text declaration. | public void | setDocumentHandler(XMLDocumentHandler documentHandler) | final protected void | setDriver(Driver driver) Sets the Driver. | public void | setFeature(String featureId, boolean state) Sets the state of a feature. | public void | setInputSource(XMLInputSource inputSource) Sets the input source. | public void | setProperty(String propertyId, Object value) Sets the value of a property. | final protected void | setScannerState(int state) Sets the scanner state. | protected boolean | skipElement() | boolean | skipElement(short column) | boolean | skipFromTheBuffer(String rawname) | boolean | skipQElement(QName name) | boolean | skipQElement(String rawname) | public void | startEntity(String name, XMLResourceIdentifier identifier, String encoding) This method notifies of the start of an entity. | short | storePointerForADepth(short elementPointer) |
DEBUG | final protected static boolean DEBUG(Code) | | Debug driver next
|
DEBUG_COALESCE | final protected static boolean DEBUG_COALESCE(Code) | | |
DEBUG_CONTENT_SCANNING | final protected static boolean DEBUG_CONTENT_SCANNING(Code) | | Debug content driver scanning.
|
DEBUG_NEXT | final protected static boolean DEBUG_NEXT(Code) | | Debug driver next
|
DEBUG_SKIP_ALGORITHM | final static boolean DEBUG_SKIP_ALGORITHM(Code) | | |
ELEMENT_ARRAY_LENGTH | final static short ELEMENT_ARRAY_LENGTH(Code) | | |
MAX_DEPTH_LIMIT | final static short MAX_DEPTH_LIMIT(Code) | | |
MAX_POINTER_AT_A_DEPTH | final static short MAX_POINTER_AT_A_DEPTH(Code) | | |
NAMESPACES | final protected static String NAMESPACES(Code) | | Feature identifier: namespaces.
|
NOTIFY_BUILTIN_REFS | final protected static String NOTIFY_BUILTIN_REFS(Code) | | Feature identifier: notify built-in refereces.
|
SCANNER_STATE_ATTRIBUTE | final protected static int SCANNER_STATE_ATTRIBUTE(Code) | | |
SCANNER_STATE_ATTRIBUTE_VALUE | final protected static int SCANNER_STATE_ATTRIBUTE_VALUE(Code) | | |
SCANNER_STATE_BUILT_IN_REFS | final protected static int SCANNER_STATE_BUILT_IN_REFS(Code) | | |
SCANNER_STATE_CDATA | final protected static int SCANNER_STATE_CDATA(Code) | | Scanner state: CDATA section.
|
SCANNER_STATE_CHARACTER_DATA | final protected static int SCANNER_STATE_CHARACTER_DATA(Code) | | Scanner state: Text declaration.
|
SCANNER_STATE_CHAR_REFERENCE | final protected static int SCANNER_STATE_CHAR_REFERENCE(Code) | | |
SCANNER_STATE_COMMENT | final protected static int SCANNER_STATE_COMMENT(Code) | | Scanner state: comment.
|
SCANNER_STATE_CONTENT | final protected static int SCANNER_STATE_CONTENT(Code) | | Scanner state: content.
|
SCANNER_STATE_DOCTYPE | final protected static int SCANNER_STATE_DOCTYPE(Code) | | Scanner state: DOCTYPE.
|
SCANNER_STATE_END_ELEMENT_TAG | final protected static int SCANNER_STATE_END_ELEMENT_TAG(Code) | | |
SCANNER_STATE_END_OF_INPUT | final protected static int SCANNER_STATE_END_OF_INPUT(Code) | | Scanner state: end of input.
|
SCANNER_STATE_PI | final protected static int SCANNER_STATE_PI(Code) | | Scanner state: processing instruction.
|
SCANNER_STATE_REFERENCE | final protected static int SCANNER_STATE_REFERENCE(Code) | | Scanner state: reference.
|
SCANNER_STATE_ROOT_ELEMENT | final protected static int SCANNER_STATE_ROOT_ELEMENT(Code) | | Scanner state: root element.
|
SCANNER_STATE_START_ELEMENT_TAG | final protected static int SCANNER_STATE_START_ELEMENT_TAG(Code) | | |
SCANNER_STATE_START_OF_MARKUP | final protected static int SCANNER_STATE_START_OF_MARKUP(Code) | | Scanner state: start of markup.
|
SCANNER_STATE_TERMINATED | final protected static int SCANNER_STATE_TERMINATED(Code) | | Scanner state: terminated.
|
SCANNER_STATE_TEXT_DECL | final protected static int SCANNER_STATE_TEXT_DECL(Code) | | Scanner state: Text declaration.
|
SCANNER_STATE_XML_DECL | final protected static int SCANNER_STATE_XML_DECL(Code) | | Scanner state: XML Declaration
|
cdata | final protected static char[] cdata(Code) | | |
endTag | final protected static char[] endTag(Code) | | |
fAdd | protected boolean fAdd(Code) | | |
fAddDefaultAttr | protected boolean fAddDefaultAttr(Code) | | |
fAttributeQName | protected QName fAttributeQName(Code) | | Attribute QName.
|
fAttributes | protected XMLAttributesIteratorImpl fAttributes(Code) | | CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl. This class
implements Iterator interface so we can directly give Attributes in the form of
iterator.
|
fContentBuffer | protected XMLStringBuffer fContentBuffer(Code) | | Making the buffer accesible to derived class -- stores PI data
|
fContentDriver | protected Driver fContentDriver(Code) | | Content driver.
|
fCurrentElement | protected QName fCurrentElement(Code) | | Current element.
|
fDriver | protected Driver fDriver(Code) | | Active driver.
|
fElementPointer | short fElementPointer(Code) | | |
fElementQName | protected QName fElementQName(Code) | | Element QName.
|
fElementStack | protected ElementStack fElementStack(Code) | | Element stack.
|
fElementStack2 | protected ElementStack2 fElementStack2(Code) | | |
fEmptyElement | protected boolean fEmptyElement(Code) | | |
fEntityStack | protected int[] fEntityStack(Code) | | Entity stack.
|
fHasExternalDTD | protected boolean fHasExternalDTD(Code) | | has external dtd
|
fInScanContent | protected boolean fInScanContent(Code) | | SubScanner state: inside scanContent method.
|
fIsCoalesce | protected boolean fIsCoalesce(Code) | | |
fLastPointerLocation | short fLastPointerLocation(Code) | | |
fLastSectionWasCData | protected boolean fLastSectionWasCData(Code) | | |
fLastSectionWasCharacterData | protected boolean fLastSectionWasCharacterData(Code) | | |
fLastSectionWasEntityReference | protected boolean fLastSectionWasEntityReference(Code) | | |
fMarkupDepth | protected int fMarkupDepth(Code) | | Markup depth.
|
fNamespaces | protected boolean fNamespaces(Code) | | Namespaces.
|
fNotifyBuiltInRefs | protected boolean fNotifyBuiltInRefs(Code) | | Notify built-in references.
|
fPITarget | protected String fPITarget(Code) | | Document system identifier.
REVISIT: So what's this used for? - NG
protected String fDocumentSystemId;
|
fPointerInfo | short[][] fPointerInfo(Code) | | |
fReplaceEntityReferences | protected boolean fReplaceEntityReferences(Code) | | |
fReportCdataEvent | protected boolean fReportCdataEvent(Code) | | |
fScanToEnd | protected boolean fScanToEnd(Code) | | |
fScannerState | protected int fScannerState(Code) | | Scanner state.
|
fShouldSkip | protected boolean fShouldSkip(Code) | | |
fSkip | protected boolean fSkip(Code) | | |
fStandalone | protected boolean fStandalone(Code) | | Standalone.
|
fStringBuffer | protected XMLStringBuffer fStringBuffer(Code) | | Making the buffer accesible to derived class -- String buffer.
|
fStringBuffer2 | protected XMLStringBuffer fStringBuffer2(Code) | | Making the buffer accesible to derived class -- String buffer.
|
fSupportExternalEntities | protected boolean fSupportExternalEntities(Code) | | |
fUsebuffer | boolean fUsebuffer(Code) | | |
foundBuiltInRefs | protected boolean foundBuiltInRefs(Code) | | |
xmlDecl | final protected static char[] xmlDecl(Code) | | |
XMLDocumentFragmentScannerImpl | public XMLDocumentFragmentScannerImpl()(Code) | | Default constructor.
|
canStore | boolean canStore(short depth, short column)(Code) | | |
createContentDriver | protected Driver createContentDriver()(Code) | | Creates a content Driver.
|
endEntity | public void endEntity(String name) throws IOException, XNIException(Code) | | 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 - The name of the entity. throws: XNIException - Thrown by handler to signal an error. |
getDriverName | public String getDriverName(Driver driver)(Code) | | Returns the driver name.
|
getElementPointer | short getElementPointer(short depth, short column)(Code) | | |
getFeatureDefault | public Boolean getFeatureDefault(String featureId)(Code) | | 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 - The feature identifier. since: Xerces 2.2.0 |
getPropertyDefault | public Object getPropertyDefault(String propertyId)(Code) | | 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 - The property identifier. since: Xerces 2.2.0 |
getRecognizedFeatures | public String[] getRecognizedFeatures()(Code) | | 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.
|
getRecognizedProperties | public String[] getRecognizedProperties()(Code) | | 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.
|
getScannerStateName | protected String getScannerStateName(int state)(Code) | | Returns the scanner state name.
|
hasAttributes | public boolean hasAttributes()(Code) | | |
isStandAlone | public boolean isStandAlone()(Code) | | return if the doucment is standalone
|
reset | public void reset(XMLComponentManager componentManager) throws XMLConfigurationException(Code) | | Resets the component. The component can query the component manager
about any features and properties that affect the operation of the
component.
Parameters: componentManager - The component manager. throws: SAXException - Thrown by component on initialization error.For example, if a feature or property isrequired for the operation of the component, thecomponent manager may throw aSAXNotRecognizedException or aSAXNotSupportedException. |
resetPointer | void resetPointer(short depth, short column)(Code) | | |
scanAttribute | protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException(Code) | | 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.
Parameters: attributes - The attributes list for the scanned attribute. |
scanCDATASection | protected boolean scanCDATASection(XMLStringBuffer contentBuffer, boolean complete) throws IOException, XNIException(Code) | | Scans a CDATA section.
Note: This method uses the fTempString and
fStringBuffer variables.
Parameters: complete - True if the CDATA section is to be scannedcompletely. True if CDATA is completely scanned. |
scanCharReference | protected void scanCharReference() throws IOException, XNIException(Code) | | Scans a character reference.
[66] CharRef ::= '' [0-9]+ ';' | '' [0-9a-fA-F]+ ';'
|
scanComment | protected void scanComment() throws IOException, XNIException(Code) | | Scans a comment.
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Note: Called after scanning past '<!--'
|
scanDocument | public boolean scanDocument(boolean complete) throws IOException, XNIException(Code) | | Scans a document.
Parameters: complete - True if the scanner should scan the documentcompletely, pushing all events to the registereddocument handler. A value of false indicates thatthat the scanner should only scan the next portionof the document and return. A scanner instance ispermitted to completely scan a document if it doesnot support this "pull" scanning model. True if there is more to scan, false otherwise. |
scanEndElement | protected int scanEndElement() throws IOException, XNIException(Code) | | 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.
The element depth. |
scanEntityReference | protected void scanEntityReference(XMLStringBuffer content) throws IOException, XNIException(Code) | | Scans an entity reference.
returns true if the new entity is started. If it was built-in entity 'false' is returned. throws: IOException - Thrown if i/o error occurs. throws: XNIException - Thrown if handler throws exception uponnotification. |
scanPIData | protected void scanPIData(String target, XMLStringBuffer data) throws IOException, XNIException(Code) | | 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 Parameters: data - The XMLStringBuffer to fill in with the data |
scanStartElement | protected boolean scanStartElement() throws IOException, XNIException(Code) | | 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
True if element is empty. (i.e. It matchesproduction [44]. |
scanXMLDeclOrTextDecl | protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl) throws IOException, XNIException(Code) | | 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? '?>'
Parameters: scanningTextDecl - True if a text declaration is tobe scanned instead of an XMLdeclaration. |
setDocumentHandler | public void setDocumentHandler(XMLDocumentHandler documentHandler)(Code) | | setDocumentHandler
Parameters: documentHandler - |
setDriver | final protected void setDriver(Driver driver)(Code) | | Sets the Driver.
Parameters: Driver - The new Driver. |
setFeature | public void setFeature(String featureId, boolean state) throws XMLConfigurationException(Code) | | 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.
Parameters: featureId - The feature identifier. Parameters: state - The state of the feature. throws: SAXNotRecognizedException - The component should not throwthis exception. throws: SAXNotSupportedException - The component should not throwthis exception. |
setProperty | public void setProperty(String propertyId, Object value) throws XMLConfigurationException(Code) | | 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.
Parameters: propertyId - The property identifier. Parameters: value - The value of the property. throws: SAXNotRecognizedException - The component should not throwthis exception. throws: SAXNotSupportedException - The component should not throwthis exception. |
setScannerState | final protected void setScannerState(int state)(Code) | | Sets the scanner state.
Parameters: state - The new scanner state. |
startEntity | public void startEntity(String name, XMLResourceIdentifier identifier, String encoding) throws XNIException(Code) | | 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 - The name of the entity. Parameters: identifier - The resource identifier. Parameters: encoding - The auto-detected IANA encoding name of the entitystream. This value will be null in those situationswhere the entity encoding is not auto-detected (e.g.internal entities or a document entity that isparsed from a java.io.Reader). throws: XNIException - Thrown by handler to signal an error. |
storePointerForADepth | short storePointerForADepth(short elementPointer)(Code) | | |
Methods inherited from com.sun.xml.stream.XMLScanner | public void endEntity(String name) throws IOException, XNIException(Code)(Java Doc) public boolean getFeature(String featureId) throws XMLConfigurationException(Code)(Java Doc) XMLStringBuffer getStringBuffer()(Code)(Java Doc) protected static boolean isInvalid(int value)(Code)(Java Doc) protected static boolean isInvalidLiteral(int value)(Code)(Java Doc) protected static boolean isValidNCName(int value)(Code)(Java Doc) protected static boolean isValidNameChar(int value)(Code)(Java Doc) protected static boolean isValidNameStartChar(int value)(Code)(Java Doc) protected void normalizeWhitespace(XMLString value)(Code)(Java Doc) protected void reportFatalError(String msgId, Object[] args) throws XNIException(Code)(Java Doc) public void reset(XMLComponentManager componentManager) throws XMLConfigurationException(Code)(Java Doc) public void reset(PropertyManager propertyManager)(Code)(Java Doc) protected void scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, XMLAttributes attributes, int attrIndex, boolean checkEntities) throws IOException, XNIException(Code)(Java Doc) protected int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws IOException, XNIException(Code)(Java Doc) protected void scanComment(XMLStringBuffer text) throws IOException, XNIException(Code)(Java Doc) protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException, XNIException(Code)(Java Doc) protected void scanPI(XMLStringBuffer data) throws IOException, XNIException(Code)(Java Doc) protected void scanPIData(String target, XMLStringBuffer data) throws IOException, XNIException(Code)(Java Doc) public String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, XNIException(Code)(Java Doc) protected boolean scanPubidLiteral(XMLString literal) throws IOException, XNIException(Code)(Java Doc) protected boolean scanSurrogates(XMLStringBuffer buf) throws IOException, XNIException(Code)(Java Doc) protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl, String[] pseudoAttributeValues) throws IOException, XNIException(Code)(Java Doc) public void setFeature(String featureId, boolean value) throws XMLConfigurationException(Code)(Java Doc) public void setProperty(String propertyId, Object value) throws XMLConfigurationException(Code)(Java Doc) protected void setPropertyManager(PropertyManager propertyManager)(Code)(Java Doc) public void startEntity(String name, XMLResourceIdentifier identifier, String encoding) throws XNIException(Code)(Java Doc) protected boolean versionSupported(String version)(Code)(Java Doc)
|
|
|
|