dom

package module
v0.0.0-...-3b2d60a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2014 License: MIT Imports: 6 Imported by: 0

README

dom

DOM

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SelfClosingTags = map[string]bool{
	"base":     true,
	"basefont": true,
	"frame":    true,
	"link":     true,
	"meta":     true,
	"area":     true,
	"br":       true,
	"col":      true,
	"hr":       true,
	"img":      true,
	"input":    true,
	"param":    true,
}

Functions

func Replace

func Replace(n1, n2 Node)

func TextContent

func TextContent(root Node) string

func Visit

func Visit(root Node, handler func(Node, func()))

Types

type Attribute

type Attribute struct {
	Name, Value string
}

type Container

type Container struct {
	// contains filtered or unexported fields
}

func (*Container) Append

func (this *Container) Append(n Node)

Container

func (*Container) Children

func (this *Container) Children() []Node

func (*Container) Insert

func (this *Container) Insert(pos int, node Node)

func (*Container) Remove

func (this *Container) Remove(n Node) bool

type Element

type Element struct {
	Tag string

	Container
	// contains filtered or unexported fields
}

func NewElement

func NewElement(tag string) *Element

Element

func (*Element) Append

func (this *Element) Append(node Node)

func (*Element) Clone

func (this *Element) Clone() Node

func (*Element) Export

func (this *Element) Export(w io.Writer)

func (*Element) Get

func (this *Element) Get(name string) (string, bool)

func (*Element) Insert

func (this *Element) Insert(pos int, node Node)

func (*Element) IsSelfClosing

func (this *Element) IsSelfClosing() bool

func (*Element) Parent

func (this *Element) Parent() Node

func (*Element) Set

func (this *Element) Set(name, value string)

func (*Element) SetParent

func (this *Element) SetParent(parent Node)

func (*Element) String

func (this *Element) String() string

type Fragment

type Fragment struct {
	Container
	// contains filtered or unexported fields
}

func FromXml

func FromXml(decoder *xml.Decoder) (*Fragment, error)

func NewFragment

func NewFragment() *Fragment

Fragment

func ParseHtml

func ParseHtml(html []byte) *Fragment

func (*Fragment) Append

func (this *Fragment) Append(n Node)

func (*Fragment) Clone

func (this *Fragment) Clone() Node

func (*Fragment) Export

func (this *Fragment) Export(w io.Writer)

func (*Fragment) Get

func (this *Fragment) Get(name string) (string, bool)

func (*Fragment) Insert

func (this *Fragment) Insert(pos int, node Node)

func (*Fragment) Parent

func (this *Fragment) Parent() Node

func (*Fragment) Set

func (this *Fragment) Set(name, value string)

func (*Fragment) SetParent

func (this *Fragment) SetParent(parent Node)

func (*Fragment) String

func (this *Fragment) String() string

type Html

type Html struct{ Text }

func NewHtml

func NewHtml(content string) *Html

HTML

func (*Html) Clone

func (this *Html) Clone() Node

func (*Html) Export

func (this *Html) Export(w io.Writer)

type Node

type Node interface {
	Append(Node)
	Children() []Node
	Clone() Node
	Export(io.Writer)
	Get(string) (string, bool)
	Insert(int, Node)
	Parent() Node
	Remove(Node) bool
	Set(string, string)
	SetParent(Node)
}

type Text

type Text struct {
	Content string
	// contains filtered or unexported fields
}

func NewText

func NewText(content string) *Text

Text

func (*Text) Append

func (this *Text) Append(n Node)

func (*Text) Children

func (this *Text) Children() []Node

func (*Text) Clone

func (this *Text) Clone() Node

func (*Text) Export

func (this *Text) Export(w io.Writer)

func (*Text) Get

func (this *Text) Get(name string) (string, bool)

func (*Text) Insert

func (this *Text) Insert(pos int, node Node)

func (*Text) Parent

func (this *Text) Parent() Node

func (*Text) Remove

func (this *Text) Remove(n Node) bool

func (*Text) Set

func (this *Text) Set(name, value string)

func (*Text) SetParent

func (this *Text) SetParent(parent Node)

func (*Text) String

func (this *Text) String() string

type Visitor

type Visitor func(node Node, visit func())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL