struct Attr
XuAPI
pub struct Attr {
pub key string
pub value string
}Purpose
Structure encapsulating key, value.
Public fields
keystring- key
valuestring- field (string)
#html/queryMinimal HTML DOM + CSS query subset for scraping. Selectors: tag, #id,.class, tag.class, descendant (a b), child (a > b). Flat node pool (json.Doc style) — no recursive owning trees.
struct Attrpub struct Attr {
pub key string
pub value string
}Structure encapsulating key, value.
key stringvalue stringstruct Docpub struct Doc {
pub tags []string
pub texts []string
pub firsts []int
pub nexts []int
pub parents []int
pub attr_keys []string
pub attr_vals []string
pub attr_next []int
pub attr_head []int
}Structure encapsulating tags, texts, firsts, nexts, parents.
tags []stringtexts []stringfirsts []intnexts []intparents []intattr_keys []stringattr_vals []stringattr_next []intattr_head []intparsepub fn parse(html0 string) DocParse the input.
html0 stringDoc — a value of this type
(&Doc) rootpub fn (d &Doc) root() intExecute root on &Doc.
d &DocDoc instance used by this call (borrow).int — a value of this type
(&Doc) tagpub fn (d &Doc) tag(n int) stringExecute tag on &Doc.
d &DocDoc instance used by this call (borrow).n intstring — result string
(&Doc) attrpub fn (d &Doc) attr(n int, key string) stringExecute attr on &Doc.
d &DocDoc instance used by this call (borrow).n intkey stringstring — result string
(&Doc) text_contentpub fn (d &Doc) text_content(n int) stringOperation on &Doc: text content.
d &DocDoc instance used by this call (borrow).n intstring — result string
(&Doc) query_allpub fn (d &Doc) query_all(selector string) []intIterative query — avoid recursive array ownership pitfalls.
d &DocDoc instance used by this call (borrow).selector string[]int — slice result
(&Doc) querypub fn (d &Doc) query(selector string) intExecute query on &Doc.
d &DocDoc instance used by this call (borrow).selector stringint — a value of this type