Class AbstractSAXOutputProcessor
- All Implemented Interfaces:
SAXOutputProcessor
Most ContentHandler callbacks are supported. Neither
ignorableWhitespace() nor skippedEntity() have been
implemented.
At this time, it is not possible to access notations and unparsed entity
references in a DTD from JDOM. Therefore, full DTDHandler
call-backs have not been implemented yet.
The ErrorHandler call-backs have not been implemented, since
these are supposed to be invoked when the document is parsed and at this
point the document exists in memory and is known to have no errors.
- Author:
- Brett McLaughlin, Jason Hunter, Fred Trimble, Bradley S. Huffman, Rolf Lear
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected XMLReaderCreates a SAX XMLReader.protected voidprintCDATA(SAXTarget out, FormatStack fstack, CDATA cdata) This will handle printing of aCDATA.protected voidprintComment(SAXTarget out, FormatStack fstack, Comment comment) This will handle printing of aComment.protected voidprintContent(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Walker walker) This will handle printing of a List ofContent.protected voidprintDocType(SAXTarget out, FormatStack fstack, DocType docType) This will handle printing of aDocType.protected voidprintDocument(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Document document) This will handle printing of aDocument.protected voidprintElement(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Element element) This will handle printing of anElement.protected voidprintEntityRef(SAXTarget out, FormatStack fstack, EntityRef entity) This will handle printing of anEntityRef.protected voidprintProcessingInstruction(SAXTarget out, FormatStack fstack, ProcessingInstruction pi) This will handle printing of aProcessingInstruction.protected voidprintText(SAXTarget out, FormatStack fstack, Text text) This will handle printing of aText.voidThis will handle printing out a list of nodes.voidPrint out anode.CDATAvoidPrint out a.CommentvoidPrint out the.DocTypevoidThis will print theto the given SAXTarget.DocumentvoidvoidPrint out a.EntityRefvoidprocess(SAXTarget out, Format format, ProcessingInstruction pi) Print out a.ProcessingInstructionvoidPrint out anode.TextvoidprocessAsDocument(SAXTarget out, Format format, List<? extends Content> nodes) This will handle printing out a list of nodes thats encapsulated in start/end Document SAX events.voidprocessAsDocument(SAXTarget out, Format format, Element node) Methods inherited from class org.jdom2.output.support.AbstractOutputProcessor
buildWalker
-
Constructor Details
-
AbstractSAXOutputProcessor
public AbstractSAXOutputProcessor()
-
-
Method Details
-
process
Description copied from interface:SAXOutputProcessorThis will print theto the given SAXTarget.DocumentWarning: 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.
- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output styledoc-Documentto format.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out the.DocType- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output styledoctype-DocTypeto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessor- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output styleelement-Elementto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
public void process(SAXTarget out, Format format, List<? extends Content> list) throws JDOMException Description copied from interface:SAXOutputProcessorThis 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>".- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylelist-Listof nodes.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out anode.CDATA- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylecdata-CDATAto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out anode. Perfoms the necessary entity escaping and whitespace stripping.Text- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output styletext-Textto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out a.Comment- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylecomment-Commentto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out a.ProcessingInstruction- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylepi-ProcessingInstructionto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
process
Description copied from interface:SAXOutputProcessorPrint out a.EntityRef- Specified by:
processin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output styleentity-EntityRefto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
processAsDocument
public void processAsDocument(SAXTarget out, Format format, List<? extends Content> nodes) throws JDOMException Description copied from interface:SAXOutputProcessorThis will handle printing out a list of nodes thats 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>".- Specified by:
processAsDocumentin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylenodes-Listof nodes.- Throws:
JDOMException- if there is an issue encountered during output.
-
processAsDocument
Description copied from interface:SAXOutputProcessorPrint out anencapsulated in start/end Document SAX events, including itsElements, and all contained (child) elements, etc.Attribute- Specified by:
processAsDocumentin interfaceSAXOutputProcessor- Parameters:
out-SAXTargetto use.format-Formatinstance specifying output stylenode-Elementto output.- Throws:
JDOMException- if there is an issue encountered during output.
-
printDocument
protected void printDocument(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Document document) throws SAXException This will handle printing of aDocument.- Parameters:
out-SAXTargetto use.fstack- the FormatStacknstack- the NamespaceStackdocument-Documentto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printDocType
This will handle printing of aDocType.- Parameters:
out-SAXTargetto use.fstack- the FormatStackdocType-DocTypeto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printProcessingInstruction
protected void printProcessingInstruction(SAXTarget out, FormatStack fstack, ProcessingInstruction pi) throws SAXException This will handle printing of aProcessingInstruction.- Parameters:
out-SAXTargetto use.fstack- the FormatStackpi-ProcessingInstructionto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printComment
This will handle printing of aComment.- Parameters:
out-SAXTargetto use.fstack- the FormatStackcomment-Commentto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printEntityRef
protected void printEntityRef(SAXTarget out, FormatStack fstack, EntityRef entity) throws SAXException This will handle printing of anEntityRef.- Parameters:
out-SAXTargetto use.fstack- the FormatStackentity-EntotyRefto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printCDATA
This will handle printing of aCDATA.- Parameters:
out-SAXTargetto use.fstack- the FormatStackcdata-CDATAto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printText
This will handle printing of aText.- Parameters:
out-SAXTargetto use.fstack- the FormatStacktext-Textto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printElement
protected void printElement(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Element element) throws SAXException This will handle printing of anElement.This method arranges for outputting the Element infrastructure including Namespace Declarations and Attributes.
- Parameters:
out-SAXTargetto use.fstack- the FormatStacknstack- the NamespaceStackelement-Elementto write.- Throws:
SAXException- if the destination SAXTarget fails
-
printContent
protected void printContent(SAXTarget out, FormatStack fstack, NamespaceStack nstack, Walker walker) throws SAXException This will handle printing of a List ofContent.It relies on the appropriate Walker to get the formatting right.
- Parameters:
out-SAXTargetto use.fstack- the FormatStacknstack- the NamespaceStackwalker-WakerofContentto write.- Throws:
SAXException- if the destination SAXTarget fails
-
createParser
Creates a SAX XMLReader.
- Returns:
XMLReadera SAX2 parser.- Throws:
Exception- if no parser can be created.
-