Content is not allowed in prolog

This error is generated when anything comes before the XML document type declaration.

In an XML document the first thing before anything else you declare the type like so:

Correct:

XML:
<?xmlversion="1.0"encoding="utf-8"?>

Incorrect:

XML:

helloworld<?xmlversion="1.0"encoding="utf-8"?>

.<?xmlversion="1.0"encoding="utf-8"?>

Note:

The text formatter that I use adds a space between the less than sign and first question mark. That should not be there. In your document do not include the space.

Anything before the first set of characters, "

You can use this XML Validator to check your XML and get detailed error messages. It's best used in Firefox and Chrome. This is version 1.0. The next version checks for the byte order marker.

原文地址:https://www.cnblogs.com/orientsun/p/2609864.html