xmltree

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindNodeByPos

func FindNodeByPos(n xmlnode.Node, pos int) xmlnode.Node

FindNodeByPos finds a node from the given position. Returns nil if the node is not found.

func MustParseXML

func MustParseXML(r io.Reader, op ...ParseSettings) xmlnode.Node

MustParseXML is like ParseXML, but panics instead of returning an error.

func ParseXML

func ParseXML(r io.Reader, op ...ParseSettings) (xmlnode.Node, error)

ParseXML creates an XMLTree structure from an io.Reader.

Types

type Adapter

type Adapter struct{}

Adapter specific to the xmltree structure

func (Adapter) ForEachAttr

func (a Adapter) ForEachAttr(in interface{}, f func(xml.Attr, interface{}))

ForEachAttr iterates all attributes of the element

func (Adapter) ForEachChild

func (a Adapter) ForEachChild(in interface{}, g func(interface{}))

ForEachChild iterates all immediate children of the element

func (Adapter) GetAttrTok

func (a Adapter) GetAttrTok(in interface{}) xml.Attr

GetAttrTok returns an attribute token for the input. It must be an attribute.

func (Adapter) GetCharDataTok

func (a Adapter) GetCharDataTok(in interface{}) xml.CharData

GetCharDataTok returns chardata

func (Adapter) GetCommentTok

func (a Adapter) GetCommentTok(in interface{}) xml.Comment

GetCommentTok returns comment

func (Adapter) GetElemTok

func (a Adapter) GetElemTok(in interface{}) xml.StartElement

GetElemTok returns an element token

func (Adapter) GetElementName

func (a Adapter) GetElementName(in interface{}) xml.Name

GetElementName returns the element name

func (Adapter) GetNamespaceTok

func (a Adapter) GetNamespaceTok(in interface{}) xml.Attr

GetNamespaceTok returns a namespace attribute

func (Adapter) GetNamespaces

func (a Adapter) GetNamespaces(in interface{}) []interface{}

GetNamespaces returns namespaces

func (Adapter) GetNodeType

func (a Adapter) GetNodeType(in interface{}) tree.NodeType

GetNodeType returns the node type from the xmlnode

func (Adapter) GetParent

func (a Adapter) GetParent(in interface{}) interface{}

GetParent returns the parent of the node

func (Adapter) GetProcInstTok

func (a Adapter) GetProcInstTok(in interface{}) xml.ProcInst

GetProcInstTok returns the proc inst token

func (Adapter) NewNodeSet

func (a Adapter) NewNodeSet(nodes []interface{}) tree.NodeSet

NewNodeSet returns a new nodeset with the given nodes

func (Adapter) NodePos

func (a Adapter) NodePos(in interface{}) int

NodePos returns the node position. This must be a unique integer

func (Adapter) StringValue

func (a Adapter) StringValue(in interface{}) string

StringValue returns string value of the node

type DirectiveParser

type DirectiveParser interface {
	xmlbuilder.XMLBuilder
	Directive(xml.Directive, *xml.Decoder)
}

DirectiveParser is an optional interface extended from XMLBuilder that handles XML directives.

type ParseOptions

type ParseOptions struct {
	Strict  bool
	XMLRoot func() xmlbuilder.XMLBuilder
}

ParseOptions is a set of methods and function pointers that alter the way the XML decoder works and the Node types that are created. Options that are not set will default to what is set in internal/defoverride.go

type ParseSettings

type ParseSettings func(s *ParseOptions)

ParseSettings is a function for setting the ParseOptions you want when parsing an XML tree.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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