예제 #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
파일: xmlsec.go 프로젝트: crewjam/go-xmlsec
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()
}