struct Attr
XuAPI
pub struct Attr {
pub key string
pub value string
}用途
公开结构体 `Attr`。
参数
keystring- 键
valuestring- 字段(string)
API
#html/query标准库包 `#html/query`。
struct Attrpub struct Attr {
pub key string
pub value string
}公开结构体 `Attr`。
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
}公开结构体 `Doc`。
tags []stringtexts []stringfirsts []intnexts []intparents []intattr_keys []stringattr_vals []stringattr_next []intattr_head []intparsepub fn parse(html0 string) Doc解析输入。
html0 stringDoc — 该类型的值
(&Doc) rootpub fn (d &Doc) root() int在 `&Doc` 上调用 `root`。
d &Docint — 该类型的值
(&Doc) tagpub fn (d &Doc) tag(n int) string`&Doc` 上的方法:标签。
d &Docn intstring — 结果字符串
(&Doc) attrpub fn (d &Doc) attr(n int, key string) string在 `&Doc` 上调用 `attr`。
d &Docn intkey stringstring — 结果字符串
(&Doc) text_contentpub fn (d &Doc) text_content(n int) string`&Doc` 上的方法:文本content。
d &Docn intstring — 结果字符串
(&Doc) query_allpub fn (d &Doc) query_all(selector string) []int`&Doc` 上的方法:查询串all。
d &Docselector string[]int — 切片结果
(&Doc) querypub fn (d &Doc) query(selector string) int`&Doc` 上的方法:查询串。
d &Docselector stringint — 该类型的值