JCas
v0.3.1

cas.xml
Interface CasSaxTagHandler

All Known Implementing Classes:
AbstractCasSaxTagHandler

public interface CasSaxTagHandler

Defines the methods for tag handlers of the configuration.

Version:
1.0
Author:
Ralph Schuster

Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data inside an element.
 void endElement(String uri, String localName, String qName)
          Receive notification of the end of an element.
 CasSaxTagHandler getHandler(String tagName, Attributes attributes)
          Returns the handler responsible for the sub tag.
 String getTagName()
          Returns the tag name this handler will take care of.
 void setAttributes(Attributes attr)
          Sets the attributes of the tag.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Receive notification of the start of an element.
 void tagCompleted()
          Validates the parsed configuration and throws an exception if there was a problem.
 

Method Detail

getTagName

public String getTagName()
Returns the tag name this handler will take care of.

Returns:
- a tag name.

getHandler

public CasSaxTagHandler getHandler(String tagName,
                                   Attributes attributes)
Returns the handler responsible for the sub tag.

Parameters:
tagName - - the parent of the handler
Returns:
- a handler for the tag.

setAttributes

public void setAttributes(Attributes attr)
Sets the attributes of the tag.

Parameters:
attr - - attributes of tag

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Receive notification of the start of an element.

Parameters:
attributes - - The specified or defaulted attributes.
localName - - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
SAXException - - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Receive notification of the end of an element.

Parameters:
localName - - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
SAXException - - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Receive notification of character data inside an element.

Parameters:
ch - - The characters.
start - - The start position in the character array.
length - - The number of characters to use from the character array.
Throws:
SAXException - - Any SAX exception, possibly wrapping another exception.
See Also:
ContentHandler.characters(char[], int, int)

tagCompleted

public void tagCompleted()
                  throws SAXException
Validates the parsed configuration and throws an exception if there was a problem. Tag handler can check plausibility of values here or if there are were errors.

Please note that there is a gap when the documents ends because nobody calls the method of the topmost handler. Application programmers must do this manually.

Throws:
SAXException - if a configuration error occured.

JCas
v0.3.1