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
Milestone

Comments

@deaknaew
Copy link

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
Copy link
Member

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?

@deaknaew
Copy link
Author

deaknaew commented Feb 25, 2020

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

@bodewig
Copy link
Member

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 as completed in c790386 Mar 1, 2020
@bodewig
Copy link
Member

bodewig commented Mar 1, 2020

Thanks, this should be fixed in master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants