/*
* Copyright (c) 2005 Thomas Weise
*
* E-Mail : tweise@gmx.de
* Creation Date : 2005-08-21 19:06:52
* Original Filename: org.sfc.xml.formats.XMLPropagate.java
* Version : 1.0.2
* Last modification: 2006-03-07
* by: Thomas Weise
*
* License : GNU LESSER GENERAL PUBLIC LICENSE
* Version 2.1, February 1999
* You should have received a copy of this license along
* with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA or download the license under
* http://www.gnu.org/copyleft/lesser.html.
*
* Warranty : This software is provided "as is" 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.
*/
package org.sfc.xml.formats;
import org.xml.sax.SAXException;
import org.sfc.xml.sax.SAXPropagate;
/**
* This is the base class for stuff that depends on an underlying xml
* writer.
*
* @author Thomas Weise
*/
class XMLPropagate extends SAXPropagate
{
/**
* Create a new sax propagate.
* @param p_dest Any given source object that can be converted to a
* Writer
by the IO
class.
* @param p_is_owner true
if this sax propagate is the sole
* owner of the sax writer, meaning that when the
* propagate starts a document, the sax writer starts a
* document too (and the same goes for ending a
* document).
* @throws SAXException If something goes wrong.
*/
XMLPropagate (final Object p_dest,
final boolean p_is_owner) throws SAXException
{
super(p_dest, p_is_owner);
}
/**
* Create a new xhtml writer.
* You must writer all data you want to this writer, and then call its
* end_document()
method, before continuing writing data to
* this object.
* Before writing any data to the new writer, you must call its
* start_document()
method.
* @param p_is_frameset true
if and only if this writer
* produces a frameset document.
* @return The new XHTMLWriter.
* @throws SAXException If something goes wrong.
* @see XHTMLWriter#end_document()
*/
protected XHTMLWriter xhtml (final boolean p_is_frameset)
throws SAXException
{
return new XHTMLWriter(this.get_writer(), p_is_frameset, false);
}
/**
* Returns a new math ml writer.
* You must writer all data you want to this writer, and then call its
* end_document()
method, before continuing writing data to
* this object.
* Before writing any data to the new writer, you must call its
* start_document()
method.
* @return The new MathMLWriter.
* @throws SAXException If something goes wrong.
* @see MathMLWriter#end_document()
*/
protected MathMLWriter math_ml () throws SAXException
{
return new MathMLWriter(this.get_writer(), false);
}
/**
* Returns a new svg writer.
* You must writer all data you want to this writer, and then call its
* end_document()
method, before continuing writing data to
* this object.
* Before writing any data to the new writer, you must call its
* start_document()
method.
* @return The new SVGWriter.
* @throws SAXException If something goes wrong.
* @see SVGWriter#end_document()
*/
protected SVGWriter svg () throws SAXException
{
return new SVGWriter(this.get_writer(), false);
}
/**
* The internal css writer.
*
* @author Thomas Weise
*/
final class InternalStylesheet extends CSSBuilder
{
/**
* Finish the css document.
* @throws SAXException If something goes wrong with underlying sax.
* @throws CSSException If something goes wrong.
*/
@Override
public final void end_stylesheet () throws SAXException
{
XMLPropagate.this.text(this.toString());
XMLPropagate.this.end_element();
}
}
}