Class AbstractStAXStreamProcessor

    • Constructor Detail

      • AbstractStAXStreamProcessor

        public AbstractStAXStreamProcessor()
    • Method Detail

      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            Document doc)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        This will print the Document to the given XMLStreamWriter.

        Warning: using your own XMLStreamWriter 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:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        doc - Document to format.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            DocType doctype)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out the DocType.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        doctype - DocType to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            Element element)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out an Element, including its Attributes, and all contained (child) elements, etc.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        element - Element to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            java.util.List<? extends Content> list)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        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>".
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        list - List of nodes.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            CDATA cdata)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out a CDATA node.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        cdata - CDATA to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            Text text)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out a Text node. Perfoms the necessary entity escaping and whitespace stripping.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        text - Text to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            Comment comment)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out a Comment.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        comment - Comment to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            ProcessingInstruction pi)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        pi - ProcessingInstruction to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • process

        public void process​(javax.xml.stream.XMLStreamWriter out,
                            Format format,
                            EntityRef entity)
                     throws javax.xml.stream.XMLStreamException
        Description copied from interface: StAXStreamProcessor
        Print out a EntityRef.
        Specified by:
        process in interface StAXStreamProcessor
        Parameters:
        out - XMLStreamWriter to use.
        format - Format instance specifying output style
        entity - EntityRef to output.
        Throws:
        javax.xml.stream.XMLStreamException - if there's any problem writing.
      • printDocument

        protected void printDocument​(javax.xml.stream.XMLStreamWriter out,
                                     FormatStack fstack,
                                     NamespaceStack nstack,
                                     Document doc)
                              throws javax.xml.stream.XMLStreamException
        This will handle printing of a Document.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        nstack - the NamespaceStack
        doc - Document to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printDocType

        protected void printDocType​(javax.xml.stream.XMLStreamWriter out,
                                    FormatStack fstack,
                                    DocType docType)
                             throws javax.xml.stream.XMLStreamException
        This will handle printing of a DocType.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        docType - DocType to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printProcessingInstruction

        protected void printProcessingInstruction​(javax.xml.stream.XMLStreamWriter out,
                                                  FormatStack fstack,
                                                  ProcessingInstruction pi)
                                           throws javax.xml.stream.XMLStreamException
        This will handle printing of a ProcessingInstruction.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        pi - ProcessingInstruction to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printComment

        protected void printComment​(javax.xml.stream.XMLStreamWriter out,
                                    FormatStack fstack,
                                    Comment comment)
                             throws javax.xml.stream.XMLStreamException
        This will handle printing of a Comment.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        comment - Comment to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printEntityRef

        protected void printEntityRef​(javax.xml.stream.XMLStreamWriter out,
                                      FormatStack fstack,
                                      EntityRef entity)
                               throws javax.xml.stream.XMLStreamException
        This will handle printing of an EntityRef.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        entity - EntotyRef to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printCDATA

        protected void printCDATA​(javax.xml.stream.XMLStreamWriter out,
                                  FormatStack fstack,
                                  CDATA cdata)
                           throws javax.xml.stream.XMLStreamException
        This will handle printing of a CDATA.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        cdata - CDATA to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printText

        protected void printText​(javax.xml.stream.XMLStreamWriter out,
                                 FormatStack fstack,
                                 Text text)
                          throws javax.xml.stream.XMLStreamException
        This will handle printing of a Text.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        text - Text to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printElement

        protected void printElement​(javax.xml.stream.XMLStreamWriter out,
                                    FormatStack fstack,
                                    NamespaceStack nstack,
                                    Element element)
                             throws javax.xml.stream.XMLStreamException
        This will handle printing of an Element.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        nstack - the NamespaceStack
        element - Element to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printContent

        protected void printContent​(javax.xml.stream.XMLStreamWriter out,
                                    FormatStack fstack,
                                    NamespaceStack nstack,
                                    Walker walker)
                             throws javax.xml.stream.XMLStreamException
        This will handle printing of a List of Content.

        Parameters:
        out - XMLStreamWriter to use.
        fstack - the FormatStack
        nstack - the NamespaceStack
        walker - Walker of Content to write.
        Throws:
        javax.xml.stream.XMLStreamException - if the destination XMLStreamWriter fails
      • printNamespace

        protected void printNamespace​(javax.xml.stream.XMLStreamWriter out,
                                      FormatStack fstack,
                                      Namespace ns)
                               throws javax.xml.stream.XMLStreamException
        This will handle printing of any needed Namespace declarations.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - The current FormatStack
        ns - Namespace to print definition of
        Throws:
        javax.xml.stream.XMLStreamException - if the output fails
      • printAttribute

        protected void printAttribute​(javax.xml.stream.XMLStreamWriter out,
                                      FormatStack fstack,
                                      Attribute attribute)
                               throws javax.xml.stream.XMLStreamException
        This will handle printing of an Attribute.
        Parameters:
        out - XMLStreamWriter to use.
        fstack - The current FormatStack
        attribute - Attribute to output
        Throws:
        javax.xml.stream.XMLStreamException - if the output fails