diff options
| author | Felix Hanley <felix@userspace.com.au> | 2018-11-16 02:35:51 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2018-11-16 02:35:51 +0000 |
| commit | dc0a50a47d1ad749efa298dcdcd732daa33388c9 (patch) | |
| tree | 3077df1c0c4e40dec5ba3d116ca4dba6419ef3b2 /node.go | |
| download | query-dc0a50a47d1ad749efa298dcdcd732daa33388c9.tar.gz query-dc0a50a47d1ad749efa298dcdcd732daa33388c9.tar.bz2 | |
Initial lexer and interfaces
Diffstat (limited to 'node.go')
| -rw-r--r-- | node.go | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,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 +} |
