Why no New from a Reader or String? #20

Closed
jweir opened this Issue Sep 3, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@jweir

jweir commented Sep 3, 2013

I am using goquery to scan existing HTML files. These aren't created from a response. And I don't want to expose go.net/html to my application.

A NewFromString or NewFromReader would be great... or just a simple New

func New(src io.Reader) (d *Document, e error){
    // Parse the HTML into nodes
    root, e := html.Parse(src)
    if e != nil {
        return
    }

    // Create and fill the document
    d = newDocument(root, nil)
    return
}

BTW nice library, thank you very much.

@mna

This comment has been minimized.

Show comment
Hide comment
@mna

mna Sep 4, 2013

Member

I'll add it, probably this week-end.

Member

mna commented Sep 4, 2013

I'll add it, probably this week-end.

jweir added a commit to jweir/goquery that referenced this issue Sep 5, 2013

jweir added a commit to jweir/goquery that referenced this issue Sep 5, 2013

@jweir

This comment has been minimized.

Show comment
Hide comment
@jweir

jweir Sep 5, 2013

Pushed the above if you are interested. It might not be the naming convention you want to follow.

jweir commented Sep 5, 2013

Pushed the above if you are interested. It might not be the naming convention you want to follow.

@mna mna closed this in f065786 Sep 7, 2013

@mna

This comment has been minimized.

Show comment
Hide comment
@mna

mna Sep 7, 2013

Member

Thanks, but I followed the NewDocumentFromX naming even though it would have been a good candidate for simply New, but it would have been ambiguous with the existing NewDocument. I don't want to make breaking changes at this point.

Member

mna commented Sep 7, 2013

Thanks, but I followed the NewDocumentFromX naming even though it would have been a good candidate for simply New, but it would have been ambiguous with the existing NewDocument. I don't want to make breaking changes at this point.

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