Documentation
¶
Index ¶
- func FindNodeByPos(n xmlnode.Node, pos int) xmlnode.Node
- func MustParseXML(r io.Reader, op ...ParseSettings) xmlnode.Node
- func ParseXML(r io.Reader, op ...ParseSettings) (xmlnode.Node, error)
- type Adapter
- func (a Adapter) ForEachAttr(in interface{}, f func(xml.Attr, interface{}))
- func (a Adapter) ForEachChild(in interface{}, g func(interface{}))
- func (a Adapter) GetAttrTok(in interface{}) xml.Attr
- func (a Adapter) GetCharDataTok(in interface{}) xml.CharData
- func (a Adapter) GetCommentTok(in interface{}) xml.Comment
- func (a Adapter) GetElemTok(in interface{}) xml.StartElement
- func (a Adapter) GetElementName(in interface{}) xml.Name
- func (a Adapter) GetNamespaceTok(in interface{}) xml.Attr
- func (a Adapter) GetNamespaces(in interface{}) []interface{}
- func (a Adapter) GetNodeType(in interface{}) tree.NodeType
- func (a Adapter) GetParent(in interface{}) interface{}
- func (a Adapter) GetProcInstTok(in interface{}) xml.ProcInst
- func (a Adapter) NewNodeSet(nodes []interface{}) tree.NodeSet
- func (a Adapter) NodePos(in interface{}) int
- func (a Adapter) StringValue(in interface{}) string
- type DirectiveParser
- type ParseOptions
- type ParseSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindNodeByPos ¶
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.
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter specific to the xmltree structure
func (Adapter) ForEachAttr ¶
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 ¶
GetAttrTok returns an attribute token for the input. It must be an attribute.
func (Adapter) GetCharDataTok ¶
GetCharDataTok returns chardata
func (Adapter) GetCommentTok ¶
GetCommentTok returns comment
func (Adapter) GetElemTok ¶
func (a Adapter) GetElemTok(in interface{}) xml.StartElement
GetElemTok returns an element token
func (Adapter) GetElementName ¶
GetElementName returns the element name
func (Adapter) GetNamespaceTok ¶
GetNamespaceTok returns a namespace attribute
func (Adapter) GetNamespaces ¶
func (a Adapter) GetNamespaces(in interface{}) []interface{}
GetNamespaces returns namespaces
func (Adapter) GetNodeType ¶
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 ¶
GetProcInstTok returns the proc inst token
func (Adapter) NewNodeSet ¶
NewNodeSet returns a new nodeset with the given nodes
func (Adapter) StringValue ¶
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.