Content is not allowed in prolog ошибка xml

I’ve been beating my head against this absolutely infuriating bug for the last 48 hours, so I thought I’d finally throw in the towel and try asking here before I throw my laptop out the window.

I’m trying to parse the response XML from a call I made to AWS SimpleDB. The response is coming back on the wire just fine; for example, it may look like:

<?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
    <ListDomainsResult>
        <DomainName>Audio</DomainName>
        <DomainName>Course</DomainName>
        <DomainName>DocumentContents</DomainName>
        <DomainName>LectureSet</DomainName>
        <DomainName>MetaData</DomainName>
        <DomainName>Professors</DomainName>
        <DomainName>Tag</DomainName>
    </ListDomainsResult>
    <ResponseMetadata>
        <RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId>
        <BoxUsage>0.0000071759</BoxUsage>
    </ResponseMetadata>
</ListDomainsResponse>

I pass in this XML to a parser with

XMLEventReader eventReader = xmlInputFactory.createXMLEventReader(response.getContent());

and call eventReader.nextEvent(); a bunch of times to get the data I want.

Here’s the bizarre part — it works great inside the local server. The response comes in, I parse it, everyone’s happy. The problem is that when I deploy the code to Google App Engine, the outgoing request still works, and the response XML seems 100% identical and correct to me, but the response fails to parse with the following exception:

com.amazonaws.http.HttpClient handleResponse: Unable to unmarshall response (ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.): <?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/"><ListDomainsResult><DomainName>Audio</DomainName><DomainName>Course</DomainName><DomainName>DocumentContents</DomainName><DomainName>LectureSet</DomainName><DomainName>MetaData</DomainName><DomainName>Professors</DomainName><DomainName>Tag</DomainName></ListDomainsResult><ResponseMetadata><RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
    at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(Unknown Source)
    at com.amazonaws.transform.StaxUnmarshallerContext.nextEvent(StaxUnmarshallerContext.java:153)
    ... (rest of lines omitted)

I have double, triple, quadruple checked this XML for ‘invisible characters’ or non-UTF8 encoded characters, etc. I looked at it byte-by-byte in an array for byte-order-marks or something of that nature. Nothing; it passes every validation test I could throw at it. Even stranger, it happens if I use a Saxon-based parser as well — but ONLY on GAE, it always works fine in my local environment.

It makes it very hard to trace the code for problems when I can only run the debugger on an environment that works perfectly (I haven’t found any good way to remotely debug on GAE). Nevertheless, using the primitive means I have, I’ve tried a million approaches including:

  • XML with and without the prolog
  • With and without newlines
  • With and without the «encoding=» attribute in the prolog
  • Both newline styles
  • With and without the chunking information present in the HTTP stream

And I’ve tried most of these in multiple combinations where it made sense they would interact — nothing! I’m at my wit’s end. Has anyone seen an issue like this before that can hopefully shed some light on it?

Thanks!

Table of Contents

  • Sax Error Due to Invalid Text Before XML Declaration
  • Byte Order Mark (BOM) At the Beginning of the XML File
  • Passing a Non Existent File to Parser
  • Different Encoding Formats Causing the Parser Error
  • Conclusion

This article discusses the SAX Error – Content is not allowed in prolog.

The SAX parser is the XML parsing API that you can use to process the XML files. However, while using the SAX parser, you may encounter SAX error – content is not allowed in prolog.

Sax Error Due to Invalid Text Before XML Declaration

The XML files are structured using tags. Therefore, each XML file follows specified syntax.

If you place an unknown or invalid character before the XML declaration, you will get the aforementioned error while trying to parse the file using SAX error.

Let us see an example using the following XML file.

!<?xml version=«1.0» encoding=«utf-8»?>

<person>

    <name> Mohtashim Nawaz </name>

    <age> 24 </age>

    <prof> Software Engineer </prof>

</person>

The code to parse the file is given below.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

package java2blog;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import javax.xml.parsers.SAXParser;

import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;

import org.xml.sax.helpers.DefaultHandler;

public class XmlParser

{

    public static void main(String[] args)

    {  

        SAXParserFactory f = SAXParserFactory.newInstance();

        try

        {

            SAXParser parser = f.newSAXParser();

            parser.parse(«sample.xml», new DefaultHandler());

        }

        catch (ParserConfigurationException | SAXException | IOException e)

        {

            e.printStackTrace();

        }

    }

}

