Fix for issue #32 (XML parsing issues with entities). Original patch from @lesposi.