Class SaxVinciFrameBuilder
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- 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
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(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
-
-
-
-
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 interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classorg.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 interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.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 interfaceorg.xml.sax.ContentHandler
- Overrides:
characters
in classorg.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 interfaceorg.xml.sax.ContentHandler
- Overrides:
endElement
in classorg.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 FrameLeafaAttributes
- attributes of FrameLeafaContentBuf
- 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.
-
-