Documentation
¶
Index ¶
- Variables
- type Node
- func Find(top *Node, expr string) []*Node
- func FindOne(top *Node, expr string) *Node
- func LoadURL(url string) (*Node, error)
- func Parse(r io.Reader) (*Node, error)
- func Query(top *Node, expr string) (*Node, error)
- func QueryAll(top *Node, expr string) ([]*Node, error)
- func QuerySelector(top *Node, selector *xpath.Expr) *Node
- func QuerySelectorAll(top *Node, selector *xpath.Expr) []*Node
- type NodeNavigator
- func (a *NodeNavigator) Copy() xpath.NodeNavigator
- func (a *NodeNavigator) Current() *Node
- func (a *NodeNavigator) GetValue() interface{}
- func (a *NodeNavigator) LocalName() string
- func (a *NodeNavigator) MoveTo(other xpath.NodeNavigator) bool
- func (a *NodeNavigator) MoveToChild() bool
- func (a *NodeNavigator) MoveToFirst() bool
- func (a *NodeNavigator) MoveToNext() bool
- func (x *NodeNavigator) MoveToNextAttribute() bool
- func (a *NodeNavigator) MoveToParent() bool
- func (a *NodeNavigator) MoveToPrevious() bool
- func (a *NodeNavigator) MoveToRoot()
- func (a *NodeNavigator) NodeType() xpath.NodeType
- func (a *NodeNavigator) Prefix() string
- func (a *NodeNavigator) String() string
- func (a *NodeNavigator) Value() string
- type NodeType
Constants ¶
This section is empty.
Variables ¶
var DisableSelectorCache = false
DisableSelectorCache will disable caching for the query selector if value is true.
var SelectorCacheMaxEntries = 50
SelectorCacheMaxEntries allows how many selector object can be caching. Default is 50. Will disable caching if SelectorCacheMaxEntries <= 0.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
Parent, PrevSibling, NextSibling, FirstChild, LastChild *Node
Type NodeType
Data string
// contains filtered or unexported fields
}
A Node consists of a NodeType and some Data (tag name for element nodes, content for text) and are part of a tree of Nodes.
func Query ¶
Query searches the Node that matches by the specified XPath expr, and returns first element of matched.
func QueryAll ¶
QueryAll searches the Node that matches by the specified XPath expr. Return an error if the expression `expr` cannot be parsed.
func QuerySelector ¶
QuerySelector returns the first matched XML Node by the specified XPath selector.
func QuerySelectorAll ¶
QuerySelectorAll searches all of the Node that matches the specified XPath selectors.
func (*Node) ChildNodes ¶
ChildNodes gets all child nodes of the node.
func (*Node) SelectElement ¶
SelectElement finds the first of child elements with the specified name.
type NodeNavigator ¶
type NodeNavigator struct {
// contains filtered or unexported fields
}
NodeNavigator is for navigating JSON document.
func CreateXPathNavigator ¶
func CreateXPathNavigator(top *Node) *NodeNavigator
CreateXPathNavigator creates a new xpath.NodeNavigator for the specified html.Node.
func (*NodeNavigator) Copy ¶
func (a *NodeNavigator) Copy() xpath.NodeNavigator
func (*NodeNavigator) Current ¶
func (a *NodeNavigator) Current() *Node
func (*NodeNavigator) GetValue ¶ added in v1.3.0
func (a *NodeNavigator) GetValue() interface{}
func (*NodeNavigator) LocalName ¶
func (a *NodeNavigator) LocalName() string
func (*NodeNavigator) MoveTo ¶
func (a *NodeNavigator) MoveTo(other xpath.NodeNavigator) bool
func (*NodeNavigator) MoveToChild ¶
func (a *NodeNavigator) MoveToChild() bool
func (*NodeNavigator) MoveToFirst ¶
func (a *NodeNavigator) MoveToFirst() bool
func (*NodeNavigator) MoveToNext ¶
func (a *NodeNavigator) MoveToNext() bool
func (*NodeNavigator) MoveToNextAttribute ¶
func (x *NodeNavigator) MoveToNextAttribute() bool
func (*NodeNavigator) MoveToParent ¶
func (a *NodeNavigator) MoveToParent() bool
func (*NodeNavigator) MoveToPrevious ¶
func (a *NodeNavigator) MoveToPrevious() bool
func (*NodeNavigator) MoveToRoot ¶
func (a *NodeNavigator) MoveToRoot()
func (*NodeNavigator) NodeType ¶
func (a *NodeNavigator) NodeType() xpath.NodeType
func (*NodeNavigator) Prefix ¶
func (a *NodeNavigator) Prefix() string
func (*NodeNavigator) String ¶
func (a *NodeNavigator) String() string
func (*NodeNavigator) Value ¶
func (a *NodeNavigator) Value() string