Clean up Templight xml parser code