libxml2 is very commonly available on Linux distros and has also been ported (and is widely available) on Mac OS X and Windows. Therefore simply require libxml2, and remove a lot of conditional code.