Wow, after decomposing the differences between your and my code... I found that I get a segfault when I open the XML file with '<:encoding(utf8)' and it runs normally when I open it with '<'.
I don't have a clue what's going on here and I think it's pretty sick :-) but I am more grateful than I can say.
Thank you friend.