Class XmlUtils

java.lang.Object
com.illumon.util.XmlUtils

public class XmlUtils
extends Object
A couple of static methods to compare Documents, Elements and Content
  • Constructor Summary

    Constructors 
    Constructor Description
    XmlUtils()  
  • Method Summary

    Modifier and Type Method Description
    static boolean deepEquals​(List<org.jdom2.Attribute> attributes1, List<org.jdom2.Attribute> attributes2)
    Check if two attribute sets are equal.
    static boolean deepEquals​(org.jdom2.Content content1, org.jdom2.Content content2)
    Check if two different content elements are equal.
    static boolean deepEquals​(org.jdom2.Document document1, org.jdom2.Document document2)
    Perform a deep equals operation across two documents.
    static boolean deepEquals​(org.jdom2.Element element1, org.jdom2.Element element2)
    Check if two Elements are equal, comparing all attributes and values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • deepEquals

      public static boolean deepEquals​(@Nullable org.jdom2.Document document1, @Nullable org.jdom2.Document document2)
      Perform a deep equals operation across two documents.
      Parameters:
      document1 - The first document to compare
      document2 - The second document to compare.
      Returns:
      true if they are equal
    • deepEquals

      public static boolean deepEquals​(@Nullable org.jdom2.Content content1, @Nullable org.jdom2.Content content2)
      Check if two different content elements are equal.
      Parameters:
      content1 - the first content element
      content2 - the second content element
      Returns:
      true if the items are equal
    • deepEquals

      public static boolean deepEquals​(@Nullable org.jdom2.Element element1, @Nullable org.jdom2.Element element2)
      Check if two Elements are equal, comparing all attributes and values.
      Parameters:
      element1 - the first element to compare
      element2 - the second element to compare
      Returns:
      true if they are equal
    • deepEquals

      public static boolean deepEquals​(@NotNull List<org.jdom2.Attribute> attributes1, @NotNull List<org.jdom2.Attribute> attributes2)
      Check if two attribute sets are equal. Note that equivalent is not equal, in other words the order of the attributes must also be equal between the two elements for them to be deepEqual
      Parameters:
      attributes1 - the first attribute list to compare
      attributes2 - the second attribute list to compare.
      Returns:
      true if the two attribute sets are equal.