Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

cURL returns {"error":"Invalid xml file: Non-whitespace before first tag."}

Chingiz Murad
December 26, 2022

Hi

I'm trying to import test execution results (junit) to Xray using newman-reporter-junitfull

Import Execution Results - REST v2 

Developing and testing APIs using Postman 

whenever I try to import the resulting .xml using cURL I receive:

 {"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: s"}

Any thoughts are much appretiated

 

4 answers

0 votes
Ashish S
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 28, 2025

I am also importing result.xml file into Xray after test case execution. After struggling with same whitespace issue for days, I finally managed to find answer. Below solution worked for me.

I was using -F, -d to refer result.xml file in CURL. Instead I used --

--data-binary @Report.xml 

This --data-binary eliminates whitespace character issue.

Evania Zhang
Community Manager
Community Managers are Atlassian Team members who specifically run and moderate Atlassian communities. Feel free to say hello!
November 28, 2025

This topic is now closed as the discussion has become outdated. If you have more questions or want to continue the conversation, feel free to start a new topic. For more details on why we close older threads, check out our Rules of engagement - Atlassian Community .

Thank you for your understanding!

0 votes
Loriaux Yves
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2023

Please check the file encoding (e.g. by opening it with Notepad++).

It should be UTF-8.

Trying to import non UTF-8 encoded files result in the error you mentioned.

If it's UTF-8 BOM, then it's indeed incompatible with Xray Cloud.

You need to convert the file to UTF-8.

In Windows, this can be done with a Powershell script.

0 votes
Loriaux Yves
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 8, 2023

Hi,


I'm facing a very similar issue:

When exporting a JUNIT XML file from JENKINS, using the plugin

Xray - Test Management for Jira
(https://plugins.jenkins.io/xray-connector/)

1°) Exporting to Xray Server works fine (note that the xml file isn't corrupted !)

2°) When exporting to Xray Cloud, Xray's API replies this:

09:34:39 File found: C:\Program Files (x86)\Jenkins\workspace\CEDRIC UI - SMOKE AND SANITY - PROD\CEDRIC-UI\bin\Debug\CEDRIC_UI_20230608_075743.rxlog.junit.xml
09:34:39 Starting to import results from CEDRIC_UI_20230608_075743.rxlog.junit.xml
09:34:39 ERROR: Step ?Xray: Results Import Task? failed: Unable to confirm Result of the upload..... Upload Failed! Status:400 Response:{"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: ï"}

Failed! Status:400 Response:{"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: ï"}

This is similar to the issue reported above. ...

Where does that char come from ?

line: 0 Column: 1 Char: ï

Thanks in advance !

0 votes
Lucas Modzelewski _Lumo_
Atlassian Partner
January 3, 2023

 {"error":"Invalid xml file: Non-whitespace before first tag. Line: 0 Column: 1 Char: s"}

Did you check the .xml file? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events