Xml node fails to parse json message

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

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

[
  {
    "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:

<?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

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:

<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.

2 Likes

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