/usr/share/gocode/src/github.com/ChrisTrenkamp/goxpath/tree/xmlstruct/xmlnode.go is in golang-github-christrenkamp-goxpath-dev 1.0~alpha3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | package xmlstruct
import (
"encoding/xml"
"fmt"
"reflect"
"github.com/ChrisTrenkamp/goxpath/tree"
)
type XMLNode struct {
Val reflect.Value
pos int
prnt tree.Elem
nodeType tree.NodeType
prntTag string
}
func (x *XMLNode) ResValue() string {
if x.Val.Kind() == reflect.Ptr {
return fmt.Sprintf("%v", x.Val.Elem().Interface())
}
return fmt.Sprintf("%v", x.Val.Interface())
}
func (x *XMLNode) Pos() int {
return x.pos
}
func (x *XMLNode) GetToken() xml.Token {
switch x.nodeType {
case tree.NtAttr:
return xml.Attr{Name: getTagInfo(x.prntTag).name, Value: x.ResValue()}
case tree.NtChd:
return xml.CharData(x.ResValue())
}
//case tree.NtComm:
return xml.Comment(x.ResValue())
}
func (x *XMLNode) GetParent() tree.Elem {
return x.prnt
}
func (x *XMLNode) GetNodeType() tree.NodeType {
return x.nodeType
}
|