0

I am familiar with ignoring differences in attribute values, but what is the proper way to ignore an attribute by name altogether? How do I make these two documents evaluate as similar?

Doc1:

<a attributeName="value"></a>

Doc2:

<a></a>
yellavon
  • 2,821
  • 12
  • 52
  • 66

1 Answers1

2

This ended up working for me. (If there is another solution, please let me know)

DiffBuilder.compare(control.withTest(test)
                .checkForSimilar()
                .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName))
                .ignoreWhitespace()
                .withAttributeFilter(a -> !"attributeName".equals(a.getName()))
                .build();
yellavon
  • 2,821
  • 12
  • 52
  • 66