gov.sns.tools.xml
Class XmlWriter

java.lang.Object
  |
  +--gov.sns.tools.xml.XmlWriter

public class XmlWriter
extends java.lang.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.


Constructor Summary
XmlWriter(org.w3c.dom.Document newDocument, java.io.Writer newWriter)
          Creates new XmlWriter
 
Method Summary
protected  void write()
          write the document to the instance's writer
static void writeToPath(org.w3c.dom.Document newDocument, java.lang.String filePath)
          write the XML document to the UNIX file path
static java.lang.String writeToString(org.w3c.dom.Document newDocument)
          return a string representation of the XML document
static void writeToUrl(org.w3c.dom.Document newDocument, java.net.URL url)
          write the XML document to the URL
static void writeToUrlSpec(org.w3c.dom.Document newDocument, java.lang.String urlSpec)
          write the XML document to the URL spec
static void writeToWriter(org.w3c.dom.Document newDocument, java.io.Writer aWriter)
          write the XML document to the specified writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlWriter

public XmlWriter(org.w3c.dom.Document newDocument,
                 java.io.Writer newWriter)
Creates new XmlWriter

Method Detail

writeToUrl

public static void writeToUrl(org.w3c.dom.Document newDocument,
                              java.net.URL url)
                       throws java.net.MalformedURLException,
                              java.io.IOException
write the XML document to the URL

java.net.MalformedURLException
java.io.IOException

writeToUrlSpec

public static void writeToUrlSpec(org.w3c.dom.Document newDocument,
                                  java.lang.String urlSpec)
                           throws java.net.MalformedURLException,
                                  java.io.IOException
write the XML document to the URL spec

java.net.MalformedURLException
java.io.IOException

writeToPath

public static void writeToPath(org.w3c.dom.Document newDocument,
                               java.lang.String filePath)
                        throws java.io.IOException
write the XML document to the UNIX file path

java.io.IOException

writeToString

public static java.lang.String writeToString(org.w3c.dom.Document newDocument)
return a string representation of the XML document


writeToWriter

public static void writeToWriter(org.w3c.dom.Document newDocument,
                                 java.io.Writer aWriter)
write the XML document to the specified writer


write

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