JDOM
2.0.5

org.jdom2.output.support
Interface XMLOutputProcessor

All Known Implementing Classes:
AbstractXMLOutputProcessor

public interface XMLOutputProcessor

This interface provides a base support for the XMLOutputter.

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

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

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

Since:
JDOM2
Author:
Rolf Lear
See Also:
XMLOutputter, AbstractXMLOutputProcessor

Method Summary
 void process(java.io.Writer out, Format format, CDATA cdata)
          Print out a CDATA node.
 void process(java.io.Writer out, Format format, Comment comment)
          Print out a Comment.
 void process(java.io.Writer out, Format format, DocType doctype)
          Print out the DocType.
 void process(java.io.Writer out, Format format, Document doc)
          This will print the Document to the given Writer.
 void process(java.io.Writer out, Format format, Element element)
          Print out an Element, including its Attributes, and all contained (child) elements, etc.
 void process(java.io.Writer out, Format format, EntityRef entity)
          Print out a EntityRef.
 void process(java.io.Writer out, Format format, java.util.List<? extends Content> list)
          This will handle printing out a list of nodes.
 void process(java.io.Writer out, Format format, ProcessingInstruction pi)
          Print out a ProcessingInstruction.
 void process(java.io.Writer out, Format format, Text text)
          Print out a Text node.
 

Method Detail

process

void process(java.io.Writer out,
             Format format,
             Document doc)
             throws java.io.IOException
This will print the Document to the given Writer.

Warning: using your own Writer 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 - Writer to use.
format - Format instance specifying output style
doc - Document to format.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             DocType doctype)
             throws java.io.IOException
Print out the DocType.

Parameters:
out - Writer to use.
format - Format instance specifying output style
doctype - DocType to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             Element element)
             throws java.io.IOException
Print out an Element, including its Attributes, and all contained (child) elements, etc.

Parameters:
out - Writer to use.
format - Format instance specifying output style
element - Element to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             java.util.List<? extends Content> list)
             throws java.io.IOException
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 - Writer to use.
format - Format instance specifying output style
list - List of nodes.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input list is null or contains null members
java.lang.ClassCastException - if any of the list members are not Content

process

void process(java.io.Writer out,
             Format format,
             CDATA cdata)
             throws java.io.IOException
Print out a CDATA node.

Parameters:
out - Writer to use.
format - Format instance specifying output style
cdata - CDATA to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             Text text)
             throws java.io.IOException
Print out a Text node. Perfoms the necessary entity escaping and whitespace stripping.

Parameters:
out - Writer to use.
format - Format instance specifying output style
text - Text to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             Comment comment)
             throws java.io.IOException
Print out a Comment.

Parameters:
out - Writer to use.
format - Format instance specifying output style
comment - Comment to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             ProcessingInstruction pi)
             throws java.io.IOException
Print out a ProcessingInstruction.

Parameters:
out - Writer to use.
format - Format instance specifying output style
pi - ProcessingInstruction to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

process

void process(java.io.Writer out,
             Format format,
             EntityRef entity)
             throws java.io.IOException
Print out a EntityRef.

Parameters:
out - Writer to use.
format - Format instance specifying output style
entity - EntityRef to output.
Throws:
java.io.IOException - if there's any problem writing.
java.lang.NullPointerException - if the input content is null

JDOM
2.0.5

Copyright � 2013 Jason Hunter, Brett McLaughlin. All Rights Reserved.