gokogiri icon indicating copy to clipboard operation
gokogiri copied to clipboard

xmlFreeChars error (on Windows)

Open cyphic opened this issue 13 years ago • 3 comments

Hi,

when I got a call like that:

imgnode.Attr("src")

or

imgnode.Attribute("src").Value()

I get the following error:

unexpected fault address 0x137425ff
throw: fault
[signal 0xc0000005 code=0x0 addr=0x137425ff pc=0x137425ff]

goroutine 1 [syscall]:
github.com/moovweb/gokogiri/xml._Cfunc_xmlFreeChars(0x37a570, 0x201319a0)
        C:/Users/sOph/AppData/Local/Temp/go-build750256355/github.com/moovweb/gokogiri/xml/_obj/_cgo_defun.c:106 +0x31
github.com/moovweb/gokogiri/xml.(*XmlNode).Content(0x20132d30, 0x201319a0, 0x66)
        document.go:842 +0x75
github.com/moovweb/gokogiri/xml.(*AttributeNode).Value(0x200e0948, 0x20155dc0, 0x5cf2e4)
        C:/Go/src/pkg/github.com/moovweb/gokogiri/xml/attribute.go:12 +0x2a

similar errors also happen when running the tests in : go test github.com/moovweb/gokogiri/xml

the only way to access the attributes right now, seems to be doing something like:

var attribute string
attribute = string((*imgnode.Attribute("src")).ToBuffer(nil))
attribute = strings.Trim(attribute[strings.Index(attribute, "=")+1:], "\"' ")

cyphic avatar Jul 12 '12 16:07 cyphic

What's your libxml version?

zhigangc avatar Jul 16 '12 17:07 zhigangc

I compiled the source code of libxml2-2.7.8, as gokogiri wouldn't install with the downloadable precompiled libs (something to do with msvc vs. mingw gcc compiler incompatibility according to some search results ...

also, as a windows user, there isn't really support for pkg-config, so I had to to improvise a .pc file from information i could find on how it works ... so its quite probable, i messed some part of it up

so if you or someone else could provide a fully working installation "step by step" for gokogiri for windows users, not just I would be thankful (it took me about 5 hours to get it installed).

cyphic avatar Jul 16 '12 20:07 cyphic

Hey @cyphic, someone recently made steps on getting gokogiri work for windows:

https://github.com/moovweb/gokogiri/issues/49

Does that help out at all?

mdayaram avatar Oct 15 '13 01:10 mdayaram