diva.util.xml
Class XmlWriter

java.lang.Object
  extended by diva.util.LoggableOp
      extended by diva.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 2002/07/09 22:00:28 johnr 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(String v)
          Set the XML version string.
 void write(XmlDocument document)
          Write the given XmlDocument to its URL.
 void write(XmlDocument document, Writer out)
          Write the given XmlDocument to a given Writer.
 void write(XmlElement e, Writer out, String prefix)
          Deprecated. Use XmlElement.writeXML instead.
 void writeDTD(XmlDocument document, Writer out)
          Write the DTD of the given XmlDocument to a given Writer.
 void writeDTDElements(Writer out)
          Produce normalised declarations for all elements.
 void writeDTDEntities(Writer out)
          Produce normalised declarations for all general entities.
 void writeDTDNotations(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(String v)
Set the XML version string. The default is 1.0.


write

public void write(XmlDocument document)
           throws 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:
IOException

write

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

Throws:
IOException

write

public void write(XmlElement e,
                  Writer out,
                  String prefix)
           throws 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:
IOException

writeDTD

public void writeDTD(XmlDocument document,
                     Writer out)
              throws 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:
IOException

writeDTDNotations

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

Throws:
IOException
See Also:
makeExternalIdentifiers(java.lang.String, java.lang.String)

writeDTDEntities

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

Throws:
IOException
See Also:
makeLiteral(java.lang.String), makeExternalIdentifiers(java.lang.String, java.lang.String)

writeDTDElements

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

Throws:
IOException
See Also:
writeDTDAttributes(java.lang.String, java.io.Writer)


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.