summaryrefslogtreecommitdiff
path: root/node.go
blob: 6a091e385c96bbed2fc641a6924ea545b9aa6ba5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package query

import (
	"golang.org/x/net/html"
)

type NodeType uint32

const (
	ErrorNode     = NodeType(html.ErrorNode)
	TextNode      = NodeType(html.TextNode)
	DocumentNode  = NodeType(html.DocumentNode)
	ElementNode   = NodeType(html.ElementNode)
	CommentNode   = NodeType(html.CommentNode)
	DoctypeNode   = NodeType(html.DoctypeNode)
	AttributeNode = 100
	AnyNode       = 101
	// Add json node types
)

type Node interface {
	Parent() Node
	FirstChild() Node
	LastChild() Node
	PrevSibling() Node
	NextSibling() Node
	Type() NodeType
	Data() string
	Attr() []Attribute
}

type Attribute struct {
	Namespace, Key, Val string
}