Document.this
this
(const(char)[] html, Parsing parsing = Parsing.Eager, size_t chunkSize = DefaultChunkSize)Parse a document. With Parsing.Lazy the tree is built chunk by chunk (chunkSize bytes), only when a query or an accessor needs more of it. The results are always the same as for a fully parsed document.
auto doc = Document(hugeHtml, Parsing.Lazy);
auto links = doc.byTagName("a").take(3).array; // parses only the beginning of the document
assert(doc.bytesParsed < hugeHtml.length);Any mutation of a lazy document (or of one of its nodes) completes the parsing first. To parse at compile time, see ctDocument.
this
(const(char)[] html, ParseOptions options)ditto
this
(string html, Parsing parsing = Parsing.Eager, size_t chunkSize = DefaultChunkSize)ditto (an immutable string is not copied by the lazy parsing)
this
(string html, ParseOptions options)ditto
this
(Snapshot snapshot)Rebuild a document from a snapshot (see snapshot): much faster than parsing again. Each call gives a new, independent document.