Documentation
¶
Index ¶
- Variables
- func AttributeVal(node *html.Node, k string) (v string, err error)
- func ChildEqualText(node *html.Node, text string) bool
- func ContainsClass(source string, v string) bool
- func ContainsText(node *html.Node, text string) bool
- func EqualText(node *html.Node, text string) bool
- func ExactText(node *html.Node) (string, error)
- func FirstChild(node *html.Node, nodeType html.NodeType) (p *html.Node, err error)
- func LastChild(node *html.Node, nodeType html.NodeType) (p *html.Node, err error)
- func Text(node *html.Node) string
- type NodeEnum
- type NodeSet
- func (p NodeSet) A() (ret NodeSet)
- func (p NodeSet) Any() (ret NodeSet)
- func (p NodeSet) AttrVal(k string, exactlyOne ...bool) (text string, err error)
- func (p NodeSet) Attribute(k, v string) (ret NodeSet)
- func (p NodeSet) Cache() NodeSet
- func (p NodeSet) CachedLen() int
- func (p NodeSet) Child() (ret NodeSet)
- func (p NodeSet) ChildEqualText(text string) (ret NodeSet)
- func (p NodeSet) ChildN(level int) (ret NodeSet)
- func (p NodeSet) ChildrenAsText(doReplace bool) (ret NodeSet)
- func (p NodeSet) Class(v string) (ret NodeSet)
- func (p NodeSet) Collect() (items []*html.Node, err error)
- func (p NodeSet) CollectOne(exactly ...bool) (item *html.Node, err error)
- func (p NodeSet) ContainsClass(v string) (ret NodeSet)
- func (p NodeSet) ContainsText(text string) (ret NodeSet)
- func (p NodeSet) Div() (ret NodeSet)
- func (p NodeSet) Dump() NodeSet
- func (p NodeSet) Element(v interface{}) (ret NodeSet)
- func (p NodeSet) EqualText(text string) (ret NodeSet)
- func (p NodeSet) ExactText(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) FirstChild(nodeType html.NodeType) (ret NodeSet)
- func (p NodeSet) FirstElementChild() (ret NodeSet)
- func (p NodeSet) FirstTextChild() (ret NodeSet)
- func (p NodeSet) ForEach(filter func(node NodeSet))
- func (p NodeSet) H1() (ret NodeSet)
- func (p NodeSet) H2() (ret NodeSet)
- func (p NodeSet) H3() (ret NodeSet)
- func (p NodeSet) H4() (ret NodeSet)
- func (p NodeSet) Href(v string) (ret NodeSet)
- func (p NodeSet) HrefVal(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) ID(v string) (ret NodeSet)
- func (p NodeSet) Img() (ret NodeSet)
- func (p NodeSet) Int(exactlyOne ...bool) (v int, err error)
- func (p NodeSet) LastChild(nodeType html.NodeType) (ret NodeSet)
- func (p NodeSet) LastElementChild() (ret NodeSet)
- func (p NodeSet) LastTextChild() (ret NodeSet)
- func (p NodeSet) Li() (ret NodeSet)
- func (p NodeSet) Match(filter func(node *html.Node) bool) (ret NodeSet)
- func (p NodeSet) Nav() (ret NodeSet)
- func (p NodeSet) NextSibling(delta int) (ret NodeSet)
- func (p NodeSet) NextSiblings() (ret NodeSet)
- func (p NodeSet) Ok() bool
- func (p NodeSet) Ol() (ret NodeSet)
- func (p NodeSet) One() (ret NodeSet)
- func (p NodeSet) Parent() (ret NodeSet)
- func (p NodeSet) ParentN(level int) (ret NodeSet)
- func (p NodeSet) PrevSibling(delta int) (ret NodeSet)
- func (p NodeSet) PrevSiblings() (ret NodeSet)
- func (p NodeSet) Printf(w io.Writer, format string, params ...interface{}) NodeSet
- func (p NodeSet) ScanInt(format string, exactlyOne ...bool) (v int, err error)
- func (p NodeSet) Span() (ret NodeSet)
- func (p NodeSet) Td() (ret NodeSet)
- func (p NodeSet) Text(exactlyOne ...bool) (text string, err error)
- func (p NodeSet) Ul() (ret NodeSet)
- func (p NodeSet) UnitedFloat(exactlyOne ...bool) (v float64, err error)
- type SourceCreator
- func (p SourceCreator) Bytes(text []byte) (ret NodeSet)
- func (p SourceCreator) File(htmlFile string) (ret NodeSet)
- func (p SourceCreator) HTTP(url string) (ret NodeSet)
- func (p SourceCreator) Reader(r io.Reader) (ret NodeSet)
- func (p SourceCreator) Stdin() (ret NodeSet)
- func (p SourceCreator) String(text string) (ret NodeSet)
- func (p SourceCreator) URI(uri string) (ret NodeSet)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyText - empty text ErrEmptyText = errors.New("empty text") // ErrInvalidScanFormat - invalid fmt.Scan format ErrInvalidScanFormat = errors.New("invalid fmt.Scan format") // ErrUnmatchedScanFormat - unmatched fmt.Scan format ErrUnmatchedScanFormat = errors.New("unmatched fmt.Scan format") )
var ( // ErrNotFound - not found ErrNotFound = syscall.ENOENT // ErrBreak - break ErrBreak = syscall.ELOOP // ErrTooManyNodes - too may nodes ErrTooManyNodes = errors.New("too many nodes") // ErrInvalidNode - invalid node ErrInvalidNode = errors.New("invalid node") // ErrNotTextNode - not a text node ErrNotTextNode = errors.New("not a text node") )
Functions ¶
func AttributeVal ¶
AttributeVal returns attribute k's value of a node.
func ChildEqualText ¶
ChildEqualText checks if child node is TextNode and value is equal to text or not.
func ContainsClass ¶
ContainsClass checks class v is in source classes or not.
func ContainsText ¶
ContainsText checks if node is TextNode and value contains text or not.
func FirstChild ¶
FirstChild returns first nodeType node.
Types ¶
type NodeSet ¶
NodeSet - node set
func (NodeSet) ChildEqualText ¶
ChildEqualText returns node set whose child is TextNode and value is equal to text.
func (NodeSet) ChildrenAsText ¶
ChildrenAsText converts all children as text node.
func (NodeSet) CollectOne ¶
CollectOne collects one node of a node set. If exactly is true, it returns ErrTooManyNodes when node set is more than one.
func (NodeSet) ContainsClass ¶
ContainsClass returns nodes whose attribute `class` contains v.
func (NodeSet) ContainsText ¶
ContainsText returns node set who is TextNode and value contains text.
func (NodeSet) FirstChild ¶
FirstChild returns first nodeType node as a node set.
func (NodeSet) FirstElementChild ¶
FirstElementChild returns first element node as a node set.
func (NodeSet) FirstTextChild ¶
FirstTextChild returns first text node as a node set.
func (NodeSet) LastElementChild ¶
LastElementChild returns last element node as a node set.
func (NodeSet) LastTextChild ¶
LastTextChild returns last text node as a node set.
func (NodeSet) NextSibling ¶
NextSibling returns next sibling node set.
func (NodeSet) NextSiblings ¶
NextSiblings return all next sibling node set.
func (NodeSet) PrevSibling ¶
PrevSibling returns prev sibling node set.
func (NodeSet) PrevSiblings ¶
PrevSiblings return all prev sibling node set.
type SourceCreator ¶
type SourceCreator struct{}
SourceCreator - hq source creator.
var ( // Source - hq source creator Source SourceCreator )
func (SourceCreator) Bytes ¶
func (p SourceCreator) Bytes(text []byte) (ret NodeSet)
Bytes - a bytes hq source
func (SourceCreator) File ¶
func (p SourceCreator) File(htmlFile string) (ret NodeSet)
File - a local file hq source
func (SourceCreator) HTTP ¶
func (p SourceCreator) HTTP(url string) (ret NodeSet)
HTTP - a http hq source
func (SourceCreator) Reader ¶
func (p SourceCreator) Reader(r io.Reader) (ret NodeSet)
Reader - a stream hq source
func (SourceCreator) String ¶
func (p SourceCreator) String(text string) (ret NodeSet)
String - a string hq source
func (SourceCreator) URI ¶
func (p SourceCreator) URI(uri string) (ret NodeSet)
URI - a uri hq source