Update various sections of the code to work without LXML installed.

This is backwards compatible