Output:

org.xml.sax.SAXParseException; systemId: file:///home/stark/eclipse-workspace-java/java2blog/sample.xml; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

The parser will raise the error. However, you can correct it by removing the extra characters and changing the file as given below.

<?xml version=«1.0» encoding=«utf-8»?>

<person>

    <name> Mohtashim Nawaz </name>

    <age> 24 </age>

    <prof> Software Engineer </prof>

</person>

Observe that this XML file does not have (!) symbol at the beginning.

Byte Order Mark (BOM) At the Beginning of the XML File

The Byte Order Mark is a special unicode character that can indicate different things. The text editors may insert the BOM character at the beginning of the file automatically.

While parsing the XML file with the BOM character inserted in the beginning, you may encounter the SAX parser error if the file is parsed as stream of characters instead of stream of bytes.

However, it might not always be the case as in the latest version of Java the SAX parser can parse the BOM character correctly.

You can add or remove the Byte Order Mark character from the file using the code as well as manually in the text editor. Most of the text editors provide options to add or remove the BOM character.

Passing a Non Existent File to Parser

If you pass a file to parser that does not exist, you shall get the SAX parser error. The same can happen if you accidentally fail to provide the correct path.

So even if the file existed, if its path is not correct, you will eventually get the parser error.

Let us see an example.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

package java2blog;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import javax.xml.parsers.SAXParser;

import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;

import org.xml.sax.helpers.DefaultHandler;

public class XmlParser

{

    public static void main(String[] args)

    {  

        SAXParserFactory f = SAXParserFactory.newInstance();

        try

        {

            SAXParser parser = f.newSAXParser();

            parser.parse(«sample_unknown.xml», new DefaultHandler());

        }

        catch (ParserConfigurationException | SAXException | IOException e)

        {

            e.printStackTrace();

        }

    }

}

The “sample_unknown.xml” file does not exist.
Output:

java.io.FileNotFoundException: /home/stark/eclipse-workspace-java/java2blog/sample_unknown.xml (No such file or directory)

However note that in this case the only error is the FileNotFoundException rather than parser error.

Different Encoding Formats Causing the Parser Error

The difference between the file encoding format and the encoding format you pass to the parser can cause the parser error.

For instance, if your file is encoded into UTF-8 encoding and you somehow pass the UTF-16 encoding to the parser, you will end up getting the parser error. Therefore, you should always check for the file encoding before parsing it.

Conclusion

This is all about the SAX error – content is not allowed in prolog. You can read more about SAX here.

Hope you have enjoyed reading the article. Stay tuned for more such articles. Happy Learning!

Мы используем синтаксический анализатор SAX для анализа XML-файла и получаем следующее сообщение об ошибке:

org.xml.sax.SAXParseException; systemId: ../src/main/resources/staff.xml;

  lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

Короче говоря, недопустимый текст или спецификация перед объявлением XML или другой кодировкой вызовут ошибку SAX – Содержимое не разрешено в прологе .

  • 1. Недопустимый текст перед объявлением XML.
  • 2. Спецификация в начале XML-файла.
  • 3. Другой формат кодирования
  • 4. Скачать Исходный Код
  • 5. Рекомендации

1. Недопустимый текст перед объявлением XML.

В начале XML-объявления любой текст вызовет Содержимое не разрешено в прологе ошибка.

Например, приведенный ниже XML-файл содержит дополнительную маленькую точку . перед объявлением XML.

.

    
        yong
        mook kim
        mkyong
        100000
    

Чтобы исправить это Удалите любой текст перед объявлением XML.


    
        yong
        mook kim
        mkyong
        100000
    

2. Спецификация в начале XML-файла.

Многие текстовые редакторы автоматически добавляют спецификацию в файл UTF-8.

Примечание Прочитайте следующие статьи:

  • Java добавляет и удаляет спецификацию из файла UTF-8
  • Википедия – Метка порядка байтов (спецификация)

Протестированный с Java 11 и Java 8, встроенный синтаксический анализатор SAX может правильно анализировать файл спецификации UTF-8; однако некоторые разработчики утверждали, что спецификация вызвала ошибку при анализе XML.

Чтобы исправить это , удалите спецификацию из файла UTF-8.

  1. Удалите спецификацию с помощью кода
  2. В notepad++ проверьте кодировку UTF-8 без спецификации .
  3. В Intellij IDEA прямо в файле выберите Удалить спецификацию .

