/*
    PCS - A Framework For Java Web Applications
    Copyright (C) 2002 Patrick Carl, patrick.carl@web.de

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 
    $Id: XmlProducerBase.java,v 1.1.1.1 2002/12/27 23:49:49 pcs_org Exp $
 
 */

package de.spieleck.pcs.xml;

/**
 * Abstract base class for XmlProducer
 * @author  Patrick Carl
 */
public abstract class XmlProducerBase implements XmlProducer {
    
    private String version;
    
    /** Creates a new instance of XmlProducerBase using the following 
      * version <?xml version="1.0" encoding="ISO-8859-1" ?>"
     */
    public XmlProducerBase() {
        setVersion("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>");
    }
    
    /** returns the version of the created Xml as a String
     *
     */
    public String getVersion() {
        return version;
    }    

    /** sets the version of the created Xml
     *
     */
    public void setVersion(String version) {
        this.version = version;
    }    
    
    /** converts the given Objects to an Xml String. The returned Xml contains
     * a version header
     * @param o Objects to convert
     *
     */
    public abstract String toXmlString(Object[] o) throws XmlProducingException;
    
    /** converts the given Object to an Xml String. The returned Xml contains
     * a version header
     * @param o Object to convert
     *
     */
    public abstract String toXmlString(Object o) throws XmlProducingException;
    
    /** converts the given Objects to an Xml String. The returned Xml contains
     * a version header if versionInfo is true
     * @param o Objects to convert
     * @param versionInfo indicates whether the returned Xml should contain a
     * version header or not
     *
     */
    public abstract String toXmlString(Object[] o, boolean versionInfo) 
    throws XmlProducingException;
    
    /** converts the given Object to an Xml String. The returned Xml contains
     * a version header if versionInfo is true
     * @param o Object to convert
     * @param versionInfo indicates whether the returned Xml should contain a
     * version header or not
     *
     */
    public abstract String toXmlString(Object o, boolean versionInfo) 
    throws XmlProducingException;
    
}