summaryrefslogtreecommitdiff
path: root/node.go
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2018-11-20 05:44:30 +0000
committerFelix Hanley <felix@userspace.com.au>2018-11-20 05:44:30 +0000
commit12f344f96a8225c93873aafa0f110babae267a0a (patch)
treeac03e950244ea48d6e8f26b72f8d11ed94cded5b /node.go
parent505c75b306322a22aef900aac636100eab556be9 (diff)
downloadquery-12f344f96a8225c93873aafa0f110babae267a0a.tar.gz
query-12f344f96a8225c93873aafa0f110babae267a0a.tar.bz2
Use Node interface for JSON
Diffstat (limited to 'node.go')
-rw-r--r--node.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/node.go b/node.go
index 6a091e3..61650fb 100644
--- a/node.go
+++ b/node.go
@@ -15,9 +15,19 @@ const (
DoctypeNode = NodeType(html.DoctypeNode)
AttributeNode = 100
AnyNode = 101
- // Add json node types
)
+var NodeNames = map[NodeType]string{
+ ErrorNode: "ErrorNode",
+ DocumentNode: "DocumentNode",
+ ElementNode: "ElementNode",
+ TextNode: "TextNode",
+ CommentNode: "CommentNode",
+ DoctypeNode: "DoctypeNode",
+ AttributeNode: "AttributeNode",
+ AnyNode: "AnyNode",
+}
+
type Node interface {
Parent() Node
FirstChild() Node
@@ -26,6 +36,8 @@ type Node interface {
NextSibling() Node
Type() NodeType
Data() string
+ InnerText() string
+ DataType() string
Attr() []Attribute
}