Skip to content

Remove a FindEach() and FindEachWithBreak() method #7

Closed

Description

@zhengchun

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.

Activity

  1. zhengchun commented on Feb 8, 2019

    @zhengchun
    ContributorAuthor

    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)
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址