I had a similar issue but this reference link provided the solution spot on.
Quote from the article.
Any characters before the start of the XML content will cause above error.
org.xml.sax.SAXParseException: Content is not allowed in prolog error message.