org.writersforge.catalan.transform.xform
Class CopyProcessor

java.lang.Object
  |
  +--org.writersforge.catalan.transform.BaseNodeProcessor
        |
        +--org.writersforge.catalan.transform.xform.XFormProcessor
              |
              +--org.writersforge.catalan.transform.xform.CopyProcessor
All Implemented Interfaces:
org.writersforge.bellows.traverse.NodeProcessor

public class CopyProcessor
extends XFormProcessor

A Datum-only NodeProcessor for duplicating existing XML content to other parts of the same XML tree. Works on element content or on attributes.

Author:
jsheets

Constructor Summary
CopyProcessor(java.lang.String query, java.lang.String destination, java.lang.String attribute)
          Creates a new instance of CopyProcessor.
 
Method Summary
protected  org.writersforge.bellows.Datum[] getDestinationNodes(org.writersforge.bellows.Datum datum)
          Finds the Datum nodes to perform the transformation on.
protected  void transformNode(org.writersforge.bellows.Datum node, org.writersforge.bellows.Datum root)
          Performs an in-place transformation on the supplied Datum tree.
 
Methods inherited from class org.writersforge.catalan.transform.xform.XFormProcessor
getQuery, getQueryNodes, processNode
 
Methods inherited from class org.writersforge.catalan.transform.BaseNodeProcessor
addLeftover, end, getLeftovers, getNodes, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyProcessor

public CopyProcessor(java.lang.String query,
                     java.lang.String destination,
                     java.lang.String attribute)
Creates a new instance of CopyProcessor. If attribute is null, the processor will copy (recursively) at the element level. If attribute is set, the processor will copy only matching attributes.

Parameters:
query - Bellows query path to select the source node(s)
destination - Bellows query path to select the destination node(s)
attribute - optional attribute name
Method Detail

getDestinationNodes

protected org.writersforge.bellows.Datum[] getDestinationNodes(org.writersforge.bellows.Datum datum)
Finds the Datum nodes to perform the transformation on.

Parameters:
datum - the input datum tree to select nodes from
Returns:
the nodes to operate on

transformNode

protected void transformNode(org.writersforge.bellows.Datum node,
                             org.writersforge.bellows.Datum root)
Performs an in-place transformation on the supplied Datum tree.

Specified by:
transformNode in class XFormProcessor
Parameters:
node - the current node to operate upon
root - the root of the entire XML tree