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
Please look at the following test case. When I select follow-sibling::child[1], then only the first child should be selected.
`func TestFetchSibling(t *testing.T) {
xml := `<?xml version="1.0" encoding="UTF-8"?>
<node>
<element index="one"/>
<hash attr="one"/>
<element index="two"/>
<hash attr="two"/>
</node>
`
doc, _ := xmlquery.Parse(strings.NewReader(xml))
ele1 := xmlquery.FindOne(doc, "//node/element")
// specify xpath to pick the first element only
hashes := xmlquery.Find(ele1, "following-sibling::hash[1]")
if len(hashes) != 1 {
t.Errorf("lenght should be 1, but found %d", len(hashes))
}
}
`
The text was updated successfully, but these errors were encountered:
Hi,
Please look at the following test case. When I select follow-sibling::child[1], then only the first child should be selected.
`func TestFetchSibling(t *testing.T) {
}
`
The text was updated successfully, but these errors were encountered: