예제 #1
0
파일: gosaml.go 프로젝트: wayf-dk/gosaml
// Q1 Utility function to get the content of the nodes from a xpath query
// as a slice of strings
func (xp *Xp) QueryMulti(context *C.xmlNode, path string) (res []string) {
	nodes := xp.Query(context, path)

	for _, node := range nodes {
		content := C.xmlNodeGetContent(node)
		res = append(res, C.GoString((*C.char)(unsafe.Pointer(content))))
		C.free(unsafe.Pointer(content))
	}
	return
}
예제 #2
0
func (xmlNode *XmlNode) Content() string {
	contentPtr := C.xmlNodeGetContent(xmlNode.Ptr)
	charPtr := (*C.char)(unsafe.Pointer(contentPtr))
	defer C.xmlFreeChars(charPtr)
	return C.GoString(charPtr)
}
예제 #3
0
// xmlNodeGetContent
func (node *Node) GetContent() string {
	content := C.to_charptr(C.xmlNodeGetContent(node.Ptr))
	defer C.free_string(content)
	return C.GoString(content)
}
예제 #4
0
파일: gosaml.go 프로젝트: wayf-dk/gosaml
// NodeGetContent gets the content of a node (or attribute)
func (xp *Xp) NodeGetContent(node *C.xmlNode) (res string) {
	content := C.xmlNodeGetContent(node)
	res = C.GoString((*C.char)(unsafe.Pointer(content)))
	C.free(unsafe.Pointer(content))
	return
}