Package javanet.staxutils
Class XMLEventConsumerDelegate
java.lang.Object
javanet.staxutils.XMLEventConsumerDelegate
- All Implemented Interfaces:
XMLEventConsumer
Writes all events to a wrapped
XMLEventConsumer
, and provides
convenience methods for creating events written to the internal consumer.- Version:
- $Revision: 1.4 $
- Author:
- Christian Niles
-
Constructor Summary
ConstructorsConstructorDescriptionXMLEventConsumerDelegate
(XMLEventConsumer consumer) XMLEventConsumerDelegate
(XMLEventConsumer consumer, XMLEventFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Creates and adds a CDATACharacters
event.void
addComment
(String comment) Creates and adds aComment
event.void
Creates and adds aDTD
event.void
Creates and adds anEndDocument
event.void
addEndElement
(String localName) Creates and adds anEndElement
event.void
addEndElement
(String ns, String localName) Creates and adds anEndElement
event.void
addEndElement
(String ns, String localName, Iterator namespaces) Creates and adds anEndElement
event.void
addEndElement
(String localName, Iterator namespaces) Creates and adds anEndElement
event.void
addEndElement
(QName name) Creates and adds anEndElement
event.void
addEndElement
(QName name, Iterator namespaces) Creates and adds anEndElement
event.void
addIgnorableSpace
(String content) Creates and adds an ignorable spaceCharacters
event.void
Creates and adds a whitespaceCharacters
event.void
Creates and adds aStartDocument
event.void
addStartDocument
(String encoding) Creates and adds aStartDocument
event.void
addStartDocument
(String encoding, String version) Creates and adds aStartDocument
event.void
addStartDocument
(String encoding, String version, boolean standalone) Creates and adds aStartDocument
event.void
addStartElement
(String ns, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context) Creates and adds aStartElement
event.void
addStartElement
(String ns, String localName, NamespaceContext context) Creates and adds aStartElement
event.void
addStartElement
(String localName, Iterator attributes, Iterator namespaces, NamespaceContext context) Creates and adds aStartElement
event.void
addStartElement
(String localName, NamespaceContext context) Creates and adds aStartElement
event.void
addStartElement
(QName name, Iterator attributes, Iterator namespaces, NamespaceContext context) Creates and adds aStartElement
event.void
addStartElement
(QName name, NamespaceContext context) Creates and adds aStartElement
event.void
Creates and adds aCharacters
event.void
addTextElement
(String name, boolean text, NamespaceContext context) Adds a boolean text element with no attributes or namespace declarations.void
addTextElement
(String name, double text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(String name, float text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(String name, int text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(String name, long text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(String name, Number text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(String name, String text, NamespaceContext context) Adds a simple text element with no attributes or namespace declarations.void
addTextElement
(QName name, boolean text, NamespaceContext context) Adds a boolean text element with no attributes or namespace declarations.void
addTextElement
(QName name, double text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(QName name, float text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(QName name, int text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(QName name, long text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(QName name, Number text, NamespaceContext context) Adds a text element with no attributes or namespace declarations.void
addTextElement
(QName name, String text, NamespaceContext context) Adds a simple text element with no attributes or namespace declarations.Returns a reference to the underlyingXMLEventConsumer
to which events are added.Returns a reference to theXMLEventFactory
used to construct events.void
setConsumer
(XMLEventConsumer consumer) Sets the underlyingXMLEventConsumer
to which events are added.void
setEventFactory
(XMLEventFactory factory) Sets theXMLEventFactory
used to construct events.
-
Constructor Details
-
XMLEventConsumerDelegate
-
XMLEventConsumerDelegate
-
-
Method Details
-
getConsumer
Returns a reference to the underlyingXMLEventConsumer
to which events are added.- Returns:
- The underlying
XMLEventConsumer
to which events are added.
-
setConsumer
Sets the underlyingXMLEventConsumer
to which events are added.- Parameters:
consumer
- The newXMLEventConsumer
.
-
getEventFactory
Returns a reference to theXMLEventFactory
used to construct events.- Returns:
- The
XMLEventFactory
used to construct events.
-
setEventFactory
Sets theXMLEventFactory
used to construct events.- Parameters:
factory
- The newXMLEventFactory
.
-
add
- Specified by:
add
in interfaceXMLEventConsumer
- Throws:
XMLStreamException
-
addDTD
Creates and adds aDTD
event.- Parameters:
dtd
- The DTD content, as perXMLEventFactory.createDTD(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addCData
Creates and adds a CDATACharacters
event.- Parameters:
content
- The CDATA content, as perXMLEventFactory.createCData(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addText
Creates and adds aCharacters
event.- Parameters:
content
- The text content, as perXMLEventFactory.createCharacters(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addIgnorableSpace
Creates and adds an ignorable spaceCharacters
event.- Parameters:
content
- The ignorable whitespace, as perXMLEventFactory.createIgnorableSpace(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addSpace
Creates and adds a whitespaceCharacters
event.- Parameters:
content
- The whitespace, as perXMLEventFactory.createIgnorableSpace(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addComment
Creates and adds aComment
event.- Parameters:
comment
- The comment text, as perXMLEventFactory.createComment(String)
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartDocument
Creates and adds aStartDocument
event.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addStartDocument
Creates and adds aStartDocument
event.- Parameters:
encoding
- The encoding to specify in the xml declaration.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addStartDocument
Creates and adds aStartDocument
event.- Parameters:
encoding
- The encoding to include in the xml declaration.version
- The XML version to include in the xml declaration.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addStartDocument
public void addStartDocument(String encoding, String version, boolean standalone) throws XMLStreamException Creates and adds aStartDocument
event.- Parameters:
encoding
- The encoding to include in the xml declaration.version
- The XML version to include in the xml declaration.standalone
- The standalone value to include in the xml declaration.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addEndDocument
Creates and adds anEndDocument
event.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addStartElement
Creates and adds aStartElement
event.- Parameters:
localName
- The local name of the element.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartElement
public void addStartElement(String localName, Iterator attributes, Iterator namespaces, NamespaceContext context) throws XMLStreamException Creates and adds aStartElement
event.- Parameters:
localName
- The local name of the element.attributes
- AnIterator
over the element's attributes.namespaces
- AnIterator
over the element's namespaces.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartElement
public void addStartElement(String ns, String localName, NamespaceContext context) throws XMLStreamException Creates and adds aStartElement
event.- Parameters:
ns
- The element's namespace URI.localName
- The local name of the element.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartElement
public void addStartElement(String ns, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context) throws XMLStreamException Creates and adds aStartElement
event.- Parameters:
ns
- The element's namespace URI.localName
- The local name of the element.attributes
- AnIterator
over the element's attributes.namespaces
- AnIterator
over the element's namespaces.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartElement
Creates and adds aStartElement
event.- Parameters:
name
- The qualified element name.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addStartElement
public void addStartElement(QName name, Iterator attributes, Iterator namespaces, NamespaceContext context) throws XMLStreamException Creates and adds aStartElement
event.- Parameters:
name
- The qualified element name.attributes
- AnIterator
over the element's attributes.namespaces
- AnIterator
over the element's namespaces.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addEndElement
Creates and adds anEndElement
event.- Parameters:
localName
- The unqualified element name.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addEndElement
Creates and adds anEndElement
event.- Parameters:
localName
- The unqualified element name.namespaces
- AnIterator
over the element's namespaces that are going out of scope.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addEndElement
Creates and adds anEndElement
event.- Parameters:
ns
- The element namespace.localName
- The element name.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addEndElement
public void addEndElement(String ns, String localName, Iterator namespaces) throws XMLStreamException Creates and adds anEndElement
event.- Parameters:
ns
- The element namespace.localName
- The element name.namespaces
- AnIterator
over the element's namespaces that are going out of scope.- Throws:
XMLStreamException
- If an error occurs adding the event.
-
addEndElement
Creates and adds anEndElement
event.- Parameters:
name
- The element name.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addEndElement
Creates and adds anEndElement
event.- Parameters:
name
- The element name.namespaces
- AnIterator
over the element's namespaces that are going out of scope.- Throws:
XMLStreamException
- If an error occurs adding the event.- See Also:
-
addTextElement
public void addTextElement(String name, String text, NamespaceContext context) throws XMLStreamException Adds a simple text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The text content, which may benull
context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, String text, NamespaceContext context) throws XMLStreamException Adds a simple text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The text content, which may benull
context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, boolean text, NamespaceContext context) throws XMLStreamException Adds a boolean text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The boolean content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, boolean text, NamespaceContext context) throws XMLStreamException Adds a boolean text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The boolean content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, int text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, int text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, long text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, long text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, float text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, float text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, double text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, double text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(String name, Number text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The unqualified element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-
addTextElement
public void addTextElement(QName name, Number text, NamespaceContext context) throws XMLStreamException Adds a text element with no attributes or namespace declarations.- Parameters:
name
- The element name.text
- The element content.context
- The element'sNamespaceContext
, ornull
.- Throws:
XMLStreamException
- If an error occurs adding an event.
-