MCPcopy
hub / github.com/golang/net / ParseWithOptions

Function ParseWithOptions

html/parse.go:2288–2307  ·  view source on GitHub ↗

ParseWithOptions is like Parse, with options.

(r io.Reader, opts ...ParseOption)

Source from the content-addressed store, hash-verified

2286
2287// ParseWithOptions is like Parse, with options.
2288func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) {
2289 p := &parser{
2290 tokenizer: NewTokenizer(r),
2291 doc: &Node{
2292 Type: DocumentNode,
2293 },
2294 scripting: true,
2295 framesetOK: true,
2296 im: initialIM,
2297 }
2298
2299 for _, f := range opts {
2300 f(p)
2301 }
2302
2303 if err := p.parse(); err != nil {
2304 return nil, err
2305 }
2306 return p.doc, nil
2307}
2308
2309// ParseFragmentWithOptions is like ParseFragment, with options.
2310func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ([]*Node, error) {

Callers 2

testParseCaseFunction · 0.85
ParseFunction · 0.85

Calls 2

parseMethod · 0.95
NewTokenizerFunction · 0.85

Tested by 1

testParseCaseFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…