Documentation ¶
Index ¶
Constants ¶
View Source
const ( Root = iota Tag Text Comment ProcInst Directive )
Possible return values of OutType().
Variables ¶
View Source
var NodeType = reflect.TypeOf([]Node{}).Elem()
Functions ¶
func WriteNodeAsString ¶
Types ¶
type Decoder ¶
type Decoder struct{}
func (*Decoder) Materialize ¶
func (d *Decoder) Materialize() func(input interface{}) interface{}
type Encoder ¶
type Encoder struct{}
func (*Encoder) Materialize ¶
func (d *Encoder) Materialize() func(input interface{}) interface{}
type Node ¶
type Node interface { // Parent of the current node. Nil for root node. Parent() Node // Tag name of tag nodes of the form <tagname>...</tagname>. Empty for // other node types. TagName() string // Attributes of tag nodes. Nil for other node types. Attr() []*encXml.Attr // Child nodes of root and tag nodes. Nil for other node types. Children() []Node // Text data of text nodes. Empty for other node types. Text() string // Comment data of comments of the form <!--comment-->. Does not include the // <!-- and --> markers. Empty for other node types. Comment() string // Target of processing instructions of the form <?target inst?>. // Empty for other node types. Target() string // Instruction of processing instructions of the form <?target inst?>. // Empty for other node types. Inst() string // Directive of the form <!directive>. Does not include the <! and > // markers. Empty for other node types. Directive() string // OutType of this node. Returns one of: Root, Tag, Text, Comment, ProcInst // or Directive. Type() int }
Represents a single XML node. Can be one of: Root, Tag, Text, Comment, ProcInst or Directive.
String methods return empty strings when called on a non-relevant node. For example, calling TagName() on a Text node or vise versa. The Children() method returns nil for non Tag or Root nodes. The Attr() method returns nil for non Tag nodes.
Parent node is nil only in Root.
func ReadNodeFromString ¶
Click to show internal directories.
Click to hide internal directories.