Class ReplaceMarker

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

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

This SAX parser processes the beginning of an XML corpus file and generates a copy replacing in mode 3 or 4 all orth elements with the replacements specified in a ConversionDictionary, otherwise stripping the elements or replacing them with strings of Xx chars changed parts are marked with HTML font color markup during the process

Version:
0.1, November 2007
Author:
Johannes Dellert

Constructor Summary
ReplaceMarker(java.lang.StringBuffer input, java.lang.StringBuffer output, int aMode, java.lang.String theOrthPath, java.lang.String thePosPath)
          A Replacer needs two String buffers for original and preview data, a mode, and specification of the content to mask.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName)
           
 void setConvDict(ConversionDictionary theDict)
          specify a ConversionDictionary to be used for masking
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String sName, java.lang.String qName, org.xml.sax.Attributes attrs)
           
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplaceMarker

public ReplaceMarker(java.lang.StringBuffer input,
                     java.lang.StringBuffer output,
                     int aMode,
                     java.lang.String theOrthPath,
                     java.lang.String thePosPath)
A Replacer needs two String buffers for original and preview data, a mode, and specification of the content to mask.

Parameters:
input - - a String buffer for constructing the HTML representation of the input data
output - - a String buffer for constructing the HTML representation of the preview data
aMode - - an integer between 0 and 4 for different modes (for internal use)
theOrthPath - - the XPath expression to define masked content
thePosPath - - the XPath expression to define classification of content for dictionary retrieval
log - - a Drop object to handle logging messages in the GUI - null for console output
Method Detail

setConvDict

public void setConvDict(ConversionDictionary theDict)
specify a ConversionDictionary to be used for masking

Parameters:
theDict - - a ConversionDictionary defining how to mask the different tokens

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

endDocument

public void endDocument()
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
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String sName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException