Package org.jdom2.output.support
Interface StAXEventProcessor
-
- All Known Implementing Classes:
AbstractStAXEventProcessor
public interface StAXEventProcessorThis interface provides a base support for theXMLOutputter.People who want to create a custom XMLOutputProcessor for XMLOutputter are able to implement this interface with the following notes and restrictions:
- The XMLOutputter will call one, and only one of the
process(XMLEventConsumer,Format,*)methods each time the XMLOutputter is requested to output some JDOM content. It is thus safe to assume that aprocess(XMLEventConsumer,Format,*)method can set up any infrastructure needed to process the content, and that the XMLOutputter will not re-call that method, or some otherprocess(XMLEventConsumer,Format,*)method for the same output sequence. - The process methods should be thread-safe and reentrant: The same
process(XMLEventConsumer,Format,*)method may (will) be called concurrently from different threads.
The
AbstractXMLOutputProcessorclass 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, java.util.List<? extends Content> list)This will handle printing out a list of nodes.voidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactpry, CDATA cdata)Print out anode.CDATAvoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Comment comment)Print out a.Commentvoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, DocType doctype)Print out the.DocTypevoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Document doc)This will print theto the given XMLEventConsumer.Documentvoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Element element)voidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, EntityRef entity)Print out a.EntityRefvoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, ProcessingInstruction pi)Print out a.ProcessingInstructionvoidprocess(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Text text)Print out anode.Text
-
-
-
Method Detail
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Document doc) throws javax.xml.stream.XMLStreamExceptionThis will print theto the given XMLEventConsumer.DocumentWarning: using your own XMLEventConsumer 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-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.doc-Documentto format.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, DocType doctype) throws javax.xml.stream.XMLStreamExceptionPrint out the.DocType- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.doctype-DocTypeto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Element element) throws javax.xml.stream.XMLStreamException- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.element-Elementto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, java.util.List<? extends Content> list) throws javax.xml.stream.XMLStreamExceptionThis 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-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.list-Listof nodes.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input list is null or contains null membersjava.lang.ClassCastException- if any of the list members are notContent
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactpry, CDATA cdata) throws javax.xml.stream.XMLStreamExceptionPrint out anode.CDATA- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactpry-XMLEventFactoryfor creating XMLEvent instances.cdata-CDATAto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Text text) throws javax.xml.stream.XMLStreamExceptionPrint out anode. Performs the necessary entity escaping and whitespace stripping.Text- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.text-Textto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Comment comment) throws javax.xml.stream.XMLStreamExceptionPrint out a.Comment- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.comment-Commentto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, ProcessingInstruction pi) throws javax.xml.stream.XMLStreamExceptionPrint out a.ProcessingInstruction- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.pi-ProcessingInstructionto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
process
void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, EntityRef entity) throws javax.xml.stream.XMLStreamExceptionPrint out a.EntityRef- Parameters:
out-XMLEventConsumerto use.format-Formatinstance specifying output styleeventfactory-XMLEventFactoryfor creating XMLEvent instances.entity-EntityRefto output.- Throws:
javax.xml.stream.XMLStreamException- if there's any problem writing.java.lang.NullPointerException- if the input content is null
-
-