func (n *XmlNode) Text() string { if !n.IsText() { return "" } return xmlCharToString(C.xmlNodeListGetString(nil, n.Ptr, 0)) }
func addIDAttr(node *C.xmlNode, attrName, nodeName, nsHref string) { // process children first because it does not matter much but does simplify code cur := C.xmlSecGetNextElementNode(node.children) for { if cur == nil { break } addIDAttr(cur, attrName, nodeName, nsHref) cur = C.xmlSecGetNextElementNode(cur.next) } if C.GoString((*C.char)(unsafe.Pointer(node.name))) != nodeName { return } if nsHref != "" && node.ns != nil && C.GoString((*C.char)(unsafe.Pointer(node.ns.href))) != nsHref { return } // the attribute with name equal to attrName should exist for attr := node.properties; attr != nil; attr = attr.next { if C.GoString((*C.char)(unsafe.Pointer(attr.name))) == attrName { id := C.xmlNodeListGetString(node.doc, attr.children, 1) if id == nil { continue } C.xmlAddID(nil, node.doc, id, attr) } } return }
// xmlNodeListGetString func (node *Node) ListGetString(inLine bool) string { ptr := node.Ptr docptr := C.xmlDocPtr((*C.xmlDoc)(ptr.doc)) cInLine := C.int(0) if inLine { cInLine = C.int(1) } str := C.to_charptr(C.xmlNodeListGetString(docptr, ptr, cInLine)) defer C.free_string(str) return C.GoString(str) }