Documentation ¶
Overview ¶
Package h5 implements an html5 parser for the go language.
p := h5.NewParser(rdr) err := p.Parse() tree := p.Tree() tree.Walk(func(n *Node) { // do something with the node }) tree2 := tree.Clone()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { Type NodeType // The type of node this is. Attr []*Attribute // The attributes of the html5 node Parent *Node // The parent of the html5 node if it has one, nil otherwise Children []*Node // The children of the html5 node if it has any. Public bool // True if this is a PUBLIC doctype node System bool // True if this is a SYSTEM doctype node Identifier []rune // The identifier if this is a doctype node // contains filtered or unexported fields }
The type of an html5 node
func (*Node) Data ¶
String form of an html nodes data. (eg: The Tagname for ElementNodes or text for TextNodes)
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
Represents an html5 parsing error. holds a message and the current html5 node when the error occured.
func NewParseError ¶
func NewParseError(n *Node, msg string, args ...interface{}) *ParseError
Constructor for an html5 parsing error
type Parser ¶
type Parser struct { In *bufio.Reader Top *Node Mode insertionMode // contains filtered or unexported fields }
An html5 parsing struct. It holds the parsing state for the html5 parsing state machine.
func NewParserFromString ¶
Construct a new h5 parser from a string
Click to show internal directories.
Click to hide internal directories.