-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to ignore the sort order of the Nodes and attributes #187
Comments
There is no reason to define a special So let us translate what you want to achieve:
how do you know the
|
@bodewig So basically, i just want to compare two xmls ignoring the order of the node(both the parent nodes as well as the child nodes) and only report an error when there are extra nodes or attributes. i know for certain that 99% of the nodes should match but the order of the two xmls will be 100 % different. i have been using this for quite some time now and this works when the nodes are not in order but there are not many child/subchild nodes(like group and item). the description tags in both goup and item tags will be unique So i just want to know if there is any way i can get this to work when there are multiple sub nodes. |
This sounds as if you were looking for a way where XMLUnit would try all permutations of nodes in order to pick the one with the least differences. While this is technically possible and #45 exists because of this, the space and time complexity would be pretty big - read, this would be very slow for big XML documents and may exceed your available memory. In absence of this brute-force approach, XMLUnit needs your help to know which elements are "the same just out-of-seqence", this is where
should work for the example documents you've given. |
thanks Stefan @bodewig .Was able to get the logic to work after putting is a simple sort code. |
I am unable to ignore the ordering of the nodes and the sub nodes.. could you Please help
XML1
XML2
I tried using ```
DefaultNodeMatcher(ElementSelectors.conditionalBuilder().whenElementIsNamed("Test")
.thenUse(ElementSelectors.byXPath("SectionCode", ElementSelectors.byNameAndAttributes))
.elseUse(ElementSelectors.byName)))
The text was updated successfully, but these errors were encountered: