Class XMLWriter

java.lang.Object
net.n3.nanoxml.XMLWriter

public class XMLWriter extends Object
An XMLWriter writes XML data to a stream.
Author:
Marc De Scheemaecker
See Also:
  • Constructor Details

    • XMLWriter

      public XMLWriter(Writer writer)
      Creates a new XML writer.
      Parameters:
      writer - where to write the output to.
    • XMLWriter

      public XMLWriter(OutputStream stream)
      Creates a new XML writer.
      Parameters:
      stream - where to write the output to.
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Cleans up the object when it's destroyed.
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • write

      public void write(IXMLElement xml) throws IOException
      Writes an XML element.
      Parameters:
      xml - the non-null XML element to write.
      Throws:
      IOException
    • write

      public void write(IXMLElement xml, boolean prettyPrint) throws IOException
      Writes an XML element.
      Parameters:
      xml - the non-null XML element to write.
      prettyPrint - if spaces need to be inserted to make the output more readable
      Throws:
      IOException
    • write

      public void write(IXMLElement xml, boolean prettyPrint, int indent) throws IOException
      Writes an XML element.
      Parameters:
      xml - the non-null XML element to write.
      prettyPrint - if spaces need to be inserted to make the output more readable
      indent - how many spaces to indent the element.
      Throws:
      IOException
    • write

      public void write(IXMLElement xml, boolean prettyPrint, int indent, boolean collapseEmptyElements) throws IOException
      Writes an XML element.
      Parameters:
      xml - the non-null XML element to write.
      prettyPrint - if spaces need to be inserted to make the output more readable
      indent - how many spaces to indent the element.
      Throws:
      IOException