html

package
v0.0.0-...-f90c734 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTMLDocument

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

HTMLDocument represents a collection of nodes under a single parent container.

func (*HTMLDocument) Filter

func (h *HTMLDocument) Filter(sel string) (parser.Document, error)

Filter traverses the document tree and attempts to match elements against the provided CSS selector. On success, a new document is returned, containing a list of all matched elements. An error is returned if the CSS selector is malformed, or no elements were matched.

func (*HTMLDocument) Slice

func (h *HTMLDocument) Slice() []parser.Document

Slice decomposes the target HTMLDocument into a slice of HTMLDocument types, each containing a single node from the parent's list of nodes.

func (*HTMLDocument) String

func (h *HTMLDocument) String() string

Returns the document contents by traversing the tree and concatenating all data contained within text nodes.

type HTMLParser

type HTMLParser struct{}

HTMLParser represents a parser and tokeniser for HTML documents.

func (*HTMLParser) Parse

func (h *HTMLParser) Parse(r io.Reader) (parser.Document, error)

Parse reads an HTML document from the reader passed, and returns a document containing a single parent node. An error is returned if parsing fails.

Jump to

Keyboard shortcuts

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