Package org.xwiki.diff.xml
Interface XMLDiff
-
@Role public interface XMLDiff
Computes the differences between two XML documents.- Since:
- 11.6RC1
- Version:
- $Id: 6e00e09eb753376989da0eb6a592e7e1142879ed $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<Node,Patch<?>>
diff(NamedNodeMap left, NamedNodeMap right, XMLDiffConfiguration config)
Computes the difference between two maps of XML nodes.Map<Node,Patch<?>>
diff(NodeList left, NodeList right, XMLDiffConfiguration config)
Computes the difference between two lists of XML nodes.Map<Node,Patch<?>>
diff(Node left, Node right, XMLDiffConfiguration config)
Computes the difference between two XML nodes and their descendants.
-
-
-
Method Detail
-
diff
Map<Node,Patch<?>> diff(Node left, Node right, XMLDiffConfiguration config) throws DiffException
Computes the difference between two XML nodes and their descendants. When a value node type (e.g. text, attribute, comment) is modified we compute the difference on the text value using the splitter indicated by the configuration. Otherwise the difference is expressed at node level, as if two lists of nodes are compared.The result is a mapping between nodes from the left side and the patches that need to be applied to these nodes in order for the left tree to become the right tree. If the root nodes of the left and right trees don't match then this change is mapped to the
null
key.- Parameters:
left
- the left side of the comparisonright
- the right side of the comparisonconfig
- the configuration- Returns:
- the differences between the two XML nodes
- Throws:
DiffException
- if the difference can't be computed
-
diff
Map<Node,Patch<?>> diff(NodeList left, NodeList right, XMLDiffConfiguration config) throws DiffException
Computes the difference between two lists of XML nodes. The nodes that match (are similar on both sides) are compared at lower level (we look for differences in their descendants).- Parameters:
left
- the left side of the comparisonright
- the right side of the comparisonconfig
- the configuration- Returns:
- the differences between the two lists of XML nodes
- Throws:
DiffException
- if the difference can't be computed
-
diff
Map<Node,Patch<?>> diff(NamedNodeMap left, NamedNodeMap right, XMLDiffConfiguration config) throws DiffException
Computes the difference between two maps of XML nodes. This is mostly used to compare the attributes of two XML elements. The values of the attributes that are on both sides are compared using the splitter indicated by the configuration. The deltas that correspond to deleted or added attributes have index-1
because attribute order is not significant (we're comparing two maps of nodes anyway).- Parameters:
left
- the left side of the comparisonright
- the right side of the comparisonconfig
- the configuration- Returns:
- the differences between the two maps of XML nodes
- Throws:
DiffException
- if the difference can't be computed
-
-