diva.util.xml
Class XmlWriter

java.lang.Object
  extended bydiva.util.LoggableOp
      extended bydiva.util.xml.XmlWriter

public class XmlWriter
extends LoggableOp

Given a tree of XmlElements, an object of this class generates the equivalent XML into an output stream.

Version:
$Id: XmlWriter.java,v 1.11 2004/04/13 06:33:48 cxh Exp $
Author:
Copyright (c) 1997, 1998 by Microstar Software Ltd.;, written by David Megginson <dmeggins@microstar.com>, Steve Neuendorffer, John Reekie

Field Summary
 
Fields inherited from class diva.util.LoggableOp
_verbose
 
Constructor Summary
XmlWriter()
           
 
Method Summary
 void setXMLVersion(java.lang.String v)
          Set the XML version string.
 void write(XmlDocument document)
          Write the given XmlDocument to its URL.
 void write(XmlDocument document, java.io.Writer out)
          Write the given XmlDocument to a given Writer.
 void write(XmlElement e, java.io.Writer out, java.lang.String prefix)
          Deprecated. Use XmlElement.writeXML instead.
 void writeDTD(XmlDocument document, java.io.Writer out)
          Write the DTD of the given XmlDocument to a given Writer.
 void writeDTDElements(java.io.Writer out)
          Produce normalised declarations for all elements.
 void writeDTDEntities(java.io.Writer out)
          Produce normalised declarations for all general entities.
 void writeDTDNotations(java.io.Writer out)
          Produce normalised declarations for all notations.
 
Methods inherited from class diva.util.LoggableOp
getErrorCount, getErrorStream, getLineNumber, getWarningCount, indent, isVerbose, logError, logError, logError, logInfo, logInfo, logWarning, logWarning, logWarning, reset, setErrorStream, setVerbose, unindent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlWriter

public XmlWriter()
Method Detail

setXMLVersion

public void setXMLVersion(java.lang.String v)
Set the XML version string. The default is 1.0.


write

public void write(XmlDocument document)
           throws java.io.IOException
Write the given XmlDocument to its URL. If the file or URL of the document cannot be opened for writing, then an IOException will be thrown.

Throws:
java.io.IOException

write

public void write(XmlDocument document,
                  java.io.Writer out)
           throws java.io.IOException
Write the given XmlDocument to a given Writer. If an error occurs while writing, then an IOException will be thrown.

Throws:
java.io.IOException

write

public void write(XmlElement e,
                  java.io.Writer out,
                  java.lang.String prefix)
           throws java.io.IOException
Deprecated. Use XmlElement.writeXML instead.

Write a single XML element out to the given writer. Prefix each line with the given string. The writer is not flushed -- the caller must do this if necessary.

Throws:
java.io.IOException

writeDTD

public void writeDTD(XmlDocument document,
                     java.io.Writer out)
              throws java.io.IOException
Write the DTD of the given XmlDocument to a given Writer. If an error occurs while writing, then an IOException will be thrown.

Throws:
java.io.IOException

writeDTDNotations

public void writeDTDNotations(java.io.Writer out)
                       throws java.io.IOException
Produce normalised declarations for all notations.

Throws:
java.io.IOException

writeDTDEntities

public void writeDTDEntities(java.io.Writer out)
                      throws java.io.IOException
Produce normalised declarations for all general entities.

Throws:
java.io.IOException

writeDTDElements

public void writeDTDElements(java.io.Writer out)
                      throws java.io.IOException
Produce normalised declarations for all elements.

Throws:
java.io.IOException