summaryrefslogtreecommitdiff
path: root/node.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2018-11-16 02:35:51 +0000
committerFelix Hanley <felix@userspace.com.au>2018-11-16 02:35:51 +0000
commitdc0a50a47d1ad749efa298dcdcd732daa33388c9 (patch)
tree3077df1c0c4e40dec5ba3d116ca4dba6419ef3b2 /node.go
downloadquery-dc0a50a47d1ad749efa298dcdcd732daa33388c9.tar.gz
query-dc0a50a47d1ad749efa298dcdcd732daa33388c9.tar.bz2
Initial lexer and interfaces
Diffstat (limited to 'node.go')
-rw-r--r--node.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/node.go b/node.go
new file mode 100644
index 0000000..6a091e3
--- /dev/null
+++ b/node.go
@@ -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
+}