org.newsml.toolkit
Interface Delta

All Superinterfaces:
BaseNode, IdNode

public interface Delta
extends BaseNode, IdNode

A delta for an incremental update.

This interface represents a single change request that forms part or all of an incremental update to an existing news item. The change request consists of a single target node (represented by a Duid reference) and zero or more replacement nodes (accessible through BaseNode.getChild(int)), depending on the action. Deltas are represented by the InsertBefore, InsertAfter, Replace, and Delete elements in the NewsML XML markup.

NOTE: The XML content model for all but Delete uses ANY, which would also allow character data replacements; this was not likely the intention of the IPTC, so this interface should silently discards any top-level character data inside an InsertBefore, InsertAfter, Replace, or Delete element.

Version:
2.0
Author:
Reuters PLC

Field Summary
static int DELETE
          Constant: delete target node.
static int INSERT_AFTER
          Constant: insert replacement node(s) after target node.
static int INSERT_BEFORE
          Constant: insert replacement node(s) before target node.
static int REPLACE
          Constant: replace target node with replacement node(s).
 
Method Summary
 int getAction()
          Get the action requested by this delta.
 BaseNode getTargetNode()
          Return the actual target node.
 Text getTargetRef()
          Get the Duid of the target node.
 
Methods inherited from interface org.newsml.toolkit.BaseNode
getAttr, getChild, getChild, getChild, getChild, getChildCount, getChildCount, getParent, getPath, getSession, getXMLName, getXPath, insertAfter, insertAfter, insertAfter, insertAfter, insertAfterDuid, insertAfterDuid, insertBefore, insertBefore, insertBefore, insertBefore, insertBeforeDuid, insertBeforeDuid, insertChild, insertChild, insertFirst, insertFirst, insertLast, insertLast, removeChild, removeChild, removeSelf, replaceChild, replaceChild, replaceChild, replaceChild, replaceChild, replaceChild, setAttr, setAttr, toXML, toXML, unsetAttr, unsetAttr, writeXML, writeXML
 
Methods inherited from interface org.newsml.toolkit.IdNode
getDuid, getEuid
 

Field Detail

INSERT_BEFORE

public static final int INSERT_BEFORE
Constant: insert replacement node(s) before target node.

INSERT_AFTER

public static final int INSERT_AFTER
Constant: insert replacement node(s) after target node.

REPLACE

public static final int REPLACE
Constant: replace target node with replacement node(s).

DELETE

public static final int DELETE
Constant: delete target node.
Method Detail

getAction

public int getAction()
Get the action requested by this delta.
Returns:
A constant representing the action requested.
See Also:
INSERT_BEFORE, INSERT_AFTER, REPLACE, DELETE

getTargetRef

public Text getTargetRef()
Get the Duid of the target node.
Returns:
The Duid of the target node (not null).

getTargetNode

public BaseNode getTargetNode()
Return the actual target node.

This is a convenience method that looks up the node corresponding to the Duid.

Returns:
The target base node.
See Also:
getTargetRef()