示例#1
0
文件: help.go 项目: thebrave/gokogiri
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() })
}
示例#2
0
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.")
	}
}
示例#3
0
文件: gosaml.go 项目: wayf-dk/gosaml
// 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}
	}
}
示例#4
0
func CreateEmptyDocument(inEncoding, outEncoding []byte) (doc *HtmlDocument) {
	C.xmlInitParser()
	docPtr := C.htmlNewDoc(nil, nil)
	doc = NewDocument(unsafe.Pointer(docPtr), 0, inEncoding, outEncoding)
	return
}
示例#5
0
func LibxmlInitParser() {
	C.xmlInitParser()
}