de.fu_berlin.ties
Class DocumentProcessor
java.lang.Object
de.fu_berlin.ties.ConfigurableProcessor
de.fu_berlin.ties.TextProcessor
de.fu_berlin.ties.DocumentReader
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
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
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 processcontext
- 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 processwriter
- the writer to write the processed text to; flushed
but not closed by this methodcontext
- 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.