Class XmlChange

java.lang.Object
eu.maveniverse.domtrip.XmlChange

public class XmlChange extends Object
Represents a single change detected between two XML documents.

Each change has a type, an XPath-like path identifying the location, and optional before/after values and node references.

Example output:

ELEMENT_ADDED: /project/dependencies/dependency[3]
TEXT_CHANGED: /project/version: "1.0" → "1.1"
ATTRIBUTE_CHANGED: /project/dependencies/dependency[2]/@scope: "compile" → "test"
Since:
1.3.0
See Also:
  • Constructor Details

    • XmlChange

      public XmlChange(ChangeType type, String path, String beforeValue, String afterValue, Node beforeNode, Node afterNode)
      Creates a new XmlChange.
      Parameters:
      type - the type of change
      path - the XPath-like path to the changed node
      beforeValue - the value before the change, or null for additions
      afterValue - the value after the change, or null for removals
      beforeNode - the node before the change, or null for additions
      afterNode - the node after the change, or null for removals
  • Method Details

    • type

      public ChangeType type()
      Returns the type of change.
      Returns:
      the change type
    • path

      public String path()
      Returns the XPath-like path to the changed node.
      Returns:
      the path
    • isSemantic

      public boolean isSemantic()
      Returns true if the change affects the semantic meaning of the XML.
      Returns:
      true if semantic
    • isFormattingOnly

      public boolean isFormattingOnly()
      Returns true if the change is formatting-only (no semantic effect).
      Returns:
      true if formatting-only
    • beforeValue

      public String beforeValue()
      Returns the value before the change, or null for additions.
      Returns:
      the before value
    • afterValue

      public String afterValue()
      Returns the value after the change, or null for removals.
      Returns:
      the after value
    • beforeNode

      public Node beforeNode()
      Returns the node before the change, or null for additions.
      Returns:
      the before node
    • afterNode

      public Node afterNode()
      Returns the node after the change, or null for removals.
      Returns:
      the after node
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object