The problem was a bug in PHP and the libxml2 library.
I first tried the fix that can be loaded as a plugin but it didn’t work.
My server host upgraded to libxml2 2.7.3 and PHP 5.2.9 and the problem was solved!
More info about the problem here:
https://www.twine.com/item/122dz6xmb-p/conclusion-of-libxml2-issues-use-php-5-2-9-libxml2-2-7-3