|
JDOM 2.0.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdom2.output.support.AbstractOutputProcessor
org.jdom2.output.support.AbstractStAXEventProcessor
public abstract class AbstractStAXEventProcessor
This class provides a concrete implementation of StAXEventProcessor
for supporting the StAXEventOutputter.
This class is marked abstract even though all methods are fully implemented.
The process*(...) methods are public because they match the
StAXEventProcessor interface but the remaining methods are all protected.
People who want to create a custom StAXEventProcessor for StAXEventOutputter are
able to extend this class and modify any functionality they want. Before
sub-classing this you should first check to see if the Format class
can get you the results you want.
Subclasses of this should have reentrant methods. This is easiest to accomplish simply by not allowing any instance fields. If your sub-class has an instance field/variable, then it's probably broken.
One significant feature of this implementation is that it creates and
maintains both a NamespaceStack and FormatStack that are
managed in the
printElement(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Element) method.
The stacks are pushed and popped in that method only. They significantly
improve the performance and readability of the code.
The NamespaceStack is only sent through to the
printElement(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Element) and
printContent(XMLEventConsumer, FormatStack, NamespaceStack, XMLEventFactory, Walker) methods, but
the FormatStack is pushed through to all print* Methods.
StAXEventOutputter,
StAXEventProcessor| Constructor Summary | |
|---|---|
AbstractStAXEventProcessor()
|
|
| Method Summary | |
|---|---|
protected void |
printCDATA(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
CDATA cdata)
This will handle printing of a CDATA. |
protected void |
printComment(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
Comment comment)
This will handle printing of a Comment. |
protected void |
printContent(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Walker walker)
This will handle printing of a List of Content. |
protected void |
printDocType(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
DocType docType)
This will handle printing of a DocType. |
protected void |
printDocument(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Document doc)
This will handle printing of a Document. |
protected void |
printElement(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Element element)
This will handle printing of an Element. |
protected void |
printEntityRef(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
EntityRef entity)
This will handle printing of an EntityRef. |
protected void |
printProcessingInstruction(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
ProcessingInstruction pi)
This will handle printing of a ProcessingInstruction. |
protected void |
printText(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
Text text)
This will handle printing of a Text. |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
CDATA cdata)
Print out a node. |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Comment comment)
Print out a . |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
DocType doctype)
Print out the . |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Document doc)
This will print the to the given XMLEventConsumer. |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Element element)
Print out an , including its
s, and all contained (child) elements, etc. |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
EntityRef entity)
Print out a . |
void |
process(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. |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
ProcessingInstruction pi)
Print out a . |
void |
process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Text text)
Print out a node. |
| Methods inherited from class org.jdom2.output.support.AbstractOutputProcessor |
|---|
buildWalker |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractStAXEventProcessor()
| Method Detail |
|---|
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Document doc)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorDocument to the given XMLEventConsumer.
Warning: 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.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.doc - Document to format.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
DocType doctype)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorDocType.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.doctype - DocType to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Element element)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorElement, including its
Attributes, and all contained (child) elements, etc.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.element - Element to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public 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.XMLStreamException
StAXEventProcessor
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.list - List of nodes.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
CDATA cdata)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorCDATA node.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.cdata - CDATA to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Text text)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorText node. Performs the necessary entity
escaping and whitespace stripping.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.text - Text to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
Comment comment)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorComment.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.comment - Comment to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
ProcessingInstruction pi)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorProcessingInstruction.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.pi - ProcessingInstruction to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
public void process(javax.xml.stream.util.XMLEventConsumer out,
Format format,
javax.xml.stream.XMLEventFactory eventfactory,
EntityRef entity)
throws javax.xml.stream.XMLStreamException
StAXEventProcessorEntityRef.
process in interface StAXEventProcessorout - XMLEventConsumer to use.format - Format instance specifying output styleeventfactory - XMLEventFactory for creating XMLEvent instances.entity - EntityRef to output.
javax.xml.stream.XMLStreamException - if there's any problem writing.
protected void printDocument(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Document doc)
throws javax.xml.stream.XMLStreamException
Document.
out - XMLEventConsumer to use.fstack - the FormatStacknstack - the NamespaceStackeventfactory - The XMLEventFactory for creating XMLEventsdoc - Document to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printDocType(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
DocType docType)
throws javax.xml.stream.XMLStreamException
DocType.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventsdocType - DocType to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printProcessingInstruction(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
ProcessingInstruction pi)
throws javax.xml.stream.XMLStreamException
ProcessingInstruction.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventspi - ProcessingInstruction to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printComment(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
Comment comment)
throws javax.xml.stream.XMLStreamException
Comment.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventscomment - Comment to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printEntityRef(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
EntityRef entity)
throws javax.xml.stream.XMLStreamException
EntityRef.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventsentity - EntotyRef to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printCDATA(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
CDATA cdata)
throws javax.xml.stream.XMLStreamException
CDATA.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventscdata - CDATA to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printText(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
javax.xml.stream.XMLEventFactory eventfactory,
Text text)
throws javax.xml.stream.XMLStreamException
Text.
out - XMLEventConsumer to use.fstack - the FormatStackeventfactory - The XMLEventFactory for creating XMLEventstext - Text to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printElement(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Element element)
throws javax.xml.stream.XMLStreamException
Element.
This method arranges for outputting the Element infrastructure including Namespace Declarations and Attributes.
out - XMLEventConsumer to use.fstack - the FormatStacknstack - the NamespaceStackeventfactory - The XMLEventFactory for creating XMLEventselement - Element to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
protected void printContent(javax.xml.stream.util.XMLEventConsumer out,
FormatStack fstack,
NamespaceStack nstack,
javax.xml.stream.XMLEventFactory eventfactory,
Walker walker)
throws javax.xml.stream.XMLStreamException
Content.
out - XMLEventConsumer to use.fstack - the FormatStacknstack - the NamespaceStackeventfactory - The XMLEventFactory for creating XMLEventswalker - Walker of Content to write.
javax.xml.stream.XMLStreamException - if the destination XMLEventConsumer fails
|
JDOM 2.0.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||