Class GENIAHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by GENIAHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class GENIAHandler
extends org.xml.sax.helpers.DefaultHandler

This class handles the content of XML in GOLD-files. For each tag, there is a definition of action to take. This is usually related to putting the attribute data of the tag somewhere.

See Also:
GENIAParser

Field Summary
 java.util.ArrayList<GAbstract> abstracts
           
 boolean debug_geh
           
 GAbstract gabstract
           
 GEvent ge
           
 GSentence gs
           
 java.lang.String lastTag
           
 int sentencecounter
           
 
Constructor Summary
GENIAHandler()
          This class does not need anything in particular to be instantiated.
 
Method Summary
 void characters(char[] buf, int offset, int len)
          The string between tags (usually empty) is processed by this method.
 void emit(java.lang.String s)
           
 void endDocument()
          Invoked when a document is finished parsed.
 void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
          This method completes the action of startElement, namely unsets references that has been set, and adding items to misc lists.
 java.util.ArrayList getAbstracts()
          Accessor method for getting the abstracts handled by this handler.
 void startDocument()
          Invoked when a document is about to be parsed.\ Does nothing.
 void startElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName, org.xml.sax.Attributes attrs)
          Called when the parser find a new starting tag.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
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
 

Field Detail

abstracts

public java.util.ArrayList<GAbstract> abstracts

gabstract

public GAbstract gabstract

gs

public GSentence gs

ge

public GEvent ge

lastTag

public java.lang.String lastTag

sentencecounter

public int sentencecounter

debug_geh

public boolean debug_geh
Constructor Detail

GENIAHandler

public GENIAHandler()
This class does not need anything in particular to be instantiated.

Method Detail

startDocument

public void startDocument()
Invoked when a document is about to be parsed.\ Does nothing.

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

endDocument

public void endDocument()
Invoked when a document is finished parsed. Does nothing but informing the user about this happening.

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String sName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Called when the parser find a new starting tag. This tag is matched against a number of clauses, i.e. sentence, term, event .. If no mathcing clause is found, the tag is ignored. This method sets data according to which tag has been discovered.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
endElement(String, String, String)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String sName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
This method completes the action of startElement, namely unsets references that has been set, and adding items to misc lists.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
startElement(String, String, String, Attributes)

characters

public void characters(char[] buf,
                       int offset,
                       int len)
                throws org.xml.sax.SAXException
The string between tags (usually empty) is processed by this method. It is only used to to set PMID of abstracts.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

emit

public void emit(java.lang.String s)
          throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

getAbstracts

public java.util.ArrayList getAbstracts()
Accessor method for getting the abstracts handled by this handler.

Returns:
an arraylist of abstracts