Fixed error handling for libxml