Top Description Methods
org.jdom2.output.support

public Interface SAXOutputProcessor

Known Direct Implementers
org.jdom2.output.support.AbstractSAXOutputProcessor
Imports
java.util.List, org.jdom2.Attribute, .CDATA, .Comment, .Content, .DocType, .Document, .Element, .EntityRef, .JDOMException, .ProcessingInstruction, .Text, org.jdom2.output.Format, .SAXOutputter

This interface provides a base support for the SAXOutputter.

People who want to create a custom SAXOutputProcessor for SAXOutputter are able to implement this interface with the following notes and restrictions:

  1. The SAXOutputter will call one, and only one of the process(SAXTarget,Format,*) methods each time the SAXOutputter is requested to output some JDOM content. It is thus safe to assume that a process(SAXTarget,Format,*) method can set up any infrastructure needed to process the content, and that the SAXOutputter will not re-call that method, or some other process(SAXTarget,Format,*) method for the same output sequence.
  2. The process methods should be thread-safe and reentrant: The same process(SAXTarget,Format,*) method may (will) be called concurrently from different threads.

The AbstractSAXOutputProcessor class is a full implementation of this interface and is fully customisable. People who want a custom SAXOutputter are encouraged to extend the AbstractSAXOutputProcessor rather than do a full re-implementation of this interface.

Author
Rolf Lear
Since
JDOM2
See Also
SAXOutputter, AbstractSAXOutputProcessor

Method Summary

Modifier and TypeMethod and Description
public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
Document
Document to format.
doc
)

This will print the Document to the given SAXTarget.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
DocType
DocType to output.
doctype
)

Print out the DocType.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
Element
Element to output.
element
)

Print out an Element, including its Attributes, and all contained (child) elements, etc.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
List<? extends Content>
List of nodes.
list
)

This will handle printing out a list of nodes.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
CDATA
CDATA to output.
cdata
)

Print out a CDATA node.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
Text
Text to output.
text
)

Print out a Text node.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
Comment
Comment to output.
comment
)

Print out a Comment.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
ProcessingInstruction
ProcessingInstruction to output.
pi
)

Print out a ProcessingInstruction.

public void
process(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
EntityRef
EntityRef to output.
entity
)

Print out a EntityRef.

public void
processAsDocument(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
Element
Element to output.
element
)

Print out an Element encapsulated in start/end Document SAX events, including its Attributes, and all contained (child) elements, etc.

public void
processAsDocument(SAXTarget
SAXTarget to use.
out
,
Format
Format instance specifying output style
format
,
List<? extends Content>
List of nodes.
list
)

This will handle printing out a list of nodes that is encapsulated in start/end Document SAX events.

Method Detail

processback to summary
public void process(SAXTarget out, Format format, Document doc) throws JDOMException

This will print the Document to the given SAXTarget.

Warning

using your own SAXTarget may cause the outputter's preferred character encoding to be ignored. If you use encodings other than UTF-8, we recommend using the method that takes an OutputStream instead.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

doc:Document

Document to format.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, DocType doctype) throws JDOMException

Print out the DocType.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

doctype:DocType

DocType to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, Element element) throws JDOMException

Print out an Element, including its Attributes, and all contained (child) elements, etc.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

element:Element

Element to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, List<? extends Content> list) throws JDOMException

This will handle printing out a list of nodes. This can be useful for printing the content of an element that contains HTML, like "<description>JDOM is <b>fun>!</description>".

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

list:List<? extends Content>

List of nodes.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input list is null or contains null members
ClassCastException:
if any of the list members are not Content
processback to summary
public void process(SAXTarget out, Format format, CDATA cdata) throws JDOMException

Print out a CDATA node.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

cdata:CDATA

CDATA to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, Text text) throws JDOMException

Print out a Text node. Performs the necessary entity escaping and whitespace stripping.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

text:Text

Text to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, Comment comment) throws JDOMException

Print out a Comment.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

comment:Comment

Comment to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, ProcessingInstruction pi) throws JDOMException

Print out a ProcessingInstruction.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

pi:ProcessingInstruction

ProcessingInstruction to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processback to summary
public void process(SAXTarget out, Format format, EntityRef entity) throws JDOMException

Print out a EntityRef.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

entity:EntityRef

EntityRef to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processAsDocumentback to summary
public void processAsDocument(SAXTarget out, Format format, Element element) throws JDOMException

Print out an Element encapsulated in start/end Document SAX events, including its Attributes, and all contained (child) elements, etc.

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

element:Element

Element to output.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input content is null
processAsDocumentback to summary
public void processAsDocument(SAXTarget out, Format format, List<? extends Content> list) throws JDOMException

This will handle printing out a list of nodes that is encapsulated in start/end Document SAX events. This can be useful for printing the content of an element that contains HTML, like "<description>JDOM is <b>fun>!</description>".

Parameters
out:SAXTarget

SAXTarget to use.

format:Format

Format instance specifying output style

list:List<? extends Content>

List of nodes.

Exceptions
JDOMException:
if there is an issue encountered during output.
NullPointerException:
if the input list is null or contains null members
ClassCastException:
if any of the list members are not Content