Remove xmllint debugging code

Per #477.
Only clean up those XML elements that exist

Towards #477.