MCPcopy
hub / github.com/andeya/pholcus / NewDocumentFromReader

Function NewDocumentFromReader

common/goquery/type.go:49–55  ·  view source on GitHub ↗

NewDocumentFromReader returns a Document from a generic reader. It does *not* check if the reader is also an io.Closer, so the provided reader is never closed by this call, it is the responsibility of the caller to close it if required.

(r io.Reader)

Source from the content-addressed store, hash-verified

47// provided reader is never closed by this call, it is the responsibility
48// of the caller to close it if required.
49func NewDocumentFromReader(r io.Reader) result.Result[*Document] {
50 root, e := html.Parse(r)
51 if e != nil {
52 return result.TryErr[*Document](e)
53 }
54 return result.Ok(newDocument(root, nil))
55}
56
57// NewDocumentFromResponse is another Document constructor that takes an http response as argument.
58// It loads the specified response's document, parses it, and stores the root Document

Callers 13

initDomMethod · 0.92
ExtractArticleFunction · 0.92
TestNewFormFunction · 0.92
TestNewForm_PostFunction · 0.92
TestNewForm_MultipartFunction · 0.92
TestIssue26Function · 0.85
TestIssue103Function · 0.85
TestNbspFunction · 0.85
TestNodeNameFunction · 0.85
TestNodeNameMultiSelFunction · 0.85

Calls 2

newDocumentFunction · 0.85
ParseMethod · 0.45

Tested by 11

TestNewFormFunction · 0.74
TestNewForm_PostFunction · 0.74
TestNewForm_MultipartFunction · 0.74
TestIssue26Function · 0.68
TestIssue103Function · 0.68
TestNbspFunction · 0.68
TestNodeNameFunction · 0.68
TestNodeNameMultiSelFunction · 0.68
TestOuterHtmlFunction · 0.68