Example #1
0
//CreateCommentNode creates a comment node. Comment nodes can
// be children of an element or of the document itself.
//
// The data argument will become the content of the comment.
func (document *XmlDocument) CreateCommentNode(data string) (comment *CommentNode) {
	dataBytes := GetCString([]byte(data))
	dataPtr := unsafe.Pointer(&dataBytes[0])
	nodePtr := C.xmlNewComment((*C.xmlChar)(dataPtr))
	if nodePtr != nil {
		comment = NewNode(unsafe.Pointer(nodePtr), document).(*CommentNode)
	}
	return
}
Example #2
0
func (d *Document) CreateCommentNode(txt string) (*Comment, error) {
	return wrapComment(C.xmlNewComment(stringToXmlChar(txt))), nil
}
Example #3
0
// xmlNewComment
func NewComment(content string) *Node {
	ptr := C.CString(content)
	defer C.free_string(ptr)
	cnode := C.xmlNewComment(C.to_xmlcharptr(ptr))
	return makeNode(cnode)
}