You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to select duplicate nodes by looking value of one specific child. Normally I should be able to do that by using the following XPath:
/response[@status="success"]/result/entry[username][domain][username=following-sibling::entry/username or username=preceding-sibling::entry/username]
However when I try to use that XPath in xmlquery, I've faced that "following-sibling" and "preceding-sibling" axes are just making a lookup for one nodes forward or backward I believe, not looks for all following or preceding nodes! (It should do due to XPath2.0 specification.)
Here is the proof of the use of axes in my Xpath is valid: http://xpather.com/dO1pwotO
I also tested that XPath with Xmplify app.
This is the sample XML file that I would like to show the issue:
This code outputs nothing because range for loop won't run since xmlquery.Find can't find anything.
➜ go run test.go #test1.xml
➜
However when I try the very same code with another xml sample (which is basically the same, only order is different), code works since xmlquery.Find find duplicate nodes because they are consecutive. But not all again, I'll explain below!
Here now the very same code can find something. To be exact all 3 duplicates for "test1" but only ONE of 2 duplicate of "test2".
However, in each case, I was expecting to find 5 records! This is also weird. Please check it with xpather.com by yourself.
I'm not sure if it is a bug for antchfx/xmlquery or antchfx/xpath but anyway I submitted the issue here.
The text was updated successfully, but these errors were encountered:
Hello,
I'm trying to select duplicate nodes by looking value of one specific child. Normally I should be able to do that by using the following XPath:
/response[@status="success"]/result/entry[username][domain][username=following-sibling::entry/username or username=preceding-sibling::entry/username]
However when I try to use that XPath in xmlquery, I've faced that "following-sibling" and "preceding-sibling" axes are just making a lookup for one nodes forward or backward I believe, not looks for all following or preceding nodes! (It should do due to XPath2.0 specification.)
Here is the proof of the use of axes in my Xpath is valid: http://xpather.com/dO1pwotO
I also tested that XPath with Xmplify app.
This is the sample XML file that I would like to show the issue:
And sample code to reproduce the issue:
This code outputs nothing because range for loop won't run since
xmlquery.Find
can't find anything.➜ go run test.go #test1.xml ➜
However when I try the very same code with another xml sample (which is basically the same, only order is different), code works since
xmlquery.Find
find duplicate nodes because they are consecutive. But not all again, I'll explain below!The output is:
➜ go run test.go #test2.xml FOUND/SELECTED NODE: USERNAME=test1 DOMAIN=domain FOUND/SELECTED NODE: USERNAME=test1 DOMAIN=domain FOUND/SELECTED NODE: USERNAME=test1 DOMAIN=domain FOUND/SELECTED NODE: USERNAME=test2 DOMAIN=domain ➜
Here now the very same code can find something. To be exact all 3 duplicates for "test1" but only ONE of 2 duplicate of "test2".
However, in each case, I was expecting to find 5 records! This is also weird. Please check it with xpather.com by yourself.
I'm not sure if it is a bug for
antchfx/xmlquery
orantchfx/xpath
but anyway I submitted the issue here.The text was updated successfully, but these errors were encountered: