public abstract class DiffOp extends java.lang.Object implements java.lang.Comparable<DiffOp>
For example, suppose we have two input XMLs: <a><b1/></a> and <a/>. If we run them through the diff(...) method, the minimal diff will contain a single diff operation: delete-node for the <b1> element.
Currently supported diff operations are: append-node, insert-before-node, and delete-node.See DiffOp.Name.
| Modifier and Type | Class and Description |
|---|---|
static class |
DiffOp.Name |
| Constructor and Description |
|---|
DiffOp() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(DiffOp op) |
abstract Node |
getCurrent()
Returns the node to be deleted, for a delete
DiffOp. |
abstract java.lang.String |
getCurrentXPath()
Returns the XPath to the node to be deleted, for a delete
DiffOp. |
abstract Node |
getNew()
Returns the node to be inserted or appended, for an insert or append
DiffOp. |
abstract DiffOp.Name |
getOpName()
Returns the name of the diff operation, one of: append-node, insert-before-node, or delete-node.
|
abstract Node |
getParent()
Returns the parent node, for an append
DiffOp. |
abstract java.lang.String |
getParentXPath()
Returns the parent node XPath, for an append
DiffOp. |
java.util.HashMap<java.lang.String,java.lang.String> |
getPrefixToNamespace() |
abstract Node |
getSibling()
Returns the node to be inserted before, for an insert
DiffOp |
abstract java.lang.String |
getSiblingXPath()
Returns the XPath to the node to be inserted before, for an insert
DiffOp. |
public abstract DiffOp.Name getOpName()
Name containing the name of the diff operation, one of: Name.INSERT_BY_APPENDING, Name.INSERT_BEFORE_NODE, Name.DELETEpublic abstract Node getCurrent() throws java.lang.Exception
DiffOp.Node to be deletedException - if the DiffOp is not a deletejava.lang.Exceptionpublic abstract Node getNew() throws java.lang.Exception
DiffOp.Node to be appended or insertedException - if the DiffOp not an insert or appendjava.lang.Exceptionpublic abstract Node getSibling() throws java.lang.Exception
DiffOpNode to be inserted beforeException - if the DiffOp not an insertjava.lang.Exceptionpublic abstract Node getParent() throws java.lang.Exception
DiffOp.Node that the new child will be appended toException - if the DiffOp not an appendjava.lang.Exception
public abstract java.lang.String getParentXPath()
throws java.lang.Exception
DiffOp. Whether or not the XPath info is available is controlled by Options. The includeXPaths(...) methods of Options control the current setting of this option, and allow setting it to a new value. Including XPath info adds to the memory use and the computational cost. For maxiumum performance, this option should be turned off.String representing the XPath to the parent node, null if it is not availableException - if the DiffOp not an appendjava.lang.Exception
public abstract java.lang.String getSiblingXPath()
throws java.lang.Exception
DiffOp. Whether or not the XPath info is available is controlled by Options. The includeXPaths(...) methods of Options control the current setting of this option, and allow setting it to a new value. Including XPath info adds to the memory use and computational cost. For maxiumum performance, this option should be turned off.String representing the XPath to the node to be inserted before, null if it is not availableException - if the DiffOp not an insertjava.lang.Exception
public abstract java.lang.String getCurrentXPath()
throws java.lang.Exception
DiffOp. Whether or not the XPath info is available is controlled by Options. The includeXPaths(...) methods of Options control the current setting of this option, and allow setting it to a new value. Including XPath info adds to the memory use and computational cost. For maxiumum performance, this option should be turned off.String representing the XPath to the node to be deleted, null if it's not availableException - if the DiffOp is not a deletejava.lang.Exceptionpublic java.util.HashMap<java.lang.String,java.lang.String> getPrefixToNamespace()