Replaces tinyxml with tinyxml2.

fixes #491

this was original submitted by @Smilex #575

I've fixed some issues left and tidied up the commits.