| java.lang.Object de.danet.an.util.sax.SAXContentBuffer
All known Subclasses: de.danet.an.workflow.util.SAXEventBufferImpl,
SAXContentBuffer | public class SAXContentBuffer implements ContentHandler,LexicalHandler,Serializable(Code) | | This class provides a buffer for SAX content events. The events
reported to an instance of this class are internally
recorded. After recording, the events may be played back an
arbitrary number of times.
The class implements
SerializableSerializable . An instance of this class may thus be
transferred to another process and the SAX events may be replayed
there.
This implementation uses code from Apache's XMLByteStreamCompiler
and associated interpreter.
author: version: $Revision: 1.4 $ |
Constructor Summary | |
public | SAXContentBuffer() Creates an instance of SAXContentBuffer
with all attributes initialized to default values. |
Method Summary | |
public void | characters(char[] ch, int start, int length) Receive notification of character data. | public void | comment(char[] ary, int start, int length) Report an XML comment anywhere in the document. | public XMLStreamReader | createXMLStreamReader() Create a new XMLEventReader for this SAX content. | public void | emit(ContentHandler contentHandler, LexicalHandler lexicalHandler) Emits the events to the given ContentHandler and
LexicalHandler . | public void | emit(ContentHandler contentHandler) Emits the events to the given ContentHandler . | public void | endCDATA() Report the end of a CDATA section. | public void | endDTD() Report the end of DTD declarations. | public void | endDocument() Receive notification of the end of a document. | public void | endElement(String namespaceURI, String localName, String qName) Receive notification of the end of an element. | public void | endEntity(String name) Report the end of an entity. | public void | endPrefixMapping(String prefix) End the scope of a prefix-URI mapping. | public void | ignorableWhitespace(char[] ch, int start, int length) Receive notification of ignorable whitespace in element content. | public void | pack() The internal buffer used to record events is enlarged in
chunks. | public void | processingInstruction(String target, String data) Receive notification of a processing instruction.
Parameters: target - The processing instruction target. Parameters: data - The processing instruction data, or null ifnone was supplied. | public void | setDocumentLocator(Locator locator) Receive an object for locating the origin of SAX document events. | public void | skippedEntity(String name) Receive notification of a skipped entity.
Parameters: name - The name of the skipped entity. | public void | startCDATA() Report the start of a CDATA section. | public void | startDTD(String name, String publicId, String systemId) Report the start of DTD declarations, if any. | public void | startDocument() Receive notification of the beginning of a document. | public void | startElement(String namespaceURI, String localName, String qName, Attributes atts) Receive notification of the beginning of an element.
Parameters: namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed. Parameters: localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed. Parameters: qName - The qualified name (with prefix), or theempty string if qualified names are not available. Parameters: atts - The attributes attached to the element. | public void | startEntity(String name) Report the beginning of an entity.
Parameters: name - The name of the entity. | public void | startPrefixMapping(String prefix, String uri) Begin the scope of a prefix-URI Namespace mapping. | public String | toString() Returns a string representation of the buffer's content. | public String | toString(boolean pretty) Returns a string representation of the buffer's content. | public Node | toW3cDom() Returns a W3C DOM representation of the buffer's content. |
serialVersionUID | final static long serialVersionUID(Code) | | Version id for serialization.
|
SAXContentBuffer | public SAXContentBuffer()(Code) | | Creates an instance of SAXContentBuffer
with all attributes initialized to default values.
|
characters | public void characters(char[] ch, int start, int length) throws SAXException(Code) | | Receive notification of character data.
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: SAXException - Any SAX exception, possiblywrapping another exception. See Also: SAXContentBuffer.ignorableWhitespace See Also: See Also: org.xml.sax.Locator |
comment | public void comment(char[] ary, int start, int length) throws SAXException(Code) | | Report an XML comment anywhere in the document.
Parameters: ary - An array holding the characters in the comment. Parameters: start - The starting position in the array. Parameters: length - The number of characters to use from the array. throws: SAXException - not thrown. |
createXMLStreamReader | public XMLStreamReader createXMLStreamReader()(Code) | | Create a new XMLEventReader for this SAX content.
Note that the implementation of the XMLEventReader
is currently incomplete and provides only very basic functions.
the event reader |
emit | public void emit(ContentHandler contentHandler, LexicalHandler lexicalHandler) throws SAXException(Code) | | Emits the events to the given ContentHandler and
LexicalHandler .
Parameters: contentHandler - the content handler that is to receivethe events. Parameters: lexicalHandler - the lexical handler that is to receivethe events (may be null ). throws: SAXException - Any SAX exception, possibly wrappinganother exception. |
emit | public void emit(ContentHandler contentHandler) throws SAXException(Code) | | Emits the events to the given ContentHandler .
Parameters: contentHandler - the content handler that is to receivethe events. throws: SAXException - Any SAX exception, possibly wrappinganother exception. |
endElement | public void endElement(String namespaceURI, String localName, String qName) throws SAXException(Code) | | Receive notification of the end of an element.
Parameters: namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed. Parameters: localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed. Parameters: qName - The qualified XML 1.0 name (with prefix), or theempty string if qualified names are not available. throws: SAXException - Any SAX exception, possiblywrapping another exception. |
endEntity | public void endEntity(String name) throws SAXException(Code) | | Report the end of an entity.
Parameters: name - The name of the entity that is ending. throws: SAXException - not thrown. |
ignorableWhitespace | public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException(Code) | | Receive notification of ignorable whitespace in element content.
Parameters: ch - The characters from the XML document. Parameters: start - The start position in the array. Parameters: length - The number of characters to read from the array. throws: SAXException - Any SAX exception, possiblywrapping another exception. See Also: SAXContentBuffer.characters |
pack | public void pack()(Code) | | The internal buffer used to record events is enlarged in
chunks. So some space may be left after the last event has been
recorded. This method resizes the buffer to the minimum.
This method is called by
SAXContentBuffer.endDocumentendDocument automatically. However, if only an
XML fragment is recorded, there may never be an
endDocument event and the mothod should be called
manually.
|
processingInstruction | public void processingInstruction(String target, String data) throws SAXException(Code) | | Receive notification of a processing instruction.
Parameters: target - The processing instruction target. Parameters: data - The processing instruction data, or null ifnone was supplied. The data does not include anywhitespace separating it from the target. throws: SAXException - Any SAX exception, possiblywrapping another exception. |
setDocumentLocator | public void setDocumentLocator(Locator locator)(Code) | | Receive an object for locating the origin of SAX document events.
Parameters: locator - An object that can return the location of anySAX document event. See Also: org.xml.sax.Locator |
skippedEntity | public void skippedEntity(String name) throws SAXException(Code) | | Receive notification of a skipped entity.
Parameters: name - The name of the skipped entity. If it is aparameter entity, the name will begin with '%', and if it isthe external DTD subset, it will be the string "[dtd]". throws: SAXException - Any SAX exception, possiblywrapping another exception. |
startDTD | public void startDTD(String name, String publicId, String systemId) throws SAXException(Code) | | Report the start of DTD declarations, if any.
Parameters: name - The document type name. Parameters: publicId - The declared public identifier for the external DTDsubset, or null if none was declared. Parameters: systemId - The declared system identifier for the external DTDsubset, or null if none was declared. throws: SAXException - not thrown. |
startElement | public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException(Code) | | Receive notification of the beginning of an element.
Parameters: namespaceURI - The Namespace URI, or the empty string if theelement has no Namespace URI or if Namespaceprocessing is not being performed. Parameters: localName - The local name (without prefix), or theempty string if Namespace processing is not beingperformed. Parameters: qName - The qualified name (with prefix), or theempty string if qualified names are not available. Parameters: atts - The attributes attached to the element. Ifthere are no attributes, it shall be an emptyAttributes object. throws: SAXException - Any SAX exception, possiblywrapping another exception. See Also: SAXContentBuffer.endElement See Also: org.xml.sax.Attributes |
startEntity | public void startEntity(String name) throws SAXException(Code) | | Report the beginning of an entity.
Parameters: name - The name of the entity. If it is a parameter entity, thename will begin with '%'. throws: SAXException - not thrown. |
toString | public String toString()(Code) | | Returns a string representation of the buffer's content. Note
that this method should not be used to generate XML as charcode
handling is partially undefined (dependant on the platform
configuration).
a terse (unindented) XML representation |
toString | public String toString(boolean pretty)(Code) | | Returns a string representation of the buffer's content. Note
that this method should not be used to generate XML as charcode
handling is partially undefined (dependant on the platform
configuration).
Parameters: pretty - if true output will be formatedusing line breaks and indentation, thus improving readability the XML representation |
toW3cDom | public Node toW3cDom()(Code) | | Returns a W3C DOM representation of the buffer's content.
the DOM representation |
|
|