Package xal.tools.xml

Class XmlWriter

java.lang.Object
xal.tools.xml.XmlWriter

public class XmlWriter extends Object
XmlWriter is a class that can write an XML document to a desired output in XML format. It only supports writing of Document, Element and Attribute nodes. Other node support may be added as the need arises. XML writer is quite generic for writing XML 1.0 documents with standard encoding. This class mainly implements convenience methods for writing documents to different outputs. The work of writing XML constructs to text is left to the member classes.
Author:
tap
  • Constructor Details

    • XmlWriter

      public XmlWriter(Document newDocument, Writer newWriter)
      Creates new XmlWriter
  • Method Details

    • writeToUrl

      public static void writeToUrl(Document document, URL url) throws IOException
      write the XML document to the URL
      Throws:
      IOException
    • writeToUrlSpec

      public static void writeToUrlSpec(Document newDocument, String urlSpec) throws IOException
      write the XML document to the URL spec
      Throws:
      IOException
    • writeToPath

      public static void writeToPath(Document newDocument, String filePath) throws IOException
      write the XML document to the UNIX file path
      Throws:
      IOException
    • writeToFile

      public static void writeToFile(Document document, File file) throws IOException
      Write the document to a file
      Parameters:
      document - the document to write
      file - the file to be written
      Throws:
      IOException
    • writeToString

      public static String writeToString(Document newDocument)
      return a string representation of the XML document
    • writeToWriter

      public static void writeToWriter(Document newDocument, Writer aWriter)
      write the XML document to the specified writer
    • write

      protected void write()
      write the document to the instance's writer