org.apache.commons.betwixt.io
Class SAXBeanWriter

java.lang.Object
  extended by org.apache.commons.betwixt.io.AbstractBeanWriter
      extended by org.apache.commons.betwixt.io.SAXBeanWriter

public class SAXBeanWriter
extends AbstractBeanWriter

The SAXBeanwriter will send events to a ContentHandler

Version:
$Id: SAXBeanWriter.java,v 1.6 2003/01/08 22:07:21 rdonkin Exp $
Author:
Robert Burrell Donkin, Martin van den Bemt

Field Summary
private  AttributesImpl attributes
          Current element's attributes.
private  ContentHandler contentHandler
          Where the output goes
private  Stack elementStack
          Place holder for elements that are started.
private  boolean elementWaiting
          Is there a element currently waiting to be written out?
private  Log log
          Log used for logging (Doh!)
 
Constructor Summary
SAXBeanWriter(ContentHandler contentHandler)
           Constructor sets writer used for output.
 
Method Summary
 void end()
          This method will announce the end of the document to the contenthandler.
protected  void expressAttribute(String qualifiedName, String value)
          Express an attribute
protected  void expressBodyText(String text)
          Express body text
protected  void expressElementEnd()
          Express an empty element end
protected  void expressElementEnd(String qualifiedName)
          Express an element end tag
protected  void expressElementStart(String qualifiedName)
          Express an element tag start using given qualified name
protected  void expressTagClose()
          Element end
 Log getLog()
           Set the log implementation used.
private  void sendElementStart()
          Send the start element event to the ContentHandler
 void setLog(Log log)
           Set the log implementation used.
 void start()
          This will announce the start of the document to the contenthandler.
 
Methods inherited from class org.apache.commons.betwixt.io.AbstractBeanWriter
getAbstractBeanWriterLog, getIdGenerator, getIndentLevel, getWriteIDs, getXMLIntrospector, popBean, pushBean, setAbstractBeanWriterLog, setIdGenerator, setWriteIDs, setXMLIntrospector, write, write, write, write, writeAttribute, writeAttributes, writeContent, writeIDREFElement, writeIndent, writePrintln, writeRestOfElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentHandler

private ContentHandler contentHandler
Where the output goes


log

private Log log
Log used for logging (Doh!)


elementStack

private Stack elementStack
Place holder for elements that are started.


attributes

private AttributesImpl attributes
Current element's attributes.


elementWaiting

private boolean elementWaiting
Is there a element currently waiting to be written out?

Constructor Detail

SAXBeanWriter

public SAXBeanWriter(ContentHandler contentHandler)

Constructor sets writer used for output.

Parameters:
contentHandler - feed events to this content handler
Method Detail

getLog

public Log getLog()

Set the log implementation used.

Returns:
Log implementation that this class logs to

setLog

public void setLog(Log log)

Set the log implementation used.

Parameters:
log - Log implementation to use

expressElementStart

protected void expressElementStart(String qualifiedName)
                            throws SAXException
Express an element tag start using given qualified name

Specified by:
expressElementStart in class AbstractBeanWriter
Parameters:
qualifiedName - the fully qualified element name
Throws:
SAXException - if the ContentHandler has a problem

expressTagClose

protected void expressTagClose()
Element end

Specified by:
expressTagClose in class AbstractBeanWriter

expressElementEnd

protected void expressElementEnd(String qualifiedName)
                          throws SAXException
Express an element end tag

Specified by:
expressElementEnd in class AbstractBeanWriter
Parameters:
qualifiedName - the fully qualified name of the element
Throws:
SAXException - if the ContentHandler has a problem

expressElementEnd

protected void expressElementEnd()
                          throws SAXException
Express an empty element end

Specified by:
expressElementEnd in class AbstractBeanWriter
Throws:
SAXException - if the ContentHandler has a problem

expressBodyText

protected void expressBodyText(String text)
                        throws SAXException
Express body text

Specified by:
expressBodyText in class AbstractBeanWriter
Parameters:
text - the element body text
Throws:
SAXException - if the ContentHandler has a problem

expressAttribute

protected void expressAttribute(String qualifiedName,
                                String value)
                         throws SAXException
Express an attribute

Specified by:
expressAttribute in class AbstractBeanWriter
Parameters:
qualifiedName - the fully qualified attribute name
value - the attribute value
Throws:
SAXException - if the ContentHandler has a problem

sendElementStart

private void sendElementStart()
                       throws SAXException
Send the start element event to the ContentHandler

Throws:
SAXException - if the ContentHandler has a problem

start

public void start()
           throws SAXException
This will announce the start of the document to the contenthandler.

Overrides:
start in class AbstractBeanWriter
Throws:
SAXException - if an SAX problem occurs during writing
See Also:
AbstractBeanWriter.end()

end

public void end()
         throws SAXException
This method will announce the end of the document to the contenthandler.

Overrides:
end in class AbstractBeanWriter
Throws:
SAXException - if an SAX problem occurs during writing
See Also:
AbstractBeanWriter.start()