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 Details

    • SaxVinciFrameBuilder

      public SaxVinciFrameBuilder()
  • Method Details

    • 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
      Start document.
      Specified by:
      startDocument in interface ContentHandler
      Overrides:
      startDocument in class DefaultHandler
      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 interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
      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 interface ContentHandler
      Overrides:
      characters in class DefaultHandler
      Parameters:
      ch - the ch
      start - the start
      length - the length
      See Also:
    • endElement

      public void endElement(String namespaceURI, String localName, String qualifiedName)
      End element.
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
      Parameters:
      namespaceURI - the namespace URI
      localName - the local name
      qualifiedName - 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 FrameLeaf
      aAttributes - attributes of FrameLeaf
      aContentBuf - StringBuffer containing the character data obtained from the SAX parser
      Returns:
      the data to be included in the Vinci FrameLeaf
    • getName

      protected String getName(String s1, 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.