gate.xml
Class GateFormatXmlDocumentHandler

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

Deprecated. GATE format XML documents are now handled by DocumentStaxUtils.

public class GateFormatXmlDocumentHandler
extends DefaultHandler

Implements the behaviour of the XML reader. This is the reader for Gate Xml documents saved with DocumentImplementation.toXml() method.


Field Summary
protected  List myStatusListeners
          Deprecated. Listeners for status report
 
Constructor Summary
GateFormatXmlDocumentHandler(Document aDocument)
          Deprecated.  
 
Method Summary
 void addStatusListener(StatusListener listener)
          Deprecated. This methos is called when a listener is registered with this class
 void characters(char[] text, int start, int length)
          Deprecated. This method is called when the SAX parser encounts text in the XML doc.
 void charactersAction(char[] text, int start, int length)
          Deprecated. This method is called when all characters between specific tags have been read completely
 void comment(String text)
          Deprecated. This method is called when the SAX parser encounts a comment It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener
 void endCDATA()
          Deprecated. This method is called when the SAX parser encounts the end of a CDATA section.
 void endDocument()
          Deprecated. This method is called when the SAX parser encounts the end of the XML document.
 void endElement(String uri, String qName, String elemName)
          Deprecated. This method is called when the SAX parser encounts the end of an XML element.
 void endParsedEntity(String name, boolean included)
          Deprecated. This method is called when the SAX parser encounts a parsed entity and informs the application if that entity was parsed or not It's working only if the CustomDocumentHandler implements a com.sun.parser.LexicalEventListener
 void error(SAXParseException ex)
          Deprecated. Error method.We deal with this exception inside SimpleErrorHandler class
 void fatalError(SAXParseException ex)
          Deprecated. FatalError method.
protected  void fireStatusChangedEvent(String text)
          Deprecated. This methos is called whenever we need to inform the listener about an event.
 void ignorableWhitespace(char[] ch, int start, int length)
          Deprecated. This method is called when the SAX parser encounts white spaces
 void removeStatusListener(StatusListener listener)
          Deprecated. This methos is called when a listener is removed
 void startCDATA()
          Deprecated. This method is called when the SAX parser encounts a start of a CDATA section It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener
 void startDocument()
          Deprecated. This method is called when the SAX parser encounts the beginning of the XML document.
 void startElement(String uri, String qName, String elemName, Attributes atts)
          Deprecated. This method is called when the SAX parser encounts the beginning of an XML element.
 void startParsedEntity(String name)
          Deprecated. This method is called when the SAX parser encounts a parsed Entity It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener
 void warning(SAXParseException ex)
          Deprecated. Warning method comment.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myStatusListeners

protected List myStatusListeners
Deprecated. 
Listeners for status report

Constructor Detail

GateFormatXmlDocumentHandler

public GateFormatXmlDocumentHandler(Document aDocument)
Deprecated. 
Method Detail

startDocument

public void startDocument()
                   throws SAXException
Deprecated. 
This method is called when the SAX parser encounts the beginning of the XML document.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Deprecated. 
This method is called when the SAX parser encounts the end of the XML document. Here we set the content of the gate Document to be the one generated inside this class (tmpDocContent). After that we use the colector to generate all the annotation reffering this new gate document.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException

startElement

public void startElement(String uri,
                         String qName,
                         String elemName,
                         Attributes atts)
                  throws SAXException
Deprecated. 
This method is called when the SAX parser encounts the beginning of an XML element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String qName,
                       String elemName)
                throws SAXException
Deprecated. 
This method is called when the SAX parser encounts the end of an XML element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException

characters

public void characters(char[] text,
                       int start,
                       int length)
                throws SAXException
Deprecated. 
This method is called when the SAX parser encounts text in the XML doc. Here we calculate the end indices for all the elements present inside the stack and update with the new values.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException

charactersAction

public void charactersAction(char[] text,
                             int start,
                             int length)
                      throws SAXException
Deprecated. 
This method is called when all characters between specific tags have been read completely

Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Deprecated. 
This method is called when the SAX parser encounts white spaces

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class DefaultHandler
Throws:
SAXException

error

public void error(SAXParseException ex)
           throws SAXException
Deprecated. 
Error method.We deal with this exception inside SimpleErrorHandler class

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Throws:
SAXException

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Deprecated. 
FatalError method.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Throws:
SAXException

warning

public void warning(SAXParseException ex)
             throws SAXException
Deprecated. 
Warning method comment.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Throws:
SAXException

comment

public void comment(String text)
             throws SAXException
Deprecated. 
This method is called when the SAX parser encounts a comment It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener

Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Deprecated. 
This method is called when the SAX parser encounts a start of a CDATA section It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener

Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Deprecated. 
This method is called when the SAX parser encounts the end of a CDATA section. It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener

Throws:
SAXException

startParsedEntity

public void startParsedEntity(String name)
                       throws SAXException
Deprecated. 
This method is called when the SAX parser encounts a parsed Entity It works only if the XmlDocumentHandler implements a com.sun.parser.LexicalEventListener

Throws:
SAXException

endParsedEntity

public void endParsedEntity(String name,
                            boolean included)
                     throws SAXException
Deprecated. 
This method is called when the SAX parser encounts a parsed entity and informs the application if that entity was parsed or not It's working only if the CustomDocumentHandler implements a com.sun.parser.LexicalEventListener

Throws:
SAXException

addStatusListener

public void addStatusListener(StatusListener listener)
Deprecated. 
This methos is called when a listener is registered with this class


removeStatusListener

public void removeStatusListener(StatusListener listener)
Deprecated. 
This methos is called when a listener is removed


fireStatusChangedEvent

protected void fireStatusChangedEvent(String text)
Deprecated. 
This methos is called whenever we need to inform the listener about an event.