Exemplo n.º 1
0
func (document *XmlDocument) CreateCDataNode(data string) (cdata *CDataNode) {
	dataLen := len(data)
	dataBytes := GetCString([]byte(data))
	dataPtr := unsafe.Pointer(&dataBytes[0])
	nodePtr := C.xmlNewCDataBlock(document.Ptr, (*C.xmlChar)(dataPtr), C.int(dataLen))
	if nodePtr != nil {
		cdata = NewNode(unsafe.Pointer(nodePtr), document).(*CDataNode)
	}
	return
}
Exemplo n.º 2
0
func (d *Document) CreateCDataSection(txt string) (*CDataSection, error) {
	return wrapCDataSection(C.xmlNewCDataBlock(d.ptr, stringToXmlChar(txt), C.int(len(txt)))), nil
}