-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Hi Stefan,
I want to find out the difference between 2 xml file, ignoring few attribute of a node.
my XML-</AssignedContent> <AssignedContent ContentClass="FKN" IsRequired="false"> <ContentAttributes> <ContentAttribute AttributeName="PARAMETER-ABHAENGIGKEITe" CommentRequired="N" Description="Parameterabhängigkeit der Funktion" Group="FKN" LockedForGUI="R" MultipleValues="false" OnlyNormValues="false" Required="false" ShowNulls="true"> <ContentGrants/> </ContentAttribute> </ContentAttributes> </AssignedContent>
code which i tried-
` Diff diffs = DiffBuilder.compare(Source).withTest(Source2).ignoreComments().ignoreWhitespace()
.ignoreElementContentWhitespace().checkForSimilar()
.withNodeMatcher(new DefaultNodeMatcher(
ElementSelectors.conditionalBuilder().whenElementIsNamed("ContentAttributes")
.thenUse(ElementSelectors.byXPath("./ContentAttribute/text()",
ElementSelectors.byNameAndAttributes("Description")))
.elseUse(ElementSelectors.byNameAndAllAttributes).build()))
.withAttributeFilter(attr -> (attr.getName().equals("AttributeName"))
.withAttributeFilter(attr -> attr.getName().equals("AttributeName"))
.build();`
I tried with both withAttributeFilter and withDifferenceEvaluator but its not working. I wanted to ignore the AttributeName attribute of ContentAttribute .
Thanks