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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) Characters.void
endElement
(String namespaceURI, String localName, String qualifiedName) End element.protected String
getLeafContent
(String aFrameName, Attributes aAttributes, StringBuffer aContentBuf) Gets the content to be included in a FrameLeaf.protected String
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
Start document.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
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:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in 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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in 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:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Parameters:
ch
- the chstart
- the startlength
- the length- See Also:
-
endElement
End element.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in 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.
-