public abstract class AbstractStAXEventProcessor extends AbstractOutputProcessor implements StAXEventProcessor
StAXEventProcessor
for supporting the StAXEventOutputter
.
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.
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
构造器和说明 |
---|
AbstractStAXEventProcessor() |
限定符和类型 | 方法和说明 |
---|---|
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)
|
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. |
public void process(javax.xml.stream.util.XMLEventConsumer out, Format format, javax.xml.stream.XMLEventFactory eventfactory, Document doc) throws javax.xml.stream.XMLStreamException
StAXEventProcessor
Document
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
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
DocType
.process
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
process
在接口中 StAXEventProcessor
out
- 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
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
CDATA
node.process
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
Text
node. Performs the necessary entity
escaping and whitespace stripping.process
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
Comment
.process
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
ProcessingInstruction
.process
在接口中 StAXEventProcessor
out
- 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
StAXEventProcessor
EntityRef
.process
在接口中 StAXEventProcessor
out
- 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.