oracle.xml.diff

## Class DiffOp

- java.lang.Object
- - oracle.xml.diff.DiffOp

All Implemented Interfaces:
  java.lang.Comparable<DiffOp>

Direct Known Subclasses:
  AppendDiffOp, DeleteDiffOp, InsertDiffOp

    public abstract class DiffOp
    extends java.lang.Object
    implements java.lang.Comparable<DiffOp>

DiffOp. Models a diff operation, that represents a single delta between two inputs at a particular location in the input tree. A diff between two inputs is represented as a list of diff operations.

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`.

### Nested Class Summary

Nested Classes
`static class` `DiffOp.Name`

### Constructor Summary

Constructors
Constructor and Description
`DiffOp()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`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`.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DiffOp

    public DiffOp()

### Method Detail

#### getOpName

    public abstract DiffOp.Name getOpName()

Returns the name of the diff operation, one of: append-node, insert-before-node, or delete-node.

Returns:
  `Name` containing the name of the diff operation, one of: `Name.INSERT_BY_APPENDING, Name.INSERT_BEFORE_NODE, Name.DELETE`

#### getCurrent

    public abstract Node getCurrent()
                             throws java.lang.Exception

Returns the node to be deleted, for a delete `DiffOp`.

Returns:
  `Node` to be deleted
Throws:
  ``Exception`` - if the `DiffOp` is not a delete
  `java.lang.Exception`

#### getNew

    public abstract Node getNew()
                         throws java.lang.Exception

Returns the node to be inserted or appended, for an insert or append `DiffOp`.

Returns:
  `Node` to be appended or inserted
Throws:
  ``Exception`` - if the `DiffOp` not an insert or append
  `java.lang.Exception`

#### getSibling

    public abstract Node getSibling()
                             throws java.lang.Exception

Returns the node to be inserted before, for an insert `DiffOp`

Returns:
  `Node` to be inserted before
Throws:
  ``Exception`` - if the `DiffOp` not an insert
  `java.lang.Exception`

#### getParent

    public abstract Node getParent()
                            throws java.lang.Exception

Returns the parent node, for an append `DiffOp`.

Returns:
  parent `Node` that the new child will be appended to
Throws:
  ``Exception`` - if the `DiffOp` not an append
  `java.lang.Exception`

#### getParentXPath

    public abstract java.lang.String getParentXPath()
                                             throws java.lang.Exception

Returns the parent node XPath, for an append `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.

Returns:
  `String` representing the XPath to the parent node, `null` if it is not available
Throws:
  ``Exception`` - if the `DiffOp` not an append
  `java.lang.Exception`

#### getSiblingXPath

    public abstract java.lang.String getSiblingXPath()
                                              throws java.lang.Exception

Returns the XPath to the node to be inserted before, for an insert `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.

Returns:
  `String` representing the XPath to the node to be inserted before, `null` if it is not available
Throws:
  ``Exception`` - if the `DiffOp` not an insert
  `java.lang.Exception`

#### getCurrentXPath

    public abstract java.lang.String getCurrentXPath()
                                              throws java.lang.Exception

Returns the XPath to the node to be deleted, for a delete `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.

Returns:
  `String` representing the XPath to the node to be deleted, `null` if it's not available
Throws:
  ``Exception`` - if the `DiffOp` is not a delete
  `java.lang.Exception`

#### getPrefixToNamespace

    public java.util.HashMap<java.lang.String,java.lang.String> getPrefixToNamespace()

#### compareTo

    public int compareTo(DiffOp op)

Specified by:
  `compareTo` in interface `java.lang.Comparable<DiffOp>`

Copyright © 2003, 2018, Oracle and/or its affiliates. All rights reserved.