P.S Многие редакторы текста или кода имеют функции для добавления или удаления метка порядка байтов (спецификация) для файла попробуйте найти нужную функцию в меню.

3. Другой формат кодирования

Различная кодировка также вызвала популярный XML Содержимое не допускается в прологе.

Например, XML-файл UTF-8.


    
        mkyong
        support
        5000
        
        
    
    
        yflow
        admin
        8000
        
    

И мы используем кодировку UTF-16 для анализа вышеупомянутого XML-файла в кодировке UTF-8.

  SAXParserFactory factory = SAXParserFactory.newInstance();

  try (InputStream is = getXMLFileAsStream()) {

      SAXParser saxParser = factory.newSAXParser();

      // parse XML and map to object, it works, but not recommend, try JAXB
      MapStaffObjectHandlerSax handler = new MapStaffObjectHandlerSax();

      // more options for configuration
      XMLReader xmlReader = saxParser.getXMLReader();
      xmlReader.setContentHandler(handler);

      InputSource source = new InputSource(is);

      // UTF-16 to parse an UTF-8 XML file
      source.setEncoding(StandardCharsets.UTF_16.toString());
      xmlReader.parse(source);

      // print all
      List result = handler.getResult();
      result.forEach(System.out::println);

  } catch (ParserConfigurationException | SAXException | IOException e) {
      e.printStackTrace();
  }

Выход

[Fatal Error] :1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1243)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at com.mkyong.xml.sax.ReadXmlSaxParser2.main(ReadXmlSaxParser2.java:45)

4. Скачать Исходный Код

$клон git $клон git

$компакт-диск java-xml

$cd src/основной/java/com/mkyong/xml/саксофон/

5. Рекомендации

  • Синтаксический анализатор Java SAX
  • Java добавляет и удаляет спецификацию из файла UTF-8
  • Википедия – Метка порядка байтов (спецификация)
  • В чем разница между UTF-8 и UTF-8 без спецификации?

Оригинал: “https://mkyong.com/java/sax-error-content-is-not-allowed-in-prolog/”



  • Метки



    bom, content, error, text, xml

Answer by Everleigh O’Donnell

We are probably going to need to see some more code. Another possibility is that locally it is not getting chunked while on GAE it is. How are you handling the code before you pass it to the parser ?

– Romain Hippeau

Jun 13 ’10 at 3:41

,There are some special characters called byte order markers that could be in the buffer.
Before passing the buffer to the Parser do this… ,How to check: If you move your file into a path without special characters and the error disappears, then it was this issue.,I pass in this XML to a parser with

Another possible scenario that causes this is when anything comes before the XML document type declaration. i.e you might have something like this in the buffer:

helloworld<?xml version="1.0" encoding="utf-8"?>  

There are some special characters called byte order markers that could be in the buffer.
Before passing the buffer to the Parser do this…

String xml = "<?xml ...";
xml = xml.trim().replaceFirst("^([\W]+)<","<");

Answer by Rocco Walter

The encoding in your XML and XSD (or DTD) are different.
XML file header: <?xml version=’1.0′ encoding=’utf-8′?>
XSD file header: <?xml version=’1.0′ encoding=’utf-16′?>,Any characters before the “<?xml….” will cause above “org.xml.sax.SAXParseException: Content is not allowed in prolog” error message.,Ref: http://www.mkyong.com/java/sax-error-content-is-not-allowed-in-prolog/,This error message is always caused by the invalid XML content in the beginning element. For example, extra small dot “.” in the beginning of XML element.

Another possible scenario that causes this is when anything comes before the XML document type declaration. i.e you might have something like this in the buffer:

helloworld<?xml version="1.0" encoding="utf-8"?>  

There are some special characters called byte order markers that could be in the buffer.
Before passing the buffer to the Parser do this…

String xml = "<?xml ...";
xml = xml.trim().replaceFirst("^([\W]+)<","<");

Answer by Alexandria Gomez

I’ve been beating my head against this absolutely infuriating bug for the last 48 hours, so I thought I’d finally throw in the towel and try asking here before I throw my laptop out the window.,I was facing the same problem called «Content is not allowed in prolog» in my xml file.,bellow are cause above “org.xml.sax.SAXParseException: Content is not allowed in prolog” exception.,Due to some internal bug, the error Content is not allowed in prolog also appears if the file content itself is 100% correct but you are supplying the file name like C:Data#22file.xml.

