Class SaxVinciFrameBuilder
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.apache.uima.adapter.vinci.util.SaxVinciFrameBuilder
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
UimaSaxVinciFrameBuilder
public class SaxVinciFrameBuilder extends DefaultHandler implements ContentHandler
A SAX content handler that builds a VinciFrame corresponding to the SAX events received.
-
-
Constructor Summary
Constructors Constructor Description SaxVinciFrameBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endElement(String namespaceURI, String localName, String qualifiedName)
protected String
getLeafContent(String aFrameName, Attributes aAttributes, StringBuffer aContentBuf)
Gets the content to be included in a FrameLeaf.protected String
getName(String s1, 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(String namespaceURI, String localName, String qualifiedName, 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
-
-
-
-
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 SAXException
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
- Throws:
SAXException
- See Also:
ContentHandler.startDocument()
-
startElement
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) throws SAXException
Called for each start tag encountered.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- 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:
SAXException
-
characters
public void characters(char[] ch, int start, int length)
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- See Also:
ContentHandler.characters(char[],int,int)
-
endElement
public void endElement(String namespaceURI, String localName, String qualifiedName)
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- See Also:
ContentHandler.endElement(String,String,String)
-
getLeafContent
protected String getLeafContent(String aFrameName, Attributes aAttributes, 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 FrameLeafaAttributes
- attributes of FrameLeafaContentBuf
- StringBuffer containing the character data obtained from the SAX parser- Returns:
- the data to be included in the Vinci FrameLeaf
-
-