document

package
v0.0.0-...-28926d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExists    = errors.New("not exist")
	ErrInvalidQuery = errors.New("invalid query")
)

Functions

func GetCurrentNodeFromNavigator

func GetCurrentNodeFromNavigator(n *htmlquery.NodeNavigator) *html.Node

func HTMLNodeToBytes

func HTMLNodeToBytes(node html.Node) []byte

Types

type Document

type Document interface {
	Value() interface{}
	FindOne(expr string) (Document, error)
	FindAll(expr string) []Document
}

Document can be HTML, JSON, XML, etc.

type HTMLDoc

type HTMLDoc struct {
	// contains filtered or unexported fields
}

func NewHTML

func NewHTML(data []byte) (*HTMLDoc, error)

func (*HTMLDoc) FindAll

func (d *HTMLDoc) FindAll(expr string) []Document

func (*HTMLDoc) FindOne

func (d *HTMLDoc) FindOne(expr string) (Document, error)

func (*HTMLDoc) Value

func (d *HTMLDoc) Value() interface{}

type HTMLXpathDoc

type HTMLXpathDoc struct {
	// contains filtered or unexported fields
}

func NewHTMLXpath

func NewHTMLXpath(data []byte) (*HTMLXpathDoc, error)

func (*HTMLXpathDoc) FindAll

func (d *HTMLXpathDoc) FindAll(expr string) []Document

func (*HTMLXpathDoc) FindOne

func (d *HTMLXpathDoc) FindOne(expr string) (Document, error)

func (*HTMLXpathDoc) Value

func (d *HTMLXpathDoc) Value() interface{}

type JSONDoc

type JSONDoc struct {
	// contains filtered or unexported fields
}

func NewJSON

func NewJSON(data []byte) (*JSONDoc, error)

func (*JSONDoc) FindAll

func (d *JSONDoc) FindAll(path string) []Document

func (*JSONDoc) FindOne

func (d *JSONDoc) FindOne(path string) (Document, error)

func (*JSONDoc) Value

func (d *JSONDoc) Value() interface{}

type JSONXpathDoc

type JSONXpathDoc struct {
	// contains filtered or unexported fields
}

func NewJSONXpath

func NewJSONXpath(data []byte) (*JSONXpathDoc, error)

func (*JSONXpathDoc) FindAll

func (d *JSONXpathDoc) FindAll(expr string) []Document

func (*JSONXpathDoc) FindOne

func (d *JSONXpathDoc) FindOne(expr string) (Document, error)

func (*JSONXpathDoc) Value

func (d *JSONXpathDoc) Value() interface{}

type XMLXpathDoc

type XMLXpathDoc struct {
	// contains filtered or unexported fields
}

func NewXMLXpath

func NewXMLXpath(data []byte) (*XMLXpathDoc, error)

func (*XMLXpathDoc) FindAll

func (d *XMLXpathDoc) FindAll(expr string) []Document

func (*XMLXpathDoc) FindOne

func (d *XMLXpathDoc) FindOne(expr string) (Document, error)

func (*XMLXpathDoc) Value

func (d *XMLXpathDoc) Value() interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL