func (document *XmlDocument) CreateTextNode(data string) (text *TextNode) { dataBytes := GetCString([]byte(data)) dataPtr := unsafe.Pointer(&dataBytes[0]) nodePtr := C.xmlNewText((*C.xmlChar)(dataPtr)) if nodePtr != nil { nodePtr.doc = (*_Ctype_struct__xmlDoc)(document.DocPtr()) text = NewNode(unsafe.Pointer(nodePtr), document).(*TextNode) } return }
func (n *xmlNode) SetNodeValue(value string) { // TODO: Implement this in C if n.NodeType() != AttributeNode { C.xmlNodeSetContent(n.ptr, stringToXmlChar(value)) return } ptr := n.ptr if ptr.children != nil { ptr.last = nil C.xmlFreeNodeList(ptr.children) } ptr.children = C.xmlNewText(stringToXmlChar(value)) ptr.children.parent = ptr ptr.children.doc = ptr.doc ptr.last = ptr.children }
func (d *Document) CreateTextNode(txt string) (*Text, error) { return wrapText(C.xmlNewText(stringToXmlChar(txt))), nil }
// xmlNewText func NewText(content string) *TextNode { ptr := C.CString(content) defer C.free_string(ptr) return makeTextNode(C.xmlNewText(C.to_xmlcharptr(ptr))) }