types

package
v0.0.0-...-b65cd51 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 2 Imported by: 101

Documentation

Overview

Package types exist to provide with common types that are used through out in go-libxml2. This package contains mainly interfaces to things that are implemented else. It is in its own package so that any package can refer to these interfaces without introducing circular dependecy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute interface {
	Node
	Value() string
}

Attribute defines the interface for XML attribute

type Document

type Document interface {
	Node
	CreateElement(string) (Element, error)
	CreateElementNS(string, string) (Element, error)
	DocumentElement() (Node, error)
	Dump(bool) string
	Encoding() string
}

Document defines the interface for XML document

type Element

type Element interface {
	Node
	AppendText(string) error
	Attributes() ([]Attribute, error)
	GetAttribute(string) (Attribute, error)
	GetNamespaces() ([]Namespace, error)
	LocalName() string
	NamespaceURI() string
	Prefix() string
	RemoveAttribute(string) error
	SetAttribute(string, string) error
	SetNamespace(string, string, ...bool) error
}

Element defines the interface for XML element

type Namespace

type Namespace interface {
	Node
	Prefix() string
	URI() string
}

Namespace defines the interface for XML namespace

type Node

type Node interface {
	PtrSource

	ParseInContext(string, int) (Node, error)

	AddChild(Node) error
	ChildNodes() (NodeList, error)
	Copy() (Node, error)
	OwnerDocument() (Document, error)
	Find(string) (XPathResult, error)
	FirstChild() (Node, error)
	HasChildNodes() bool
	IsSameNode(Node) bool
	LastChild() (Node, error)
	// Literal is almost the same as String(), except for things like Element
	// and Attribute nodes. String() will return the XML stringification of
	// these, but Literal() will return the "value" associated with them.
	Literal() (string, error)
	LookupNamespacePrefix(string) (string, error)
	LookupNamespaceURI(string) (string, error)
	NextSibling() (Node, error)
	NodeName() string
	NodeType() clib.XMLNodeType
	NodeValue() string
	ParentNode() (Node, error)
	PreviousSibling() (Node, error)
	RemoveChild(Node) error
	SetDocument(d Document) error
	SetNodeName(string)
	SetNodeValue(string)
	String() string
	TextContent() string
	ToString(int, bool) string
	Walk(func(Node) error) error

	MakeMortal()
	MakePersistent()
	AutoFree()
}

Node defines the basic DOM interface

type NodeIter

type NodeIter interface {
	Next() bool
	Node() Node
}

type NodeList

type NodeList []Node

NodeList is a set of Nodes

func (NodeList) First

func (n NodeList) First() Node

First returns the first node in the list, or nil otherwise.

func (NodeList) Literal

func (n NodeList) Literal() (string, error)

Literal returns the string representation of the NodeList (using Literal())

func (NodeList) NodeValue

func (n NodeList) NodeValue() string

NodeValue returns the concatenation of NodeValue within the nodes in NodeList

func (NodeList) String

func (n NodeList) String() string

String returns the string representation of the NodeList

type PtrSource

type PtrSource interface {
	// Pointer returns the underlying C pointer. This is an exported
	// method to allow various internal go-libxml2 packages to interoperate
	// on each other. End users are STRONGLY advised not to touch this
	// method or its return values
	Pointer() uintptr

	// Free releases the underlying resources
	Free()
}

PtrSource defines the interface for things that is backed by a C backend

type XPathExpression

type XPathExpression interface {
	PtrSource
}

XPathExpression defines the interface for XPath expression

type XPathResult

type XPathResult interface {
	Bool() bool
	Free()
	NodeList() NodeList
	NodeIter() NodeIter
	Number() float64
	String() string
	Type() clib.XPathObjectType
}

XPathResult defines the interface for result of calling Find().

Jump to

Keyboard shortcuts

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