Example #1
0
// xmlNewNs
func (node *Node) NewNs(href string, prefix string) *Namespace {
	ptrh := C.CString(href)
	defer C.free_string(ptrh)
	ptrp := C.CString(prefix)
	defer C.free_string(ptrp)
	return makeNamespace(C.xmlNewNs(node.Ptr, C.to_xmlcharptr(ptrh), C.to_xmlcharptr(ptrp)))
}
Example #2
0
// xmlNewNode
func NewNode(ns *Namespace, name string) *Node {
	ptr := C.CString(name)
	defer C.free_string(ptr)
	if ns != nil {
		return makeNode(C.xmlNewNode(ns.Ptr, C.to_xmlcharptr(ptr)))
	}
	return makeNode(C.xmlNewNode(nil, C.to_xmlcharptr(ptr)))
}
Example #3
0
// xmlSetProp
func (node *Node) SetAttribute(name string, value string) *Attribute {
	ptrn := C.CString(name)
	defer C.free_string(ptrn)
	ptrv := C.CString(value)
	defer C.free_string(ptrv)
	cattr := C.xmlSetProp(node.Ptr, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrv))
	return makeAttribute(cattr)
}
Example #4
0
// xmlParseDTD
func ParseDTD(ExternalID string, SystemID string) *Dtd {
	ptre := C.CString(ExternalID)
	defer C.free_string(ptre)
	ptrs := C.CString(SystemID)
	defer C.free_string(ptrs)
	cdtd := C.xmlParseDTD(C.to_xmlcharptr(ptre), C.to_xmlcharptr(ptrs))
	return makeDtd(cdtd)
}
Example #5
0
// xmlNewDocProp
func (doc *Document) NewProp(name string, value string) *Attribute {
	ptrn := C.CString(name)
	defer C.free_string(ptrn)
	ptrv := C.CString(value)
	defer C.free_string(ptrv)
	cattr := C.xmlNewDocProp(doc.Ptr, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrv))
	return makeAttribute(cattr)
}
Example #6
0
// htmlNewDoc
func NewHTMLDoc(uri string, external_id string) *HTMLDocument {
	ptru := C.CString(uri)
	defer C.free_string(ptru)
	ptre := C.CString(external_id)
	defer C.free_string(ptre)
	doc := C.htmlNewDoc(C.to_xmlcharptr(ptru), C.to_xmlcharptr(ptre))
	return makeHTMLDoc(doc)
}
Example #7
0
// xmlNewTextChild
func (node *Node) NewTextChild(ns *Namespace, name string, content string) *TextNode {
	ptrn := C.CString(name)
	defer C.free_string(ptrn)
	ptrc := C.CString(content)
	defer C.free_string(ptrc)
	if ns == nil {
		return makeTextNode(C.xmlNewTextChild(node.Ptr, nil, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrc)))
	}
	return makeTextNode(C.xmlNewTextChild(node.Ptr, ns.Ptr, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrc)))
}
Example #8
0
// xmlNewDtd
func (doc *Document) NewDtd(name string, ExternalID string, SystemID string) *Dtd {
	ptrn := C.CString(name)
	defer C.free_string(ptrn)
	ptre := C.CString(ExternalID)
	defer C.free_string(ptre)
	ptrs := C.CString(SystemID)
	defer C.free_string(ptrs)
	cdtd := C.xmlNewDtd(doc.Ptr, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptre), C.to_xmlcharptr(ptrs))
	return makeDtd(cdtd)
}
Example #9
0
// xmlNewDocRawNode
func (doc *Document) NewRawNode(ns *Namespace, name string, content string) *Node {
	ptrn := C.CString(name)
	defer C.free_string(ptrn)
	ptrc := C.CString(content)
	defer C.free_string(ptrc)
	if ns != nil {
		return makeNode(C.xmlNewDocRawNode(doc.Ptr, ns.Ptr, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrc)))
	}
	return makeNode(C.xmlNewDocRawNode(doc.Ptr, nil, C.to_xmlcharptr(ptrn), C.to_xmlcharptr(ptrc)))
}
Example #10
0
// htmlParseDoc
func ParseHTMLDoc(cur string, encoding string) *HTMLDocument {
	ptrc := C.CString(cur)
	defer C.free_string(ptrc)
	ptre := C.CString(encoding)
	defer C.free_string(ptre)
	doc := C.htmlParseDoc(C.to_xmlcharptr(ptrc), ptre)
	return makeHTMLDoc(doc)
}
Example #11
0
// htmlReadDoc
func ReadHTMLDoc(cur string, url string, encoding string, options HTMLParserOption) *HTMLDocument {
	ptrc := C.CString(cur)
	defer C.free_string(ptrc)
	ptru := C.CString(url)
	defer C.free_string(ptru)
	ptre := C.CString(encoding)
	defer C.free_string(ptre)
	doc := C.htmlReadDoc(C.to_xmlcharptr(ptrc), ptru, ptre, C.int(options))
	return makeHTMLDoc(doc)
}
Example #12
0
// xmlCtxtReadDoc
func (p *Parser) ReadDoc(input string, url string, encoding string, options ParserOption) *Document {
	ptri := C.CString(input)
	defer C.free_string(ptri)
	ptru := C.CString(url)
	defer C.free_string(ptru)
	ptre := C.CString(encoding)
	defer C.free_string(ptre)
	doc := C.xmlCtxtReadDoc(p.Ptr, C.to_xmlcharptr(ptri), ptru, ptre, C.int(options))
	return makeDoc(doc)
}
Example #13
0
// xmlTextReaderGetAttribute
func (r *TextReader) GetAttribute(name string) *string {
	cname := C.CString(name)
	defer C.free_string(cname)

	cvalue := C.xmlTextReaderGetAttribute(r.Ptr, C.to_xmlcharptr(cname))

	if cvalue != nil {
		value := C.GoString(C.to_charptr(cvalue))
		return &value
	}
	return nil
}
Example #14
0
// xmlNodeSetName
func (node *Node) SetName(name string) {
	ptr := C.CString(name)
	defer C.free_string(ptr)
	C.xmlNodeSetName(node.Ptr, C.to_xmlcharptr(ptr))
}
Example #15
0
func stringToXmlChar(s string) *C.xmlChar {
	return C.to_xmlcharptr(C.CString(s))
}
Example #16
0
// xmlValidateQName
func ValidateQName(value string, space int) int {
	ptr := C.CString(value)
	defer C.free_string(ptr)
	return int(C.xmlValidateQName(C.to_xmlcharptr(ptr), C.int(space)))
}
Example #17
0
// xmlUnsetProp
func (node *Node) UnsetProp(name string) int {
	ptr := C.CString(name)
	defer C.free_string(ptr)
	cint := C.xmlUnsetProp(node.Ptr, C.to_xmlcharptr(ptr))
	return int(cint)
}
Example #18
0
// xmlTextConcat
func (node *TextNode) Concat(content string) int {
	ptr := C.CString(content)
	defer C.free_string(ptr)
	return int(C.xmlTextConcat(node.Ptr, C.to_xmlcharptr(ptr), C.int(len(content))))
}
Example #19
0
// xmlNewDocText
func (doc *Document) NewText(content string) *TextNode {
	ptr := C.CString(content)
	defer C.free_string(ptr)
	return makeTextNode(C.xmlNewDocText(doc.Ptr, C.to_xmlcharptr(ptr)))
}
Example #20
0
// xmlRecoverDoc
func RecoverDoc(cur string) *Document {
	ptr := C.CString(cur)
	defer C.free_string(ptr)
	doc := C.xmlRecoverDoc(C.to_xmlcharptr(ptr))
	return makeDoc(doc)
}
Example #21
0
// xmlXPathEvalExpression
func (ctx *XPathContext) EvalExpression(str string) *XPathObject {
	ptr := C.CString(str)
	defer C.free_string(ptr)
	return makeXpathObj(C.xmlXPathEvalExpression(C.to_xmlcharptr(ptr), ctx.Ptr))
}
Example #22
0
// xmlNewText
func NewText(content string) *TextNode {
	ptr := C.CString(content)
	defer C.free_string(ptr)
	return makeTextNode(C.xmlNewText(C.to_xmlcharptr(ptr)))
}
Example #23
0
// htmlAutoCloseTag
func (doc *HTMLDocument) AutoCloseTag(name string, node *Node) bool {
	ptr := C.CString(name)
	defer C.free_string(ptr)
	return int(C.htmlAutoCloseTag(doc.Document.Ptr, C.to_xmlcharptr(ptr), node.Ptr)) == 1
}
Example #24
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)
}
Example #25
0
// xmlCreateDocParserCtxt
func CreateDocParser(cur string) *Parser {
	ptr := C.CString(cur)
	defer C.free_string(ptr)
	cparser := C.xmlCreateDocParserCtxt(C.to_xmlcharptr(ptr))
	return makeParser(cparser)
}
Example #26
0
// htmlTagLookup
func TagLookup(tag string) *ElemDesc {
	ptr := C.CString(tag)
	defer C.free_string(ptr)
	cdesc := C.htmlTagLookup(C.to_xmlcharptr(ptr))
	return makeElemDesc(cdesc)
}
Example #27
0
// xmlXPathCtxtCompile
func (ctx *XPathContext) Compile(str string) *XPath {
	ptr := C.CString(str)
	defer C.free_string(ptr)
	return makeXpath(C.xmlXPathCtxtCompile(ctx.Ptr, C.to_xmlcharptr(ptr)))
}
Example #28
0
// xmlNewDoc
func NewDoc(version string) *Document {
	ptr := C.CString(version)
	defer C.free_string(ptr)
	cdoc := C.xmlNewDoc(C.to_xmlcharptr(ptr))
	return makeDoc(cdoc)
}
Example #29
0
// xmlXPathCompile
func CompileXPath(str string) *XPath {
	ptr := C.CString(str)
	defer C.free_string(ptr)
	return makeXpath(C.xmlXPathCompile(C.to_xmlcharptr(ptr)))
}
Example #30
0
// xmlNodeSetContent
func (node *Node) SetContent(content string) {
	ptr := C.CString(content)
	defer C.free_string(ptr)
	C.xmlNodeSetContent(node.Ptr, C.to_xmlcharptr(ptr))
}