コード例 #1
0
ファイル: document.go プロジェクト: jbowtie/gokogiri
//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
}
コード例 #2
0
ファイル: node.go プロジェクト: grmartin/go-libxml2
func (d *Document) CreateCommentNode(txt string) (*Comment, error) {
	return wrapComment(C.xmlNewComment(stringToXmlChar(txt))), nil
}
コード例 #3
0
ファイル: xml_tree.go プロジェクト: paulcadman/golibxml
// 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)
}