Skip to content
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

bug in get xpath of node #29

Closed
deaknaew opened this issue Feb 25, 2020 · 4 comments
Closed

bug in get xpath of node #29

deaknaew opened this issue Feb 25, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@deaknaew
Copy link

@deaknaew deaknaew commented Feb 25, 2020

it's have bug that will navigate to wrong child when apply node filter

in Org.XmlUnit.Diff
DOMDifferenceEngine
function
UnmatchedControlNodes
and
UnmatchedTestNodes

the problem is that NavigateToChild was passed by index of List
that was filtered out
it must get correct index before pass to NavigateToChild
may be add something like
Array.IndexOf(testList[i].ParentNode.ChildNodes.Cast().ToArray(),testList[i])

bug example

var aa= DiffBuilder.Compare("<Document><Section><Binding /><Binding /><Finding /><Finding /><Finding /><Finding /><Finding /><Finding /><Finding /></Section></Document>")
.WithTest("<Document><Section><Binding /><Binding /><Finding /><Finding /><Finding /><Finding /><Finding /><Finding /></Section></Document>")
.IgnoreWhitespace()
.WithNodeFilter(node =>  "Document,Section,Finding".Split(',').Contains(node.Name))
.WithNodeMatcher(new DefaultNodeMatcher(ElementSelectors.ByNameAndText)).Build();
@bodewig

This comment has been minimized.

Copy link
Member

@bodewig bodewig commented Feb 25, 2020

Sounds a lot like xmlunit/xmlunit#156 that I fixed with d9d6ae3 for XMLUnit.NET 2.7.1.

So before I dig deeper into this, which version of XMLUnit.NET are you using?

@bodewig bodewig added bug core labels Feb 25, 2020
@deaknaew

This comment has been minimized.

Copy link
Author

@deaknaew deaknaew commented Feb 25, 2020

I use 2.7.1 and also use lastest GitHub source to test
Using .net framework version

@bodewig

This comment has been minimized.

Copy link
Member

@bodewig bodewig commented Feb 25, 2020

Thanks, so this is a related but separate bug, that likely exists in the Java version as well.

@bodewig bodewig self-assigned this Feb 25, 2020
@bodewig bodewig added this to the 2.7.2 milestone Feb 25, 2020
@bodewig bodewig closed this in c790386 Mar 1, 2020
@bodewig

This comment has been minimized.

Copy link
Member

@bodewig bodewig commented Mar 1, 2020

Thanks, this should be fixed in master now.

bodewig added a commit to xmlunit/xmlunit that referenced this issue Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.