Package cdc.util.xml

Interface XmlHandler

  • All Known Implementing Classes:
    XmlWriter

    public interface XmlHandler
    • Method Detail

      • beginDocument

        void beginDocument​(XmlVersion version)
                    throws IOException
        Begins an XML document, using writer's encoding.
        Parameters:
        version - The XML version to use.
        Throws:
        IOException - If an I/O error occurs.
      • beginDocument

        default void beginDocument()
                            throws IOException
        Begins an XML document, using writer's encoding and version 1.0.
        Throws:
        IOException - If an I/O error occurs.
      • addNamespace

        default void addNamespace​(String prefix,
                                  String uri)
                           throws IOException
        Adds a namespace declaration.
        Parameters:
        prefix - Namespace prefix
        uri - Associated URI.
        Throws:
        IOException - If an I/O error occurs.
      • addStyleSheet

        default void addStyleSheet​(String xsl)
                            throws IOException
        Helper function used to insert a StyleSheet Processing Instruction.
        Parameters:
        xsl - The URL of the style sheet to use.
        Throws:
        IOException - If an I/O error occurs.
      • beginComment

        void beginComment()
                   throws IOException
        Starts the writing of a new comment.
        Throws:
        IOException - If an I/O error occurs.
      • addCommentContent

        void addCommentContent​(String content)
                        throws IOException
        Adds content to current comment.
        Parameters:
        content - The text to add to current comment.
        Throws:
        IOException - When IO error occurs.
      • endComment

        void endComment()
                 throws IOException
        Closes the current comment.
        Throws:
        IOException - If an I/O error occurs.
      • addComment

        default void addComment​(String content)
                         throws IOException
        Inserts a comment section with a content.
        Parameters:
        content - The comment content.
        Throws:
        IOException - If an I/O error occurs.
      • beginCData

        void beginCData()
                 throws IOException
        Starts the writing of a new CData.
        Throws:
        IOException - If an I/O error occurs.
      • addCDataContent

        void addCDataContent​(String content)
                      throws IOException
        Adds content to current CData.
        Parameters:
        content - The text to add to current CData.
        Throws:
        IOException - When IO error occurs.
      • endCData

        void endCData()
               throws IOException
        Closes the current CData.
        Throws:
        IOException - If an I/O error occurs.
      • addCData

        default void addCData​(String content)
                       throws IOException
        Inserts a CData section with a content.
        Parameters:
        content - The CData content.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        void addAttribute​(String name,
                          String value)
                   throws IOException
        Adds a String attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  Object value)
                           throws IOException
        Adds an Object attribute to current element.

        If object is null adds an empty attribute.
        Otherwise, uses toString() to convert value to a String.

        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  char value)
                           throws IOException
        Adds a char attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  boolean value)
                           throws IOException
        Adds a boolean attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  long value)
                           throws IOException
        Adds a long attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  int value)
                           throws IOException
        Adds an int attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  short value)
                           throws IOException
        Adds a short attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  byte value)
                           throws IOException
        Adds a byte attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  double value)
                           throws IOException
        Adds a double attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.
      • addAttribute

        default void addAttribute​(String name,
                                  float value)
                           throws IOException
        Adds a float attribute to current element.
        Parameters:
        name - Attribute name.
        value - Attribute value.
        Throws:
        IOException - If an I/O error occurs.