func (d *Document) SetVersion(e string) { if d.ptr.version != nil { C.MY_xmlFree(unsafe.Pointer(d.ptr.version)) } d.ptr.version = C.xmlStrdup(stringToXmlChar(e)) }
func NewDocument(version, encoding string) *Document { doc := C.xmlNewDoc(stringToXmlChar(version)) if encoding != "" { doc.encoding = C.xmlStrdup(stringToXmlChar(encoding)) } return wrapDocument(doc) }
func (d *Document) SetEncoding(e string) { if d.ptr.encoding != nil { C.MY_xmlFree(unsafe.Pointer(d.ptr.encoding)) } d.ptr.encoding = C.xmlStrdup(stringToXmlChar(e)) }
func nodeValue(n Node) string { switch n.NodeType() { case AttributeNode, TextNode, CommentNode, CDataSectionNode, PiNode, EntityRefNode: return xmlCharToString(C.xmlXPathCastNodeToString((*C.xmlNode)(n.pointer()))) case EntityDecl: np := (*C.xmlNode)(n.pointer()) if np.content != nil { return xmlCharToString(C.xmlStrdup(np.content)) } panic("unimplmented") } return "" }
func (d *Document) URI() string { return xmlCharToString(C.xmlStrdup(d.ptr.URL)) }