1

my ATS provider gave me data using XML. Unfortunately when I am trying to fetch and parsing them console returning me error:

error on line 1 at column 1: Extra content at the end of the document

link to XML: https://webservice.hrlink.pl/sync/api/prezentacja/export.php

code bellow:

        fetch("https://webservice.hrlink.pl/sync/api/prezentacja/export.php", { mode: 'no-cors' })
        .then(function (resp) {
            return resp.text()

        })
        // .then(data => console.log(data));
        .then(function (data) {
            let parser = new DOMParser();
            xmlDoc = parser.parseFromString(data,"text/xml");
            console.log(xmlDoc)

        })

I have a root node in xml and when i'll fetch it from local disk works:

        fetch("export.xml", { mode: 'no-cors' })

enter image description here

Do you have idea where is the issue and how to fix it?

  • 1
    Does this answer your question? [redux fetch body is not use with no cors mode](https://stackoverflow.com/questions/35169728/redux-fetch-body-is-not-use-with-no-cors-mode) – jeprubio Mar 19 '20 at 09:39
  • 1
    If you log the `resp` content: `Response { type: "opaque", url: "", redirected: false, status: 0, ok: false, statusText: "", headers: Headers, body: null, bodyUsed: false }` – jeprubio Mar 19 '20 at 09:41

0 Answers0