org.writersforge.catalan.transform.io
Class ImportProcessor
java.lang.Object
org.writersforge.catalan.transform.BaseNodeProcessor
org.writersforge.catalan.transform.io.ImportProcessor
- All Implemented Interfaces:
- org.writersforge.bellows.traverse.NodeProcessor
- public class ImportProcessor
- extends BaseNodeProcessor
A processor which loads data from files and URLs into data nodes.
Parameters control what type of Java object the content is imported into.
- Author:
- jsheets
|
Constructor Summary |
ImportProcessor(org.writersforge.bellows.Datum xml)
Creates a new instance of ImportProcessor from the XML spec. |
ImportProcessor(java.lang.String format,
boolean keepOriginal,
boolean strictWhitespace)
Creates a new instance of ImportProcessor. |
|
Method Summary |
java.util.List |
processNode(java.lang.Object node)
Process a single node. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ImportProcessor
public ImportProcessor(org.writersforge.bellows.Datum xml)
- Creates a new instance of ImportProcessor from the XML spec.
- Parameters:
xml - XML initializing spec
ImportProcessor
public ImportProcessor(java.lang.String format,
boolean keepOriginal,
boolean strictWhitespace)
- Creates a new instance of ImportProcessor. The format parameter
determines the Java object the contents are loaded into. A format of
"text" loads a String object; a format of "xml" loads a Datum tree;
and a format of "binary" loads a byte[] array.
- Parameters:
format - target loading formatkeepOriginal - if true, keeps the source data nodes in the queue;
if false, removes them from the queue after loading the datastrictWhitespace - if true, loads XML with full whitespace
processNode
public java.util.List processNode(java.lang.Object node)
- Process a single node. The processing action can be any arbitrary
task, such as text replacement, data restructuring, or even
statistical gathering. The processor should return a processed
version of the node; this can be the same object untouched, or the
same object modified, or a new set of objects.
- Parameters:
node - the node to process
- Returns:
- a List of processing results (can be empty)