|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.cyberneko.pull.util.EventQueue
org.cyberneko.pull.util.EventCollector
This class converts XNI document handler callbacks into pull parser event objects, storing them on an event queue. In order to work with any kind of XNI generator, the data passed via the XNI callbacks is buffered internally when converted to event objects. Therefore, this class is for general use and is not intended for high performance pull parsing. For better performance, a parser written directly to the pull parser API should be used.
Note: There is a performance hit to buffering the underlying XNI events. While the difference is negligible for small documents, it becomes more pronounced as the document size increases.
EventDispatcher| Field Summary | |
protected org.apache.xerces.xni.parser.XMLDocumentSource |
fDocumentSource
XNI document source. |
protected static java.lang.Boolean[] |
FEATURE_DEFAULTS
Feature defaults. |
protected XMLEvent[] |
fEventCache
Event cache. |
protected XMLEvent |
fLastEvent
The last event. |
protected org.apache.xerces.xni.NamespaceContext |
fNamespaceContext
Namespace context. |
protected boolean |
fReuseBuffers
Underlying buffers are re-used by the creator of the XNI events. |
protected static java.lang.String[] |
RECOGNIZED_FEATURES
Recognized features. |
protected static java.lang.String |
REUSE_BUFFERS
Feature identifer: reuse buffers. |
| Fields inherited from class org.cyberneko.pull.util.EventQueue |
fHead, fSize, fTail |
| Constructor Summary | |
EventCollector()
|
|
| Method Summary | |
protected void |
attrs(org.apache.xerces.xni.XMLAttributes src,
org.apache.xerces.xni.XMLAttributes dest)
Copies the source attributes into the specified destination. |
protected org.apache.xerces.xni.Augmentations |
augs(org.apache.xerces.xni.Augmentations augs)
Returns a copy of the specified args. |
void |
characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Character content. |
void |
comment(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
A comment. |
XMLEvent |
dequeue()
Removes an event from the queue. |
void |
doctypeDecl(java.lang.String rootElement,
java.lang.String publicId,
java.lang.String systemId,
org.apache.xerces.xni.Augmentations augs)
Notifies of the presence of the DOCTYPE line in the document. |
protected void |
dropEvent(XMLEvent event)
Drops an event by putting it back on the event cache so that it can be re-used when needed. |
void |
emptyElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
An empty element. |
void |
endCDATA(org.apache.xerces.xni.Augmentations augs)
The end of a CDATA section. |
void |
endDocument(org.apache.xerces.xni.Augmentations augs)
The end of the document. |
void |
endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
The end of an element. |
void |
endGeneralEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
This method notifies the end of a general entity. |
void |
endPrefixMapping(java.lang.String prefix,
org.apache.xerces.xni.Augmentations augs)
The end of a namespace prefix mapping. |
org.apache.xerces.xni.parser.XMLDocumentSource |
getDocumentSource()
Returns the document source. |
protected XMLEvent |
getEvent(short type)
Returns an event object for the given type. |
java.lang.Boolean |
getFeatureDefault(java.lang.String featureId)
Returns feature default. |
java.lang.Object |
getPropertyDefault(java.lang.String propertyId)
Returns property default. |
java.lang.String[] |
getRecognizedFeatures()
Returns recognized features. |
java.lang.String[] |
getRecognizedProperties()
Returns recognized properties. |
protected void |
handleEndElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs,
boolean empty)
Handles an end element by copying the necessary data. |
protected void |
handleStartElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs,
boolean empty)
Handles a start element by copying the necessary data. |
void |
ignorableWhitespace(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
Ignorable whitespace. |
void |
processingInstruction(java.lang.String target,
org.apache.xerces.xni.XMLString data,
org.apache.xerces.xni.Augmentations augs)
A processing instruction. |
void |
reset(org.apache.xerces.xni.parser.XMLComponentManager manager)
Reset. |
void |
setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
Sets the document source. |
void |
setFeature(java.lang.String featureId,
boolean state)
Set feature. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object value)
Set property. |
void |
startCDATA(org.apache.xerces.xni.Augmentations augs)
The start of a CDATA section. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
The start of the document. |
void |
startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.NamespaceContext nscontext,
org.apache.xerces.xni.Augmentations augs)
Start document. |
void |
startElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
The start of an element. |
void |
startGeneralEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier identifier,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
This method notifies the start of a general entity. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
org.apache.xerces.xni.Augmentations augs)
The start of a namespace prefix mapping. |
protected org.apache.xerces.xni.XMLString |
string(org.apache.xerces.xni.XMLString text,
boolean content)
Returns a copy of the specified string. |
void |
textDecl(java.lang.String version,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
Notifies of the presence of a TextDecl line in an entity. |
void |
xmlDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone,
org.apache.xerces.xni.Augmentations augs)
Notifies of the presence of an XMLDecl line in the document. |
| Methods inherited from class org.cyberneko.pull.util.EventQueue |
clear, enqueue, isEmpty, size, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final java.lang.String REUSE_BUFFERS
Note: This capability is not yet implemented in the Xerces2 parser. Therefore, this feature identifier is a placeholder for future capability to improve performance of a pull parser impl built on top of Xerces2.
protected static final java.lang.String[] RECOGNIZED_FEATURES
protected static final java.lang.Boolean[] FEATURE_DEFAULTS
protected XMLEvent[] fEventCache
protected XMLEvent fLastEvent
protected boolean fReuseBuffers
protected org.apache.xerces.xni.parser.XMLDocumentSource fDocumentSource
protected org.apache.xerces.xni.NamespaceContext fNamespaceContext
| Constructor Detail |
public EventCollector()
| Method Detail |
public XMLEvent dequeue()
dequeue in class EventQueue
public void reset(org.apache.xerces.xni.parser.XMLComponentManager manager)
throws org.apache.xerces.xni.parser.XMLConfigurationException
reset in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationExceptionpublic java.lang.String[] getRecognizedFeatures()
getRecognizedFeatures in interface org.apache.xerces.xni.parser.XMLComponent
public void setFeature(java.lang.String featureId,
boolean state)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setFeature in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationExceptionpublic java.lang.String[] getRecognizedProperties()
getRecognizedProperties in interface org.apache.xerces.xni.parser.XMLComponent
public void setProperty(java.lang.String propertyId,
java.lang.Object value)
throws org.apache.xerces.xni.parser.XMLConfigurationException
setProperty in interface org.apache.xerces.xni.parser.XMLComponentorg.apache.xerces.xni.parser.XMLConfigurationExceptionpublic java.lang.Boolean getFeatureDefault(java.lang.String featureId)
getFeatureDefault in interface org.apache.xerces.xni.parser.XMLComponentpublic java.lang.Object getPropertyDefault(java.lang.String propertyId)
getPropertyDefault in interface org.apache.xerces.xni.parser.XMLComponent
public void startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.NamespaceContext nscontext,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startDocument in interface org.apache.xerces.xni.XMLDocumentHandlerorg.apache.xerces.xni.XNIException
public void startDocument(org.apache.xerces.xni.XMLLocator locator,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
locator - The document locator, or null if the document
location cannot be reported during the parsing
of this document. However, it is strongly
recommended that a locator be supplied that can
at least report the system identifier of the
document.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.
public void xmlDecl(java.lang.String version,
java.lang.String encoding,
java.lang.String standalone,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
xmlDecl in interface org.apache.xerces.xni.XMLDocumentHandlerversion - The XML version.encoding - The IANA encoding name of the document, or null if
not specified.standalone - The standalone value, or null if not specified.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void doctypeDecl(java.lang.String rootElement,
java.lang.String publicId,
java.lang.String systemId,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
doctypeDecl in interface org.apache.xerces.xni.XMLDocumentHandlerrootElement - The name of the root element.publicId - The public identifier if an external DTD or null
if the external DTD is specified using SYSTEM.systemId - The system identifier if an external DTD, null
otherwise.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void comment(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
comment in interface org.apache.xerces.xni.XMLDocumentHandlertext - The text in the comment.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by application to signal an error.
public void processingInstruction(java.lang.String target,
org.apache.xerces.xni.XMLString data,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
Typically, a processing instruction's data will contain a series of pseudo-attributes. These pseudo-attributes follow the form of element attributes but are not parsed or presented to the application as anything other than text. The application is responsible for parsing the data.
processingInstruction in interface org.apache.xerces.xni.XMLDocumentHandlertarget - The target.data - The data or null if none specified.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
prefix - The namespace prefix.uri - The URI bound to the prefix.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void startElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startElement in interface org.apache.xerces.xni.XMLDocumentHandlerelement - The name of the element.attributes - The element attributes.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void emptyElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
emptyElement in interface org.apache.xerces.xni.XMLDocumentHandlerelement - The name of the element.attributes - The element attributes.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void startGeneralEntity(java.lang.String name,
org.apache.xerces.xni.XMLResourceIdentifier identifier,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
Note: This method is not called for entity references appearing as part of attribute values.
startGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandlername - The name of the general 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.
public void textDecl(java.lang.String version,
java.lang.String encoding,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
Note: This method will never be called for the document entity; it is only called for external general entities referenced in document content.
Note: This method is not called for entity references appearing as part of attribute values.
textDecl in interface org.apache.xerces.xni.XMLDocumentHandlerversion - The XML version, or null if not specified.encoding - The IANA encoding name of the entity.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void endGeneralEntity(java.lang.String name,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
Note: This method is not called for entity references appearing as part of attribute values.
endGeneralEntity in interface org.apache.xerces.xni.XMLDocumentHandlername - 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.
public void characters(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
characters in interface org.apache.xerces.xni.XMLDocumentHandlertext - The content.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void ignorableWhitespace(org.apache.xerces.xni.XMLString text,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
ignorableWhitespace in interface org.apache.xerces.xni.XMLDocumentHandlertext - The ignorable whitespace.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void endElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endElement in interface org.apache.xerces.xni.XMLDocumentHandlerelement - The name of the element.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void endPrefixMapping(java.lang.String prefix,
org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
prefix - The namespace prefix.augs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void startCDATA(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
startCDATA in interface org.apache.xerces.xni.XMLDocumentHandleraugs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void endCDATA(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endCDATA in interface org.apache.xerces.xni.XMLDocumentHandleraugs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.
public void endDocument(org.apache.xerces.xni.Augmentations augs)
throws org.apache.xerces.xni.XNIException
endDocument in interface org.apache.xerces.xni.XMLDocumentHandleraugs - Additional information that may include infoset augmentations
org.apache.xerces.xni.XNIException - Thrown by handler to signal an error.public void setDocumentSource(org.apache.xerces.xni.parser.XMLDocumentSource source)
setDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandlerpublic org.apache.xerces.xni.parser.XMLDocumentSource getDocumentSource()
getDocumentSource in interface org.apache.xerces.xni.XMLDocumentHandler
protected void handleStartElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.XMLAttributes attributes,
org.apache.xerces.xni.Augmentations augs,
boolean empty)
protected void handleEndElement(org.apache.xerces.xni.QName element,
org.apache.xerces.xni.Augmentations augs,
boolean empty)
protected org.apache.xerces.xni.Augmentations augs(org.apache.xerces.xni.Augmentations augs)
protected void attrs(org.apache.xerces.xni.XMLAttributes src,
org.apache.xerces.xni.XMLAttributes dest)
protected org.apache.xerces.xni.XMLString string(org.apache.xerces.xni.XMLString text,
boolean content)
protected XMLEvent getEvent(short type)
protected void dropEvent(XMLEvent event)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||