A simple code like the following with the attached XML file does not show the errors but struggles with the initial BOM and reports the error:
Content is not allowed in prolog.
Set<String> set = new XmlSchemaValidator().validateSchema(xml);
The UTF-8 BOM is a sequence of bytes at the start of a text stream (0xEF, 0xBB, 0xBF) that allows the reader to more reliably guess a file as being encoded in UTF-8.
A simple code like the following with the attached XML file does not show the errors but struggles with the initial BOM and reports the error:
Note: I had to zip the XML file being able to attach it to the issue. AAS_Template_for_AID.aas 1.xml.zip