func LibxmlInitParser() { if called_clean := atomic.LoadInt32(cleaned); called_clean != 0 { panic("LibxmlCleanUpParser has been called. Please make sure you only " + "call it if no more document parsing will take place.") } once.Do(func() { C.xmlInitParser() }) }
func init() { C.xmlInitParser() if rv := C.xmlSecInit(); rv < 0 { panic("xmlsec failed to initialize") } if rv := C.xmlSecCryptoAppInit(nil); rv < 0 { panic("xmlsec crypto initialization failed.") } if rv := C.xmlSecCryptoInit(); rv < 0 { panic("xmlsec crypto initialization failed.") } }
// init the library func init() { C.xmlInitParser() // initialize a global namespace array - it is not obvious who should free the allocated const C strings after // being used in C.xmlXPathRegisterNs - if we only have one globally shared we don't care ... namespaces = make(map[string]namespaceMap) for i, value := range m { namespaces[i] = namespaceMap{ (*C.xmlChar)(unsafe.Pointer(C.CString(i))), (*C.xmlChar)(unsafe.Pointer(C.CString(value))), } } // from xmlsec idents to golang defs of digest algorithms for _, a := range algos { algos[a.digest] = algo{"", "", a.algo, a.derprefix} algos[a.signature] = algo{"", "", a.algo, a.derprefix} } }
func CreateEmptyDocument(inEncoding, outEncoding []byte) (doc *HtmlDocument) { C.xmlInitParser() docPtr := C.htmlNewDoc(nil, nil) doc = NewDocument(unsafe.Pointer(docPtr), 0, inEncoding, outEncoding) return }
func LibxmlInitParser() { C.xmlInitParser() }