# html/open
Parse an HTML document once and return a `%HtmlDocument` handle, so
repeated `html/select` / `html/text` / `html/serialize` calls run
against the live parsed document instead of re-parsing the string every
call.
## Syntax
[html/open $src ?opts]
## Parameters
- `$src` — HTML source text (string)
- `$opts` — same options as `html/parse`: `:encoding string|:auto`,
`:fragment true`
## Examples
set d [html/open "<article><h2>One</h2><p>para</p><h2>Two</h2></article>"] set hs [html/select $d "h2"] set titles @{} each $hs {|h| $titles << [nth $h~children 0] } # titles => @{ "One" "Two" } [html/close $d]
## Returns
A `%HtmlDocument` native-resource handle. Pass it wherever `html/text`,
`html/select`, or `html/serialize` accept a source; the handle is
finalized by the GC, so `html/close` is an optimisation for prompt
teardown of large documents, not a requirement.
Parse failures return `%Err{ :message "..." }`.
## See Also
`html/close`, `html/parse`, `html/select`, `html/text`