I’m trying to parse the response XML from a call I made to AWS SimpleDB. The response is coming back on the wire just fine; for example, it may look like:

<?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
    <ListDomainsResult>
        <DomainName>Audio</DomainName>
        <DomainName>Course</DomainName>
        <DomainName>DocumentContents</DomainName>
        <DomainName>LectureSet</DomainName>
        <DomainName>MetaData</DomainName>
        <DomainName>Professors</DomainName>
        <DomainName>Tag</DomainName>
    </ListDomainsResult>
    <ResponseMetadata>
        <RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId>
        <BoxUsage>0.0000071759</BoxUsage>
    </ResponseMetadata>
</ListDomainsResponse>

I pass in this XML to a parser with

XMLEventReader eventReader = xmlInputFactory.createXMLEventReader(response.getContent());

Here’s the bizarre part — it works great inside the local server. The response comes in, I parse it, everyone’s happy. The problem is that when I deploy the code to Google App Engine, the outgoing request still works, and the response XML seems 100% identical and correct to me, but the response fails to parse with the following exception:

com.amazonaws.http.HttpClient handleResponse: Unable to unmarshall response (ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.): <?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/"><ListDomainsResult><DomainName>Audio</DomainName><DomainName>Course</DomainName><DomainName>DocumentContents</DomainName><DomainName>LectureSet</DomainName><DomainName>MetaData</DomainName><DomainName>Professors</DomainName><DomainName>Tag</DomainName></ListDomainsResult><ResponseMetadata><RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
    at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(Unknown Source)
    at com.amazonaws.transform.StaxUnmarshallerContext.nextEvent(StaxUnmarshallerContext.java:153)
    ... (rest of lines omitted)

Answer by Camila Strong

“Content is not allowed in prolog” when parsing perfectly valid XML on GAE,I was facing the same problem called «Content is not allowed in prolog» in my xml file.,bellow are cause above “org.xml.sax.SAXParseException: Content is not allowed in prolog” exception.,Ref: http://www.mkyong.com/java/sax-error-content-is-not-allowed-in-prolog/

我正在尝试解析来自我对AWS SimpleDB的调用的响应XML。反应在电线上恢复得很好;例如,它可能看起来像:

<?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
    <ListDomainsResult>
        <DomainName>Audio</DomainName>
        <DomainName>Course</DomainName>
        <DomainName>DocumentContents</DomainName>
        <DomainName>LectureSet</DomainName>
        <DomainName>MetaData</DomainName>
        <DomainName>Professors</DomainName>
        <DomainName>Tag</DomainName>
    </ListDomainsResult>
    <ResponseMetadata>
        <RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId>
        <BoxUsage>0.0000071759</BoxUsage>
    </ResponseMetadata>
</ListDomainsResponse>

我使用

XMLEventReader eventReader = xmlInputFactory.createXMLEventReader(response.getContent());

奇怪的是,它在本地服务器中工作得很好。我分析得到,大家都很高兴。问题是,当我将代码部署到Google App Engine时,传出的请求仍然有效,响应XML对我来说似乎100%相同且正确,但响应无法解析,出现以下异常:

com.amazonaws.http.HttpClient handleResponse: Unable to unmarshall response (ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.): <?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/"><ListDomainsResult><DomainName>Audio</DomainName><DomainName>Course</DomainName><DomainName>DocumentContents</DomainName><DomainName>LectureSet</DomainName><DomainName>MetaData</DomainName><DomainName>Professors</DomainName><DomainName>Tag</DomainName></ListDomainsResult><ResponseMetadata><RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
    at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(Unknown Source)
    at com.amazonaws.transform.StaxUnmarshallerContext.nextEvent(StaxUnmarshallerContext.java:153)
    ... (rest of lines omitted)

Answer by Aila McCormick

Кодировка в вашем XML и XSD (или DTD) различается.
Заголовок файла XML: <?xml version=’1.0′ encoding=’utf-8′?>
Заголовок файла XSD:<?xml version=’1.0′ encoding=’utf-16′?>,С атрибутом encoding = и без него в прологе,В моем xml-файле заголовок выглядел так: ,Кодировка в вашем XML и XSD (или DTD) должна быть одинаковой.
Заголовок файла XML: <?xml version=’1.0′ encoding=’utf-8′?>
Заголовок файла XSD:<?xml version=’1.0′ encoding=’utf-8′?>

