Code imported from https://github.com/leethomason/tinyxml2
