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

Author:
Robert Burrell Donkin, Martin van den Bemt

Constructor Summary
SAXBeanWriter(org.xml.sax.ContentHandler contentHandler)
           Constructor sets writer used for output.
 
Method Summary
protected  void bodyText(WriteContext context, java.lang.String text)
          Express body text
 void end()
          This method will announce the end of the document to the contenthandler.
protected  void endElement(WriteContext context, java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Writes the end tag for an element
 boolean getCallDocumentEvents()
          Should document events (ie start and end) be called?
 org.apache.commons.logging.Log getLog()
           Set the log implementation used.
 void setCallDocumentEvents(boolean callDocumentEvents)
          Sets whether the document events (ie start and end) should be called.
 void setLog(org.apache.commons.logging.Log log)
           Set the log implementation used.
 void start()
          This will announce the start of the document to the contenthandler.
protected  void startElement(WriteContext context, java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          Writes the start tag for an element.
 
Methods inherited from class org.apache.commons.betwixt.io.AbstractBeanWriter
bodyText, endElement, expressAttribute, expressAttribute, expressBodyText, expressElementEnd, expressElementEnd, expressElementEnd, expressElementStart, expressElementStart, expressTagClose, getAbstractBeanWriterLog, getBindingConfiguration, getIdGenerator, getIndentLevel, getWriteEmptyElements, getWriteIDs, getXMLIntrospector, popBean, pushBean, setAbstractBeanWriterLog, setBindingConfiguration, setIdGenerator, setWriteEmptyElements, setWriteIDs, setXMLIntrospector, startElement, write, 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
 

Constructor Detail

SAXBeanWriter

public SAXBeanWriter(org.xml.sax.ContentHandler contentHandler)

Constructor sets writer used for output.

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

getCallDocumentEvents

public boolean getCallDocumentEvents()
Should document events (ie start and end) be called?

Returns:
true if this SAXWriter should call start and end of the content handler
Since:
0.5

setCallDocumentEvents

public void setCallDocumentEvents(boolean callDocumentEvents)
Sets whether the document events (ie start and end) should be called.

Parameters:
callDocumentEvents - should document events be called
Since:
0.5

getLog

public org.apache.commons.logging.Log getLog()

Set the log implementation used.

Returns:
Log implementation that this class logs to

setLog

public void setLog(org.apache.commons.logging.Log log)

Set the log implementation used.

Parameters:
log - Log implementation to use

startElement

protected void startElement(WriteContext context,
                            java.lang.String uri,
                            java.lang.String localName,
                            java.lang.String qName,
                            org.xml.sax.Attributes attributes)
                     throws org.xml.sax.SAXException
Writes the start tag for an element.

Overrides:
startElement in class AbstractBeanWriter
Parameters:
uri - the element's namespace uri
localName - the element's local name
qName - the element's qualified name
attributes - the element's attributes
Throws:
org.xml.sax.SAXException - if an SAX problem occurs during writing
Since:
0.5

endElement

protected void endElement(WriteContext context,
                          java.lang.String uri,
                          java.lang.String localName,
                          java.lang.String qName)
                   throws org.xml.sax.SAXException
Writes the end tag for an element

Overrides:
endElement in class AbstractBeanWriter
Parameters:
uri - the element's namespace uri
localName - the element's local name
qName - the element's qualified name
Throws:
org.xml.sax.SAXException - if an SAX problem occurs during writing
Since:
0.5

bodyText

protected void bodyText(WriteContext context,
                        java.lang.String text)
                 throws org.xml.sax.SAXException
Express body text

Overrides:
bodyText in class AbstractBeanWriter
Parameters:
text - the element body text
Throws:
org.xml.sax.SAXException - if the ContentHandler has a problem
Since:
0.5

start

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

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

end

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

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


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.