antchfx/htmlquery

Remove a `FindEach()` and `FindEachWithBreak()` method

zhengchun opened this issue · 1 comments

FindEach and FindEachWithBreak will duplicate invoke a callback function if an XPath expression matches duplicate elements, see #6, the other reason it‘s often not used. I planing remove these method from package, if you still want it, you can implement yourself method.

FindEach and FindEachWithBreak is equivalent to for ... = range Find(doc,“expr"){...}.

FindEach() equivalent to following code

for i,n := range htmlquery.Find(doc,"//a"){
    fmt.Println(n)
}

FindEachWithBreak equivalent to following code

for i,n := range htmlquery.Find(doc,"//a"){
    if (i<10){
        break
    }
    fmt.Println(n)
}