Added new constructor that takes an encoding and hopefully circumvents a bug in xerces