SOA
© 2004 SoS Group
All Rights Reserved

sos.koa
Class EasyGenerationContentHandlerProxy

java.lang.Object
  extended bysos.koa.EasyGenerationContentHandlerProxy
All Implemented Interfaces:
org.xml.sax.ContentHandler

public class EasyGenerationContentHandlerProxy
extends java.lang.Object
implements org.xml.sax.ContentHandler

This class is an implementation of ContentHandler which acts as a proxy to another ContentHandler and has the purpose to provide a few handy methods that make life easier when generating SAX events.
Note: This class is only useful for simple cases with no namespaces.


Field Summary
static org.xml.sax.Attributes EMPTY_ATTS
          An empty Attributes object used when no attributes are needed.
private  org.xml.sax.ContentHandler target
           
 
Constructor Summary
EasyGenerationContentHandlerProxy(org.xml.sax.ContentHandler forwardTo)
          Main constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void characters(java.lang.String s)
          Send a String of character data.
 void element(java.lang.String name, java.lang.String value)
          Sends notifications for a whole element with some String content.
 void element(java.lang.String name, java.lang.String value, org.xml.sax.Attributes atts)
          Sends notifications for a whole element with some String content.
 void endDocument()
           
 void endElement(java.lang.String name)
          Send the notification of the end of an element.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void skippedEntity(java.lang.String name)
           
 void startDocument()
           
 void startElement(java.lang.String name)
          Sends the notification of the beginning of an element.
 void startElement(java.lang.String name, org.xml.sax.Attributes atts)
          Sends the notification of the beginning of an element.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ATTS

public static final org.xml.sax.Attributes EMPTY_ATTS
An empty Attributes object used when no attributes are needed.


target

private org.xml.sax.ContentHandler target
Constructor Detail

EasyGenerationContentHandlerProxy

public EasyGenerationContentHandlerProxy(org.xml.sax.ContentHandler forwardTo)
Main constructor.

Parameters:
forwardTo - ContentHandler to forward the SAX event to.
Method Detail

startElement

public void startElement(java.lang.String name)
                  throws org.xml.sax.SAXException
Sends the notification of the beginning of an element.

Parameters:
name - Name for the element.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Sends the notification of the beginning of an element.

Parameters:
name - Name for the element.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

characters

public void characters(java.lang.String s)
                throws org.xml.sax.SAXException
Send a String of character data.

Parameters:
s - The content String
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Send the notification of the end of an element.

Parameters:
name - Name for the element.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

element

public void element(java.lang.String name,
                    java.lang.String value)
             throws org.xml.sax.SAXException
Sends notifications for a whole element with some String content.

Parameters:
name - Name for the element.
value - Content of the element.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

element

public void element(java.lang.String name,
                    java.lang.String value,
                    org.xml.sax.Attributes atts)
             throws org.xml.sax.SAXException
Sends notifications for a whole element with some String content.

Parameters:
name - Name for the element.
value - Content of the element.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
See Also:
ContentHandler.setDocumentLocator(Locator)

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startDocument()

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endDocument()

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startPrefixMapping(String, String)

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endPrefixMapping(String)

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(String, String, String, Attributes)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.endElement(String, String, String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.characters(char[], int, int)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.processingInstruction(String, String)

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.skippedEntity(String)

SOA
© 2004 SoS Group
All Rights Reserved