Improve xml support

another PR improving support for XML formats.