Indent XML and check that it parses.
Validation uses the browser’s own XML parser, so what it accepts is exactly what fetch and XMLHttpRequest will accept.