org.apache.uima.adapter.vinci.util
Class SaxVinciFrameBuilder

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.uima.adapter.vinci.util.SaxVinciFrameBuilder
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
UimaSaxVinciFrameBuilder

public class SaxVinciFrameBuilder
extends org.xml.sax.helpers.DefaultHandler
implements org.xml.sax.ContentHandler

A SAX content handler that builds a VinciFrame corresponding to the SAX events received.


Constructor Summary
SaxVinciFrameBuilder()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)
           
protected  java.lang.String getLeafContent(java.lang.String aFrameName, org.xml.sax.Attributes aAttributes, java.lang.StringBuffer aContentBuf)
          Gets the content to be included in a FrameLeaf.
protected  java.lang.String getName(java.lang.String s1, java.lang.String s2)
          If the first String parameter is nonempty, return it, else return the second string parameter.
 void setParentFrame(AFrame aParentFrame)
          Sets the parent frame, to which frames built by the object will be added.
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
          Called for each start tag encountered.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
 

Constructor Detail

SaxVinciFrameBuilder

public SaxVinciFrameBuilder()
Method Detail

setParentFrame

public void setParentFrame(AFrame aParentFrame)
Sets the parent frame, to which frames built by the object will be added. This MUST be called before parsing a document.

Parameters:
aParentFrame - the parent frame

startDocument

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

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qualifiedName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Called for each start tag encountered.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - Required if the namespaces property is true.
attributes - The specified or defaulted attributes.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qualifiedName - The qualified name (with prefix), or the empty string if qualified names are not available.
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
See Also:
ContentHandler.characters(char[],int,int)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qualifiedName)
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
See Also:
ContentHandler.endElement(String,String,String)

getLeafContent

protected java.lang.String getLeafContent(java.lang.String aFrameName,
                                          org.xml.sax.Attributes aAttributes,
                                          java.lang.StringBuffer aContentBuf)
Gets the content to be included in a FrameLeaf. This method just returns the contents of the provided StringBuffer, but subclasses can override to provide specialized content.

Parameters:
aFrameName - name of the FrameLeaf
aAttributes - attributes of FrameLeaf
aContentBuf - StringBuffer containing the character data obtained from the SAX parser
Returns:
the data to be included in the Vinci FrameLeaf

getName

protected java.lang.String getName(java.lang.String s1,
                                   java.lang.String s2)
If the first String parameter is nonempty, return it, else return the second string parameter.

Parameters:
s1 - The string to be tested.
s2 - The alternate String.
Returns:
s1 if it isn't empty, else s2.


Copyright © 2010 The Apache Software Foundation. All Rights Reserved.