Documentation
¶
Index ¶
- func AllWithClassName(node *html.Node, className string) []*html.Node
- func AllWithClassNameR(node *html.Node, className string) []*html.Node
- func AllWithTag(node *html.Node, tagName string) []*html.Node
- func AllWithTagR(node *html.Node, tagName string) []*html.Node
- func Attr(node *html.Node, attr string) string
- func FirstWithClassName(node *html.Node, className string) *html.Node
- func FirstWithClassNameR(node *html.Node, className string) *html.Node
- func FirstWithId(node *html.Node, id string) *html.Node
- func FirstWithIdR(node *html.Node, id string) *html.Node
- func FirstWithTag(node *html.Node, tagName string) *html.Node
- func FirstWithTagR(node *html.Node, tagName string) *html.Node
- func HasClass(node *html.Node, className string) bool
- func SelectAll(node *html.Node, selector Selector) []*html.Node
- func SelectFirst(node *html.Node, selector Selector) *html.Node
- func TextContent(node *html.Node) string
- type Node
- func (n *Node) AllWithClassName(className string) []*Node
- func (n *Node) AllWithClassNameR(className string) []*Node
- func (n *Node) AllWithTag(tagName string) []*Node
- func (n *Node) AllWithTagR(tagName string) []*Node
- func (n *Node) Attr(attr string) string
- func (n *Node) FirstWithClassName(className string) *Node
- func (n *Node) FirstWithClassNameR(className string) *Node
- func (n *Node) FirstWithId(id string) *Node
- func (n *Node) FirstWithIdR(id string) *Node
- func (n *Node) FirstWithTag(tag string) *Node
- func (n *Node) FirstWithTagR(tag string) *Node
- func (n *Node) HasClass(className string) bool
- func (n *Node) SelectAll(selector Selector) []*Node
- func (n *Node) SelectFirst(selector Selector) *Node
- func (n *Node) String() string
- func (n *Node) TextContent() string
- type Selector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllWithClassName ¶
AllWithClassName returns all children that have the given class name.
func AllWithClassNameR ¶
AllWithClassNameR is the recursive variant of AllWithClassName
func AllWithTag ¶
AllWithTag returns all children with the given tag.
func AllWithTagR ¶
AllWithTagR is the recursive variant of AllWithTag
func FirstWithClassName ¶
FirstWithClassName returns the first child with the given class.
func FirstWithClassNameR ¶
FirstWithClassNameR is the recursive variant of FirstWithClassName.
func FirstWithId ¶
FirstWithId returns the first child with the given id.
func FirstWithIdR ¶
FirstWithIdR is the recursive variant of FirstWithId
func FirstWithTag ¶
FirstWithTag returns the first child with the given tag name
func FirstWithTagR ¶
FirstWithTagR is the recursive variant of FirstWithTag
func SelectFirst ¶
SelectFirst selects the first child node that matches the given selector
func TextContent ¶
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AllWithClassName ¶
AllWithClassName returns all child nodes that have the given class name.
func (*Node) AllWithClassNameR ¶
AllWithClassNameR is the recursive variant of AllWithClassName.
func (*Node) AllWithTag ¶
AllWithTag returns all child nodes with the given tag.
func (*Node) AllWithTagR ¶
AllWithTagR is the recursive variant of AllWithTag
func (*Node) Attr ¶
Attr returns the attribute value or an empty string if the attribute isn't found.
func (*Node) FirstWithClassName ¶
FirstWithClassName returns the first child with the given class.
func (*Node) FirstWithClassNameR ¶
FirstWithClassNameR is the recursive variant of FirstWithClassName.
func (*Node) FirstWithId ¶
FirstWithId returns the first child with the given id.
func (*Node) FirstWithIdR ¶
FirstWithIdR is the recursive variant of FirstWithId.
func (*Node) FirstWithTag ¶
FirstWithTag returns the first child node with the given tag.
func (*Node) FirstWithTagR ¶
FirstWithTagR is the recursive variant of FirstWithTag.
func (*Node) SelectFirst ¶
SelectFirst selects the first child node that matches the given selector.
func (*Node) TextContent ¶
TextContent returns the text content of the node
type Selector ¶
type Selector struct { // Selects an element with a given id. Takes precedence over ClassName Id string // Selects an element with a given class. Takes precedence over Tag ClassName string // Selects an element with a given tag Tag string // Perform a recursive search. That is, include the node's children in the search. Recursive bool }