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.ContentHandlerA 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 voidcharacters(char[] ch, int start, int length)voidendElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)protected java.lang.StringgetLeafContent(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.StringgetName(java.lang.String s1, java.lang.String s2)If the first String parameter is nonempty, return it, else return the second string parameter.voidsetParentFrame(AFrame aParentFrame)Sets the parent frame, to which frames built by the object will be added.voidstartDocument()voidstartElement(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:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin 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.SAXExceptionCalled for each start tag encountered.- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin 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:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin 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:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin 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.
-
-