# Xml node fails to parse json message

**URL:** <https://community.n8n.io/t/xml-node-fails-to-parse-json-message/66636>\
**Category:** Questions\
**Tags:** data-transformation\
**Created:** [December 20, 2024, 10:14pm UTC](https://community.n8n.io/t/xml-node-fails-to-parse-json-message/66636 "2024-12-20T22:14:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![voltazek](https://avatars.discourse-cdn.com/v4/letter/v/e99b99/32.png) [@voltazek](https://community.n8n.io/u/voltazek)\
**Post date:** [December 20, 2024, 10:14pm UTC](https://community.n8n.io/t/xml-node-fails-to-parse-json-message/66636/1 "2024-12-20T22:14:59Z")

</div>

Converting binary information into json to then convert to xml

## What is the error message (if any)?

n8n version

`1.70.4 (Self Hosted)`

Stack trace

```auto
Error: Invalid character in name at XMLStringifier.module.exports.XMLStringifier.assertLegalName (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js:213:15) at XMLStringifier.assertLegalName (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js:4:59) at XMLStringifier.module.exports.XMLStringifier.name (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js:29:19) at new XMLElement (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js:26:34) at XMLElement.module.exports.XMLNode.node (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js:304:15) at XMLElement.module.exports.XMLNode.element (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js:236:28) at XMLElement.module.exports.XMLNode.ele (/usr/local/lib/node_modules/n8n/node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js:531:19) at /usr/local/lib/node_modules/n8n/node_modules/xml2js/lib/builder.js:108:37 at Builder.exports.Builder.Builder.buildObject (/usr/local/lib/node_modules/n8n/node_modules/xml2js/lib/builder.js:120:14) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Xml/Xml.node.js:242:57) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:732:42) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:716:66 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1147:20

```

## Please share your workflow

## Share the output returned by the last node

```auto
[
  {
    "supplier/erp Number": "WESUNI001",
    "Supplier Name": "Testing Teester",
    "(GUID) Third Party Refernce": "6012bf8da61f4655a5a9c747a334c794",
    "Legal Structure": "Other",
    "Tax ID Number": "123456789",
    "Tax ID Type": "FederalID",
    "Active for Shopping": "Yes",
    "Sync to ERP Flag": "No",
    "Country of Origin": "US",
    "Tax Form Sign Date CF": 45264,
    "CF Non Profit": "Yes",
    "Distribution Method": "email"
  }
]

```

Expect output of xml node:

```auto
<?xml version="1.0" encoding="UTF-8" ?>
<0>
    <supplier/erp_Number>WESUNI001</supplier/erp_Number>
    <Supplier_Name>Testing Teester</Supplier_Name><(GUID)_Third_Party_Refernce>6012bf8da61f4655a5a9c747a334c794
</(GUID)_Third_Party_Refernce>
<Legal_Structure>Other</Legal_Structure>
<Tax_ID_Number>123456789</Tax_ID_Number>
<Tax_ID_Type>FederalID</Tax_ID_Type>
<Active_for_Shopping>Yes</Active_for_Shopping>
<Sync_to_ERP_Flag>No</Sync_to_ERP_Flag>
<Country_of_Origin>US</Country_of_Origin>
<Tax_Form_Sign_Date_CF>45264</Tax_Form_Sign_Date_CF>
<CF_Non_Profit>Yes</CF_Non_Profit>
<Distribution_Method>email</Distribution_Method>undefined</0>

```

## Information on your n8n setup

- **n8n version:** 1.70.4 (Self Hosted)
- **Database (default: SQLite):** SQLite
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):** Own
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** Docker
- **Operating system:** Windows 11

---

<div class="post-metadata">

**Author:** ![ihortom](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ihortom/32/11473_2.png) [@ihortom](https://community.n8n.io/u/ihortom)\
**Post date:** [December 23, 2024, 8:27pm UTC](https://community.n8n.io/t/xml-node-fails-to-parse-json-message/66636/2 "2024-12-23T20:27:46Z")

</div>

Welcome to the community @voltazek !

> **Tip for sharing information**
>
> #### Pasting your n8n workflow
> 
> * * *
> 
> Ensure to copy your n8n workflow and paste it in the _code block_, that is in between the pairs of triple backticks, which also could be achieved by clicking `</>` (preformatted text) in the editor and pasting in your workflow.
> 
> ```  
> \<your workflow\>  
> ```
> 
> That implies to any JSON output you would like to share with us.
> 
> Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
> 
> * * *

In XML, spaces are not allowed in the names of elements or attributes. This means that you cannot have spaces in the keys of XML. Instead, you can use underscores (\_) or camelCase to separate words. For example:

```auto
<person>
  <first_name>John</first_name>
  <lastName>Doe</lastName>
</person>

```

In this example, `first_name` and `lastName` are valid XML element names without spaces. If you have spaces, it will result in an error.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [February 4, 2025, 4:05pm UTC](https://community.n8n.io/t/xml-node-fails-to-parse-json-message/66636/3 "2025-02-04T16:05:49Z")

</div>

Closed on February 4, 2025, 4:05pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