Я пытаюсь разобрать ответ XML на вызов, сделанный мной в AWS SimpleDB. Ответ возвращается по проводу нормально; например, это может выглядеть так:

<?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/">
    <ListDomainsResult>
        <DomainName>Audio</DomainName>
        <DomainName>Course</DomainName>
        <DomainName>DocumentContents</DomainName>
        <DomainName>LectureSet</DomainName>
        <DomainName>MetaData</DomainName>
        <DomainName>Professors</DomainName>
        <DomainName>Tag</DomainName>
    </ListDomainsResult>
    <ResponseMetadata>
        <RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId>
        <BoxUsage>0.0000071759</BoxUsage>
    </ResponseMetadata>
</ListDomainsResponse>

Я передаю этот XML парсеру с

XMLEventReader eventReader = xmlInputFactory.createXMLEventReader(response.getContent());

Вот что интересно — он отлично работает на локальном сервере. Приходит ответ, разбираю, все довольны. Проблема в том, что когда я развертываю код в Google App Engine, исходящий запрос все еще работает, и ответ XML кажется мне на 100% идентичным и правильным, но ответ не удается проанализировать со следующим исключением:

com.amazonaws.http.HttpClient handleResponse: Unable to unmarshall response (ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.): <?xml version="1.0" encoding="utf-8"?> 
<ListDomainsResponse xmlns="http://sdb.amazonaws.com/doc/2009-04-15/"><ListDomainsResult><DomainName>Audio</DomainName><DomainName>Course</DomainName><DomainName>DocumentContents</DomainName><DomainName>LectureSet</DomainName><DomainName>MetaData</DomainName><DomainName>Professors</DomainName><DomainName>Tag</DomainName></ListDomainsResult><ResponseMetadata><RequestId>42330b4a-e134-6aec-e62a-5869ac2b4575</RequestId><BoxUsage>0.0000071759</BoxUsage></ResponseMetadata></ListDomainsResponse>
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
    at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(Unknown Source)
    at com.amazonaws.transform.StaxUnmarshallerContext.nextEvent(StaxUnmarshallerContext.java:153)
    ... (rest of lines omitted)

Content Is Not Allowed In Prolog is an error when the documents contains invisible characters or characters before the XML header.

No Beginning Tag:Content Is Not Allowed In Prolog

Content Is Not Allowed In Prolog
Content Is Not Allowed In Prolog

Prolog error is also shown when yhe XML header do not have a beginning tag “<” before thePseudo Attribute, firstquestion mark in the XML header as shown in the image. If the document in not proper UTF and there are invisible characters between the XML header, a prolog error can be shown.

AOnline Syntax Error Parsing XML Validator Toolcan be used to check the parsing errors and find invisible characters.

To Solve this Prolog error;

Copy either of the below code and replace it with the existing XML header;

<?xml version=”1.0″ encoding=”UTF-16″ standalone=”no”?>

or

<?xml version=”1.0″ encoding=”UTF-8″ ?>

Byte Order Markers

Byte order markers could be in the buffer. Before passing the buffer to the Parser do this.

String xml = “<?xml …”;
xml = xml.trim().replaceFirst(“^([W]+)<“,”<“);

Clearing the white spaces between characters also helps in sorting out the issue. If the XML header has white space before it, you may encounter another error:The processing instruction target matching “[xX][mM][lL]” is not allowed as shown in the below image.

The processing instruction target matching "[xX][mM][lL]" is not allowed
The processing instruction target matching “[xX][mM][lL]” is not allowed

Characters Before XML header:Content Is Not Allowed In Prolog

If there are visible or invisible characters before the XML header, the error Content Is Not Allowed In Prolog will pop up. It

Characters Before XML header: Content Is Not Allowed In Prolog

Characters Before XML header

As shown in the image, a character “x” was put before XML header, and error was shown. Even if there an extra small dot “.” in the beginning of XML element, the error will pop up.

Use Notepad++ to copy and paste all the codes and display all the characters by selecting Encoding “UTF-8 without BOM”. Solution is to remove all the whites pace and characters before the XML header.

  • Construction simulator 2015 выдает ошибку
  • Const string паскаль ошибка
  • Console world of tanks support ошибка 00l07
  • Cons adm ошибка 101
  • Connectionread recv общая ошибка