Documentation
¶
Overview ¶
Package search contains searching routines for the simplexml/dom package. For some basic usage exmaples, see search_test.go
Index ¶
- func All(fn Match, nodes []*dom.Element) []*dom.Element
- func First(fn Match, nodes []*dom.Element) *dom.Element
- func FirstTag(name, space string, nodes []*dom.Element) *dom.Element
- func MustFirstTag(name, space string, nodes []*dom.Element) *dom.Element
- type Match
- func Always() Match
- func Ancestor(fn Match) Match
- func AncestorN(fn Match, distance uint) Match
- func And(funcs ...Match) Match
- func Attr(name, space, value string) Match
- func AttrRE(name, space, value *regexp.Regexp) Match
- func Child(fn Match) Match
- func Content(content []byte) Match
- func ContentExists() Match
- func ContentRE(regex *regexp.Regexp) Match
- func Never() Match
- func NoParent() Match
- func Not(fn Match) Match
- func Or(funcs ...Match) Match
- func Parent(fn Match) Match
- func Tag(name, space string) Match
- func TagRE(name, space *regexp.Regexp) Match
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Match ¶
Match is the basic type of a search function. It takes a single element, and returns a boolean indicating whether the element matched the func.
func Ancestor ¶
Ancestor returns a matcher that matches iff the element has an ancestor that matches the passed matcher
func AncestorN ¶
AncestorN returns a matcher that matches against the nth ancestor of the node being tested. If n == 0, then the node itself will be tested as a degenerate case. If there is no such ancestor the match fails.
func And ¶
And takes any number of Match, and returns another Match that will match if all of passed Match functions match.
func Attr ¶
Attr creates a Match against the attributes of an element. It follows the same rules as Tag
func AttrRE ¶
AttrRE creates a Match against the attributes of an element. It follows the same rules as MatchRE
func Child ¶
Child returns a matcher that matches iff the element has a child that matches the passed fn.
func Content ¶
Content creates a Match against an element that tests to see if it matches the supplied content.
func ContentExists ¶
func ContentExists() Match
ContentExists creates a Match against an element that has non-empty Content.
func ContentRE ¶
ContentRE creates a Match against the Content of am element that passes if the regex matches the content.
func NoParent ¶
func NoParent() Match
NoParent returns a matcher that matches iff the element does not have a parent
func Or ¶
Or takes any number of Match, and returns another Match that will match if any of the passed Match functions match.
func Parent ¶
Parent returns a matcher that matches iff the element has a parent and that parent matches the passed fn.