de.fu_berlin.ties
Class DocumentProcessor

java.lang.Object
  extended by de.fu_berlin.ties.ConfigurableProcessor
      extended by de.fu_berlin.ties.TextProcessor
          extended by de.fu_berlin.ties.DocumentReader
              extended by de.fu_berlin.ties.DocumentProcessor
All Implemented Interfaces:
Processor
Direct Known Subclasses:
AttributeUnflatten

public abstract class DocumentProcessor
extends DocumentReader

Abstract base class for a Processor that operates on XML documents.

Version:
$Revision: 1.9 $, $Date: 2006/10/21 16:03:52 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
 
Fields inherited from class de.fu_berlin.ties.TextProcessor
CONFIG_POST, KEY_DIRECTORY, KEY_LOCAL_NAME, KEY_OUT_DIRECTORY, KEY_URL
 
Constructor Summary
DocumentProcessor(String outExt, TiesConfiguration conf)
          Creates a new instance.
 
Method Summary
abstract  Document process(Document document, ContextMap context)
          Processes an XML document.
 void process(Document document, Writer writer, ContextMap context)
          Processes an XML document, writing a modified version to a writer.
 
Methods inherited from class de.fu_berlin.ties.DocumentReader
doProcess
 
Methods inherited from class de.fu_berlin.ties.TextProcessor
getOutFileExt, process, process, process, process, process, process, toString
 
Methods inherited from class de.fu_berlin.ties.ConfigurableProcessor
getConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DocumentProcessor

public DocumentProcessor(String outExt,
                         TiesConfiguration conf)
Creates a new instance.

Parameters:
outExt - the extension to use for output files.
conf - used to configure this instance; if null, the standard configuration is used
Method Detail

process

public abstract Document process(Document document,
                                 ContextMap context)
                          throws IOException,
                                 ProcessingException
Processes an XML document. Callers must always continue working on the returned document instance instead of the passed-in instance -- document processors are allowed to modify the document in-place, but this is not required.

Parameters:
document - the document to process
context - a map of objects that are made available for processing
Returns:
the processed document; this object may or may not be identical to the document passed it.
Throws:
IOException - if an I/O error occurs
ProcessingException - if an error occurs during processing

process

public final void process(Document document,
                          Writer writer,
                          ContextMap context)
                   throws IOException,
                          ProcessingException
Processes an XML document, writing a modified version to a writer. This implementation delegates to process(Document, ContextMap).

Specified by:
process in class DocumentReader
Parameters:
document - the document to process
writer - the writer to write the processed text to; flushed but not closed by this method
context - a map of objects that are made available for processing; must contain a mapping from IOUtils.KEY_LOCAL_CHARSET to the character set of the writer
Throws:
IOException - if an I/O error occurs
ProcessingException - if an error occurs during processing


Copyright © 2003-2007 Christian Siefkes. All Rights Reserved.