Заказы обработка импортированного файла ошибка разбора content is not allowed in prolog

Ошибка во вкладке Импорт/Экспорт, Логи

Есть решение

1

Добрый день, сегодня примерно в 19:20 пропала синхронизация с «моим складом», на стороне «моего склада» выдает ошибку «Заказы: Обработка импортированного файла: ошибка разбора: Content is not allowed in prolog.»., в админке вебасиста не могу зайти во вкладки Импорт/экспорт и Логи выдает «Ошибку#0». На сайте ничего нового не устанавливали и не обновляли. 

4 комментария

  • популярные
  • новые


  • +1

    Если включить в Инсталлере режим отладки, что покажет вместо «Ошибки №0» ?



    • +1

      В Инсталлере так же выдается ошибка #0 



      • +1

        o_O

         доступ по ftp к файлам есть? В файле /wa-log/error.log есть какие-нибудь записи?



      • +1

        Походу понял в чем проблема, заполнена память на хостинге.

        Добавить комментарий

        Перейти к контенту

        Ошибка во вкладке Импорт/Экспорт, Логи

        Есть решение

        1

        Добрый день, сегодня примерно в 19:20 пропала синхронизация с «моим складом», на стороне «моего склада» выдает ошибку «Заказы: Обработка импортированного файла: ошибка разбора: Content is not allowed in prolog.»., в админке вебасиста не могу зайти во вкладки Импорт/экспорт и Логи выдает «Ошибку#0». На сайте ничего нового не устанавливали и не обновляли. 

        4 комментария

        • популярные
        • новые


        • +1

          Если включить в Инсталлере режим отладки, что покажет вместо «Ошибки №0» ?



          • +1

            В Инсталлере так же выдается ошибка #0 



            • +1

              o_O

               доступ по ftp к файлам есть? В файле /wa-log/error.log есть какие-нибудь записи?



            • +1

              Походу понял в чем проблема, заполнена память на хостинге.

              Добавить комментарий

              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!

              For example in Problems I have

              Content is not allowed in prolog.

              How to find out why its there(what eclipse plugin has put it there) and how to turn it off?

              Markus Lausberg's user avatar

              asked Mar 2, 2011 at 11:00

              IAdapter's user avatar

              10

              I had this problem too and it was, because i changed/saved the file in UltraEdit. After the save command, the file encoding changed and included characters, eclipse was not able to read.

              You can open the file with the windows «Editor» tool and delete the characters, eclipse can not read. You will directly detect them.

              answered Mar 2, 2011 at 11:25

              Markus Lausberg's user avatar

              Markus LausbergMarkus Lausberg

              12.1k6 gold badges41 silver badges66 bronze badges

              This sounds like an error with a xml file. Most of the time «Content is not allowed in prolog» means, that your XML file does not have the right format or even doesn’t start the right way.

              answered Mar 2, 2011 at 11:04

              Chris's user avatar

              ChrisChris

              7,6158 gold badges49 silver badges99 bronze badges

              1

              «Content is not allowed in prolog» is the error thrown by Xerces when there’s something in an XML file or stream that precedes the <?xml?> declaration. There must be nothing before that, not even whitespace or a Byte-Order-Mark.

              answered Mar 2, 2011 at 11:10

              skaffman's user avatar

              skaffmanskaffman

              396k96 gold badges814 silver badges768 bronze badges

              1

              Double-click the message and it should take you to the file (and ideally location within the file) that is the source of the problem.

              This specific error sounds like you’ve got a malformed XML file.

              answered Mar 2, 2011 at 11:02

              Joachim Sauer's user avatar

              Joachim SauerJoachim Sauer

              298k57 gold badges552 silver badges610 bronze badges

              1

              For example in Problems I have

              Content is not allowed in prolog.

              How to find out why its there(what eclipse plugin has put it there) and how to turn it off?

              Markus Lausberg's user avatar

              asked Mar 2, 2011 at 11:00

              IAdapter's user avatar

              10

              I had this problem too and it was, because i changed/saved the file in UltraEdit. After the save command, the file encoding changed and included characters, eclipse was not able to read.

              You can open the file with the windows «Editor» tool and delete the characters, eclipse can not read. You will directly detect them.

              answered Mar 2, 2011 at 11:25

              Markus Lausberg's user avatar

              Markus LausbergMarkus Lausberg

              12.1k6 gold badges41 silver badges66 bronze badges

              This sounds like an error with a xml file. Most of the time «Content is not allowed in prolog» means, that your XML file does not have the right format or even doesn’t start the right way.

              answered Mar 2, 2011 at 11:04

              Chris's user avatar

              ChrisChris

              7,6158 gold badges49 silver badges99 bronze badges

              1

              «Content is not allowed in prolog» is the error thrown by Xerces when there’s something in an XML file or stream that precedes the <?xml?> declaration. There must be nothing before that, not even whitespace or a Byte-Order-Mark.

              answered Mar 2, 2011 at 11:10

              skaffman's user avatar

              skaffmanskaffman

              396k96 gold badges814 silver badges768 bronze badges

              1

              Double-click the message and it should take you to the file (and ideally location within the file) that is the source of the problem.

              This specific error sounds like you’ve got a malformed XML file.

              answered Mar 2, 2011 at 11:02

              Joachim Sauer's user avatar

              Joachim SauerJoachim Sauer

              298k57 gold badges552 silver badges610 bronze badges

              1

              • Группа:
                Клиент
              • Сообщений:
                26
              • Регистрация:
                11.01.2015

              21.09.2016 15:19

              При синхронизации сервиса Мой Склад с интернет-магазином в отчёте появляется сообщение:
              Заказы: Обработка импортированного файла: ошибка разбора: Content is not allowed in prolog

              В log файле следующая запись:
              failure
              Система не нашла в базе данных объект класса «Df_Catalog_Model_Product» с идентификатором «29»

              Как устранить ошибку?

              • Группа:
                Администратор
              • Сообщений:
                8995
              • Регистрация:
                20.02.2010

              06.10.2016 02:51

              Что мне нужно сделать, чтобы воспроизвести эту же проблему у себя?

              • Группа:
                Клиент
              • Сообщений:
                26
              • Регистрация:
                11.01.2015

              06.10.2016 14:47

              У нас данная ошибка появляется при включении синхронизации заказов в Моём Складе.

              Можем предоставить вам доступ к Моему Складу для воспроизведения проблемы.

              i’m trying to convert xml to html using xslt. Am using java.xml.transform to do this in java.
              it was working fine until i bumped into some xml. it said the following error.

              [Fatal Error] :1:1: Content is not allowed in prolog. 
                  javax.xml.transform.TransformerConfigurationException: 
                  javax.xml.transform.TransformerConfigurationException: 
                  javax.xml.transform.TransformerException: 
                  org.xml.sax.SAXParseException: Content is not allowed in prolog.
              

              so i made sure there is no character before the xml declaration. i even took care of BOM using the solution
              http://forums.sun.com/thread.jspa?messageID=10324562#10324562

              STILL no luck and it happens only for one xml. i even opened the xml in editor and saved it in a file with utf-8 encoding. this is driving me crazy. any idea?

              UPDATE: You get this error when you have given the wrong path for the xsl file and a file not found exception happens.
              (this was my case. it might help somebody. thanks for your responses)

              CAMOBAP's user avatar

              CAMOBAP

              5,4938 gold badges57 silver badges92 bronze badges

              asked Aug 3, 2010 at 10:19

              Senthil Kumar's user avatar

              Senthil KumarSenthil Kumar

              9,6278 gold badges36 silver badges45 bronze badges

              6

              This kind of thing can happen if you have an UTF-8 file with a BOM, and if you use an XML parser that isn’t aware of it. Save the XML file as UTF-8 without BOM.

              answered Aug 3, 2010 at 10:33

              Jesper's user avatar

              1

              Do you have a header in your file? Something like:

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

              That should be at the start of the first line. Unfortunately I can’t see your XML file as that URL is blocked from where I am.

              answered Aug 3, 2010 at 11:14

              Noel M's user avatar

              Noel MNoel M

              15.7k8 gold badges38 silver badges47 bronze badges

              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!

              Content is not allowed in prolog error might occur due to unnecessary or invisible characters or JSON code in your XML file or usage of a different encoding format. But you don’t need to worry even if you aren’t sure about the root cause in your case.Content is not allowed in prolog

              This post deals with the causes and solutions for eliminating the same error. Read ahead to see how you can wave goodbye to the error to breathe a sigh of relief.

              Contents

              • Why Is the Content Is Not Allowed in Prolog Error Occurring?
                • – Characters Before the XML Tag
                • – Incorrectly Typed XML Tag
                • – Using a Different Encoding Format for Parsing
                • – Your File Begins With Byte Order Mark (BOM)
                • – Your File Contains a Combination of XML and JSON
              • How Do I Fix Content Is Not Allowed in Prolog?
                • – Cut Out the Extra Characters and Spaces
                • – Ensure the Accuracy of the XML Tag
                • – Maintain Consistency Between Encoding Formats
                • – Say No To BOM
                • – Keep the XML Code Only
              • Conclusion

              The sxxp0003: error reported by XML parser: content is not allowed in prolog. is occurring because you have characters at the beginning of your file. There could also be other reasons, like using a different encoding format for parsing, etc.

              All possible reasons have been explained below to help you quickly identify the root cause.

              – Characters Before the XML Tag

              If your file has any characters, such as numbers, symbols, or alphabets, before the XML tag, then you’ll see the given error. The section containing the given tag is called prolog, and it doesn’t allow any characters except for the XML tag inside it.

              Here is an example of the problematic beginning of a file:

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

              – Incorrectly Typed XML Tag

              Adding extra spaces or incorrectly declaring the XML tag can lead to the “parseerror at row col 1 1 message content is not allowed in prolog. Android Studio.” Here is what an incorrectly typed XML tag looks like:

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

              or

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

              – Using a Different Encoding Format for Parsing

              If you create a file with a particular encoding format and then try to parse it with another encoding format, then you’ll get the said error. For example, your XML code has its encoding set to UTF-8. Now, you have created a Java file and set the encoding type for your source file to UTF-16 before parsing the same. Once you run your code to parse XML, the said error will pop up.Content is not allowed in prolog causes

              The XML and Java code targeting two different encoding formats for creating and parsing the XML code has been attached below.

              The XML code created in UTF-8 encoding:

              <?xml version=”1.0″ encoding=”utf-8″?>
              <week>
              <day id=”01″>
              <name>Monday</name>
              <task>Create five web pages.</task>
              <taskDetails><![CDATA[c & d]]></taskDetails>
              </day>
              <day id=”02″>
              <name>Tuesday</name>
              <task>Design the pictures.</task>
              <taskDetails><![CDATA[x & y]]></taskDetails>
              </day>
              <day id=”03″>
              <name>Wednesday</name>
              <task>Write the content.</task>
              <taskDetails><![CDATA[a & b]]></taskDetails>
              </day>
              </week>

              The erroneous line in the Java code before parsing the above XML code:

              // setting the encoding type to UTF-16

              src.setEncoding(StandardCharsets.UTF_16.toString());

              – Your File Begins With Byte Order Mark (BOM)

              If your file has BOM at its beginning, you’ll face the same error. In case you don’t know, BOM stands for byte order mark. It points toward using the special Unicode character, such as U+FEFF, before the XML tag.

              Even if you can’t see any such characters in your file and can’t recall adding them, they might be there. It is because many text editors automatically add BOM to the UTF-8 files.

              – Your File Contains a Combination of XML and JSON

              Does your file contain a mixture of XML and JSON content? If yes, it might be the error’s root cause. Note that an XML parser can parse only XML code.

              Here is a well-blended file containing both XML and JSON:

              {“body”: <<xml version=”1.0″ encoding=”utf-8″?>
              <brand>
              <writer>John</writer>
              <designer>James</designer>
              </brand>
              , “metadata”: {“one”: “red”, “two”: “blue”, “three”: “green”, “four”: “red”, “five”: “pink”: {“a”:”light pink”,”b”:”tea pink”}}}

              Once you try to parse the above code, here is what you’ll see:

              org.xml.sax.saxparseexception content is not allowed in prolog

              How Do I Fix Content Is Not Allowed in Prolog?

              You can fix the stated error by ensuring the accuracy of the XML tag’s syntax and removing the extra characters before it. Also, maintaining consistency between the encoding formats and deleting BOM and non-XML code can help you resolve the error.

              Please read on to grasp the solutions’ details.

              – Cut Out the Extra Characters and Spaces

              You should remove any extra spaces or characters before the XML tag to kill the error. As a single space often goes unnoticed, you can take your cursor at the beginning of the XML tag and click the backspace key. Now, save the changes and try to run your program again to see if it works fine.

              – Ensure the Accuracy of the XML Tag

              No matter how correct the tag’s syntax looks, you should always ensure that you have written it correctly. It will help you eliminate the error. Here is the valid XML tag for your reference:

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

              Note that there isn’t any space between “<?” and “xml.” Also, you don’t have to enter a space between “uft-8” and “?>.” Please feel free to copy and paste the given tag into your file to remove the given error.

              – Maintain Consistency Between Encoding Formats

              To fix an error occurred while parsing content, you must parse your file using the same encoding format you used to create the file. Maintaining consistency between the encoding formats while file creation and parsing can help eliminate the error. If you can’t make changes to the XML parsing code, you should edit the XML tag in your file to match the format used while parsing the same.Content is not allowed in prolog fixes

              Another way to change the encoding format of your file is to save it with your preferred encoding type. For example, you are using Visual Studio to create and edit your files. Now, you want to parse your UTF-8 encoded file using UTF-16 format, but you cannot do it because of the error. Here, you’ll need to follow the below steps to convert your file from UTF-8 to UTF-16 to reach your desired results.

              1. Open the File menu.
              2. Opt for the option that says Save File As.
              3. Look beside the Save button to find the drop-down button.
              4. Click the drop-down button to view the Advanced Save Options dialog box.
              5. Go to the Encoding section.
              6. Choose the encoding format as per your preference.
              7. Save the changes.

              Remember that the Save File As option isn’t available for the project files. If you wish to convert your project files, then you’ll need to unload the project before converting them.

              – Say No To BOM

              Saying no to BOM can help your XML code run properly. As stated above, BOM may or may not be visible in your file. Plus, it’s always better to check for the existence of something before attempting to remove it.

              So, here is a Java file that’ll check if your file contains BOM and remove it accordingly. Please feel free to use it to remove BOM and, eventually, the error.

              import org.apache.commons.codec.binary.Hex;
              import java.io.BufferedWriter;
              import java.io.FileInputStream;
              import java.io.IOException;
              import java.io.InputStream;
              import java.nio.ByteBuffer;
              import java.nio.file.Files;
              import java.nio.file.Path;
              import java.nio.file.Paths;
              public class CutBOM { public static void main(String[] args) throws IOException {
              Path filePath = Paths.get(“enter your file’s path here”);
              removeBom(filePath);
              }
              private static boolean isBOMPresent(Path filePath) throws IOException {
              if (Files.notExists(filePath)) {
              throw new IllegalArgumentException(“The file path: ” + filePath + ” is invalid.”);
              }
              boolean res = false;
              byte[] bomInFile = new byte[3];
              try (InputStream myFile = new FileInputStream(filePath.toFile())) {
              is.read(bomInFile);
              String fileContent = new String(Hex.encodeHex(bomInFile));
              if (“efbbbf”.equalsIgnoreCase(fileContent)) {
              res = true;
              }
              }
              return res;
              }
              private static void removeBom(Path filePath) throws IOException {
              if (isBOMPresent(filePath)) {
              byte[] receivedBytes = Files.readAllBytes(filePath);
              ByteBuffer myByteBuffer = ByteBuffer.wrap(receivedBytes);
              System.out.println(“BOM exists in your file.”);
              byte[] fileBOM = new byte[3];
              myByteBuffer.get(fileBOM, 0, fileBOM.length);
              byte[] otherContent = new byte[receivedBytes.length – 3];
              myByteBuffer.get(otherContent, 0, otherContent.length);
              Files.write(filePath, otherContent);
              System.out.println(“BOM Removed Successfully!”);
              }
              else {
              System.out.println(“BOM doesn’t exist in your file.”);
              }
              }
              }

              – Keep the XML Code Only

              If the above solutions don’t work for you, you should check if your file contains JSON or some other code. If you can see it, removing it will make the error disappear.

              Conclusion

              Now, the error: content is not allowed in prolog won’t confuse you. If it does, you know the path to this article. Read these points to wrap up the post:

              • Ensure that your file starts with nothing but a valid XML tag.
              • Use the same encoding format for creating and parsing files.
              • Get rid of BOM in your file.
              • Your file must contain XML code only.

              You are ready to resume your work and get things right instantly.

              • Author
              • Recent Posts

              Position is Everything

              Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

              Position is Everything

            • Закончив спор мне стало стыдно найдите ошибку
            • Заказов у нас было во ошибка
            • Закончив рукопись нужно сразу передать ее редактору ошибка
            • Заказной бандероль какая ошибка
            • Закончив день многое было сделано ошибка