xmlele

package
v0.0.0-...-c3cacf9 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Root

func Root() xmlbuilder.XMLBuilder

Root is the default root node builder for xmltree.ParseXML

Types

type NS

type NS struct {
	xml.Attr
	Parent   xmlnode.Elem
	Position int
	tree.NodeType
}

NS is a namespace node.

func BuildNS

func BuildNS(t xmlnode.Elem) (ret []NS)

BuildNS resolves all the namespace nodes of the element and returns them

func (NS) GetNodeType

func (ns NS) GetNodeType() tree.NodeType

GetNodeType returns the node type

func (NS) GetParent

func (ns NS) GetParent() xmlnode.Elem

GetParent returns the parent node of the namespace.

func (NS) GetToken

func (ns NS) GetToken() xml.Token

GetToken returns the xml.Token representation of the namespace.

func (NS) Pos

func (ns NS) Pos() int

Pos returns the node position

func (NS) ResValue

func (ns NS) ResValue() string

ResValue returns the string value of the namespace

type NSBuilder

type NSBuilder struct {
	NS map[xml.Name]string
}

NSBuilder is a helper-struct for satisfying the NSElem interface

func (NSBuilder) GetNS

func (ns NSBuilder) GetNS() map[xml.Name]string

GetNS returns the namespaces found on the current element. It should not be confused with BuildNS, which actually resolves the namespace nodes.

type XMLEle

type XMLEle struct {
	xml.StartElement
	NSBuilder
	Attrs    []xmlnode.Node
	Children []xmlnode.Node
	Parent   xmlnode.Elem
	tree.NodeType
	Position int
}

XMLEle is an implementation of XPRes for XML elements

func (*XMLEle) CreateNode

func (x *XMLEle) CreateNode(opts *xmlbuilder.BuilderOpts) xmlbuilder.XMLBuilder

CreateNode is an implementation of xmlbuilder.XMLBuilder. It appends the node specified in opts and returns the child if it is an element. Otherwise, it returns x.

func (*XMLEle) EndElem

func (x *XMLEle) EndElem() xmlbuilder.XMLBuilder

EndElem is an implementation of xmlbuilder.XMLBuilder. It returns x's parent.

func (*XMLEle) GetAttrs

func (x *XMLEle) GetAttrs() []xmlnode.Node

GetAttrs returns all attributes of the element

func (*XMLEle) GetChildren

func (x *XMLEle) GetChildren() []xmlnode.Node

GetChildren returns all child nodes of the element

func (XMLEle) GetNodeType

func (x XMLEle) GetNodeType() tree.NodeType

GetNodeType returns the node type

func (*XMLEle) GetParent

func (x *XMLEle) GetParent() xmlnode.Elem

GetParent returns the parent node, or itself if it's the root

func (*XMLEle) GetToken

func (x *XMLEle) GetToken() xml.Token

GetToken returns the xml.Token representation of the node

func (*XMLEle) Pos

func (x *XMLEle) Pos() int

Pos returns the node position

func (*XMLEle) ResValue

func (x *XMLEle) ResValue() string

ResValue returns the string value of the element and children

Jump to

Keyboard shortcuts

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