Class TQLHandler

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

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

This class handles the content of XML in TEST-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:
TQLParser

Field Summary
 java.util.ArrayList<TQLAbstract> abstracts
           
 boolean inBlock
           
 OntologyParser op
           
 TQL t
           
 TQLAbstract tqlabstract
           
 
Constructor Summary
TQLHandler()
          A TQLHandler can be constructed without any particular parameters
 
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 to get the abstracts that has been handled by this Handler.
 void setOntologyParser(OntologyParser op)
          Method to set the ontologyparser this Handler should use.
 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

op

public OntologyParser op

tqlabstract

public TQLAbstract tqlabstract

abstracts

public java.util.ArrayList<TQLAbstract> abstracts

inBlock

public boolean inBlock

t

public TQL t
Constructor Detail

TQLHandler

public TQLHandler()
A TQLHandler can be constructed without any particular parameters

Method Detail

setOntologyParser

public void setOntologyParser(OntologyParser op)
Method to set the ontologyparser this Handler should use.

Parameters:
op - an ontologyparser

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 to get the abstracts that has been handled by this Handler.

Returns:
the abstracts processes by this handler