//============================================================================== // XmlWriterI.java //------------------------------------------------------------------------------ package tribble.xml; // System imports import java.io.IOException; import java.io.Writer; import java.lang.Exception; import java.lang.IllegalStateException; import java.lang.String; // Local imports // (None) /******************************************************************************* * XML document writer. * *

* This interface is used to implement any kind of high-level output stream that * writes XML documents. XML documents are written in a "push" fashion, where * each item (node tag, attribute, and text content) is written individually * by request. * *

* Implementations of this interface should provide at least one constructor that * takes some kind of output text stream (such as a java.io.Writer or * java.io.OutputStream) as input. * For example: *

*    class MyXmlWriter
*        implements tribble.xml.XmlWriterI
*    {
*        // Constructor
*        public MyXmlWriter(java.io.Writer out)
*        {
*            ...
*        }
*
*        ...
*    } 
* * * * * * @version $Revision: 1.2 $ $Date: 2003/04/16 03:16:55 $ * @since 2003-04-13 * @author * David R. Tribble * (david@tribble.com). *
* Copyright ©2003 by David R. Tribble, all rights reserved. *
* Permission is granted to freely use and distribute this source code * provided that the original copyright and authorship notices remain * intact. * * @see XmlReaderI */ public interface XmlWriterI { // Identification /** Revision information. */ static final String REV = "@(#)tribble/xml/XmlWriterI.java $Revision: 1.2 $ $Date: 2003/04/16 03:16:55 $\n"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Public constants // (None) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Public methods /*************************************************************************** * Write an XML element to this XML output stream. * * @param ent * An XML tagged element. * * @throws IOException * Thrown if an I/O (write) error occurs. * * @throws IllegalStateException (unchecked) * Thrown if this writer is not in the proper state for writing an element. * * @since 1.1, 2003-04-13 */ public void writeElement(XmlElementI ent) throws IOException; /*************************************************************************** * Write an XML element attribute to this XML output stream. * * @param attr * An XML element attribute. * * @throws IOException * Thrown if an I/O (write) error occurs. * * @throws IllegalStateException (unchecked) * Thrown if this writer is not in the proper state for writing an element * attribute. * * @since 1.1, 2003-04-13 */ public void writeAttribute(XmlAttributeI attr) throws IOException; /*************************************************************************** * Write the text content of the current XML element to this XML output * stream. * * @param text * Text contents of the current XML element. * * @throws IOException * Thrown if an I/O (write) error occurs. * * @throws IllegalStateException (unchecked) * Thrown if this writer is not in the proper state for writing the text * contents of an element. * * @since 1.1, 2003-04-13 */ public void writeText(String text) throws IOException; /*************************************************************************** * Write a comment to this XML output stream. * * @param text * Comment text. * * @throws IOException * Thrown if an I/O (write) error occurs. * * @throws IllegalStateException (unchecked) * Thrown if this writer is not in the proper state for writing a comment. * * @since 1.2, 2003-04-15 */ public void writeComment(String text) throws IOException; } // End XmlWriterI.java