I am having trouble parsing an XML file into a JDOM Document instance using the SAXBuilder.
It throws the following exception:
[Fatal Error] :1:1: Content is not allowed in prolog.
I have found and read all those threads on Stack Exchange and on other places in the Internet and tried various things to debug the error.
I have end up with the following code snippet, which throws as well.
String template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<server></server>";
InputStream in = new StringBufferInputStream(template);
return saxBuilder.build(in);
What's wrong with it?
I am ashamed to admit that but it turned out that the error wasn't produced by the snippet I have shown here but rather at a later point where I was comparing the parsed XML against another one using the XMLUnit library.
The think that made me believe that the error was in the presented lines was the content of the error message.
I believe it would be appropriate to close (and delete, if that's possible) this question as it does not mean any value.