org.xml.sax.SAXParseException: Content is not allowed in prolog

前端 未结 30 2169
别那么骄傲
别那么骄傲 2020-11-22 02:54

I have a Java based web service client connected to Java web service (implemented on the Axis1 framework).

I am getting following exception in my log file:

30条回答
  •  天涯浪人
    2020-11-22 03:27

    I had the same problem (and solved it) while trying to parse an XML document with freemarker.

    I had no spaces before the header of XML file.

    The problem occurs when and only when the file encoding and the XML encoding attribute are different. (ex: UTF-8 file with UTF-16 attribute in header).

    So I had two ways of solving the problem:

    1. changing the encoding of the file itself
    2. changing the header UTF-16 to UTF-8

提交回复
热议问题