code: public static void assertEquals(String message, XmlCursor expected, XmlCursor actual)
    {
      for (int child = 0; true; child++)
      {
        boolean child1 = expected.toChild(child);
        boolean child2 = actual.toChild(child);
        if (child1 != child2)
        {
          fail(message, "Different XML structure near " + QNameHelper.pretty(expected.getName()));
        }
        else if (expected.getName() != null && !expected.getName().equals(actual.getName()))
        {
          fail(message, "Expected element: '" + expected.getName()
            + "' differs from actual element: '" + actual.getName() + "'");
        }
        else if (child == 0 && !child1)
        {
          if (!(expected.getTextValue().equals(actual.getTextValue())))
          {
            fail(message, "Expected value for element " + QNameHelper.pretty(expected.getName()) + " -> '"
              + expected.getTextValue() + "' differs from actual value '" + actual.getTextValue() + "'");
          }
          break;
        }
        else if (child1)
        {
          assertEquals(message, expected, actual);
          expected.toParent();
          actual.toParent();
        }
        else
        {
          break;
        }
      }
  
      assertAttributesEqual(message, expected, actual);
    }
docs: Uses cursors to compare two XML documents, ignoring whitespace and
  ordering of attributes.  Fails the JUnit test if they're different.
  
  @param message to display on test failure (may be null)
  @param expected
  @param actual