We probably don't want to do any extensive xml validation, but if you post an xml file to jenkins with a blank first line, you get an error with "Unknown directive" in it. The xml header needs to be the very first thing in the posted xml, so either the test should reflect that, or the code should check for that (or trim the xml)