Refactor check of xml parsing into its own function
Add test for aplication/xhtml+xml header
Move parsing mode check into its own function