Documentation ¶
Index ¶
- Constants
- func GetAttrValOrEmpty(n Elem, local, space string) string
- func GetAttribute(n Elem, local, space string) (xml.Attr, bool)
- func GetAttributeVal(n Elem, local, space string) (string, bool)
- type Bool
- type Ctx
- type Elem
- type Fn
- type IsBool
- type IsNum
- type LastArgOpt
- type NS
- type NSBuilder
- type NSElem
- type Node
- type NodePos
- type NodeSet
- type NodeType
- type Num
- type Result
- type String
- type Wrap
Constants ¶
const ( True = "true" False = "false" )
Boolean strings
const XMLSpace = "http://www.w3.org/XML/1998/namespace"
XMLSpace is the W3C XML namespace
Variables ¶
This section is empty.
Functions ¶
func GetAttrValOrEmpty ¶
GetAttrValOrEmpty is like GetAttributeVal, except it returns an empty string if the attribute is not found instead of false.
func GetAttribute ¶
GetAttribute is a convenience function for getting the specified attribute from an element. false is returned if the attribute is not found.
Types ¶
type Elem ¶
type Elem interface { Node //GetChildren returns the elements children. GetChildren() []Node //GetAttrs returns the attributes of the element GetAttrs() []Node }
Elem is a XPath result that is an element node
type IsBool ¶
type IsBool interface {
Bool() Bool
}
IsBool is used for the XPath boolean function. It turns the data type to a bool.
type IsNum ¶
type IsNum interface {
Num() Num
}
IsNum is used for the XPath number function. It turns the data type to a number.
type LastArgOpt ¶
type LastArgOpt int
LastArgOpt sets whether the last argument in a function is optional, variadic, or neither
const ( None LastArgOpt = iota Optional Variadic )
LastArgOpt options
type NS ¶
NS is a namespace node.
type Node ¶
type Node interface { //ResValue prints the node's string value ResValue() string //Pos returns the node's position in the document order Pos() int //GetToken returns the xml.Token representation of the node GetToken() xml.Token //GetParent returns the parent node, which will always be an XML element GetParent() Elem //GetNodeType returns the node's type GetNodeType() NodeType }
Node is a XPath result that is a node except elements
func FindNodeByPos ¶
FindNodeByPos finds a node from the given position. Returns nil if the node is not found.
type NodeSet ¶
type NodeSet []Node
NodeSet is a node-set XPath type
type NodeType ¶
type NodeType int
NodeType is a safer way to determine a node's type than type assertions.
These are all the possible node types
func (NodeType) GetNodeType ¶
GetNodeType returns the node's type.
type Num ¶
type Num float64
Num is a number XPath type
func GetNodeNum ¶
GetNodeNum converts the node to a string-value and to a number
type Wrap ¶
type Wrap struct { Fn Fn //NArgs represents the number of arguments to the XPath function. -1 represents a single optional argument NArgs int LastArgOpt LastArgOpt }
Wrap interfaces XPath function calls with Go