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
A SAX content handler that builds a VinciFrame corresponding to the SAX events received.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Characters.voidendElement(String namespaceURI, String localName, String qualifiedName) End element.protected StringgetLeafContent(String aFrameName, Attributes aAttributes, StringBuffer aContentBuf) Gets the content to be included in a FrameLeaf.protected StringIf 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.voidStart document.voidstartElement(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration, endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
-
Constructor Details
-
SaxVinciFrameBuilder
public SaxVinciFrameBuilder()
-
-
Method Details
-
setParentFrame
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
Start document.- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException- the SAX exception- See Also:
-
startElement
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes) throws SAXException Called for each start tag encountered.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
namespaceURI- Required if the namespaces property is true.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.attributes- The specified or defaulted attributes.- Throws:
SAXException- the SAX exception
-
characters
public void characters(char[] ch, int start, int length) Characters.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Parameters:
ch- the chstart- the startlength- the length- See Also:
-
endElement
End element.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
namespaceURI- the namespace URIlocalName- the local namequalifiedName- the qualified name- See Also:
-
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
-
getName
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.
-