Interface IXmlWriter

All Known Implementing Classes:
AbstractXmlWriter, XmlStreamWriter, XmlWriter, XmlWriterDelegate

public interface IXmlWriter
Interface describing a writer to write Xml objects to a stream.
Since:
7.4
Author:
Jon van Leuven
  • Method Details

    • writeXmlDecleration

      void writeXmlDecleration() throws IOException
      Writes the xml document declaration. For example: <?xml version="1.0" encoding="UTF-8" ?>
      Throws:
      IOException - If an I/O error occurs.
    • writeTagStart

      void writeTagStart(String tagName) throws IOException
      Write a start tag element to the stream.
      Parameters:
      tagName - The name of the tag, may not be null.
      Throws:
      IOException - If an I/O error occurs.
    • writeTagEnd

      void writeTagEnd() throws IOException
      Writes an end tag for the current element.
      Throws:
      IOException - If an I/O error occurs.
    • writeAttribute

      void writeAttribute(String name, String attrValue) throws IOException
      Writes an attribute value to the stream.
      Parameters:
      name - The name of the attribute, may not be null.
      attrValue - The value of the attribute, when null no attribute will be written to the stream.
      Throws:
      IOException - If an I/O error occurs.
    • writeAttribute

      void writeAttribute(String name, int attrValue) throws IOException
      Throws:
      IOException
    • writeAttribute

      void writeAttribute(String name, boolean attrValue) throws IOException
      Throws:
      IOException
    • writeValue

      void writeValue(String elementValue) throws IOException

      This writes a value for the current element.

      This method will escape xml sensitive characters before writing to the stream.

      Parameters:
      elementValue - The value for the element, may not be null.
      Throws:
      IOException - If an I/O error occurs.
    • writeCDataValue

      void writeCDataValue(String elementValue) throws IOException

      This writes a value for the current element.

      This method will NOT escape xml sensitive characters before writing to the stream, but will use <![CDATA[ ]]> generate valid xml

      Parameters:
      elementValue - The value for the element, may not be null.
      Throws:
      IOException - If an I/O error occurs.
    • writeCDataElement

      void writeCDataElement(String elementName, String elementValue) throws IOException

      This writes a new element with a single value as a child of the current element.

      This method will NOT escape xml sensitive characters before writing to the stream, but will use <![CDATA[ ]]> generate valid xml

      Parameters:
      elementName - The value for the element, may not be null.
      elementValue - The value for the element, may not be null.
      Throws:
      IOException - If an I/O error occurs.
    • writeComment

      void writeComment(String comment) throws IOException
      Writes a comment element to the stream.
      Parameters:
      comment - The comment, may be null.
      Throws:
      IOException - If an I/O error occurs.