xmlx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	DropComment               bool
	DropEmpty                 bool
	DropCDataSection          bool
	DropProcessingInstruction bool
	DropDocumentType          bool
	DropDirective             bool
	IncludeSelf               bool
	// contains filtered or unexported fields
}

func (*Exporter) ApplyOn

func (et *Exporter) ApplyOn(node *Node) string

type Node

type Node struct {
	ParentNode,
	FirstChild,
	LastChild,
	PrevSibling,
	NextSibling *Node
	Type         NodeType
	Value        string
	Name         string
	NamespaceURI string
	Prefix       string
	Attrs        []*Node
	ChildNodes   []*Node
}

func Parse

func Parse(reader io.Reader) (*Node, error)

func (*Node) AddSibling

func (node *Node) AddSibling(next *Node)

func (*Node) AppendAll

func (node *Node) AppendAll(nodes []*Node)

func (*Node) AppendChild

func (node *Node) AppendChild(child *Node)

func (*Node) Attr

func (node *Node) Attr(name string) *Node

func (*Node) AttrBool

func (node *Node) AttrBool(name string) bool

func (*Node) AttrString

func (node *Node) AttrString(name string) string

func (*Node) ClearContent

func (node *Node) ClearContent()

func (*Node) CloneNode

func (node *Node) CloneNode(deep bool) *Node

func (*Node) Contains

func (node *Node) Contains(ref *Node) bool

func (*Node) Export

func (node *Node) Export(exporter *Exporter) string

func (*Node) Find

func (node *Node) Find(selector string) []*Node

func (*Node) FindOne

func (node *Node) FindOne(selector string) *Node

func (*Node) GetRoot

func (node *Node) GetRoot() *Node

func (*Node) HasChildren

func (node *Node) HasChildren() bool

func (*Node) IndexOf

func (node *Node) IndexOf(ref *Node) int

func (*Node) InnerHTML

func (node *Node) InnerHTML() string

func (*Node) InnerText

func (node *Node) InnerText() string

func (*Node) InnerXML

func (node *Node) InnerXML() string

func (*Node) InsertAfter

func (node *Node) InsertAfter(newNode *Node, refNode *Node)

func (*Node) InsertBefore

func (node *Node) InsertBefore(newNode *Node, refNode *Node)

func (*Node) NameWithPrefix

func (node *Node) NameWithPrefix() string

func (*Node) Remove

func (node *Node) Remove()

func (*Node) RemoveAll

func (node *Node) RemoveAll(list []*Node)

func (*Node) RemoveChild

func (node *Node) RemoveChild(child *Node)

func (*Node) TrimAttrString

func (node *Node) TrimAttrString(name string) string

type NodeType

type NodeType uint
const (
	ElementNode NodeType = iota
	AttributeNode
	TextNode
	CDataSectionNode
	ProcessingInstructionNode
	CommentNode
	DocumentNode
	DocumentTypeNode
	DirectiveNode
)

type SelectType

type SelectType uint
const (
	SelectAll SelectType = iota
	SelectFirst
)

type XNode

type XNode struct {
	*Node
	// contains filtered or unexported fields
}

func NewXpathNode

func NewXpathNode(node *Node) *XNode

func (*XNode) Ancestor

func (it *XNode) Ancestor(sel string)

func (*XNode) AncestorOrSelf

func (it *XNode) AncestorOrSelf(sel string)

func (*XNode) Attribute

func (it *XNode) Attribute(sel string)

func (*XNode) Child

func (it *XNode) Child(sel string)

func (*XNode) Descendant

func (it *XNode) Descendant(sel string)

func (*XNode) DescendantOrSelf

func (it *XNode) DescendantOrSelf(sel string)

func (*XNode) Following

func (it *XNode) Following(sel string)

func (*XNode) Namespace

func (it *XNode) Namespace(sel string)

func (*XNode) Parent

func (it *XNode) Parent()

func (*XNode) Preceding

func (it *XNode) Preceding(sel string)

func (*XNode) PrecedingSibling

func (it *XNode) PrecedingSibling(sel string)

func (*XNode) Root

func (it *XNode) Root()

func (*XNode) Self

func (it *XNode) Self(sel string)

type XNodeHandler

type XNodeHandler func(node *Node) bool

type Xpath

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

func NewXpath

func NewXpath(text string) (*Xpath, error)

func (*Xpath) SelectAll

func (it *Xpath) SelectAll(node *Node) []*Node

func (*Xpath) SelectFirst

func (it *Xpath) SelectFirst(node *Node) *Node

func (*Xpath) SelectLast

func (it *Xpath) SelectLast(node *Node) *Node

Jump to

Keyboard shortcuts

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