How to aggregate items to xml file output

Describe the problem/error/question

I want to aggregate data into an xml output as file. To test this I started with the Hacker News node.

Getting 10 outputs and writing them as separate xml files works fine (upper branch in workflow). But when I try to aggregate I get problems. When trying to convert to xml and then aggregate I get JSON output which is not usable. When trying to aggregate and then convert to xml the node fails (lower branch).

What is the error message (if any)?

{
“errorMessage”: “Invalid character in name”,
“errorDetails”: {},
“n8nDetails”: {
“n8nVersion”: “1.114.4 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“Error: Invalid character in name”,
" at XMLStringifier.module.exports.XMLStringifier.assertLegalName (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLStringifier.js:213:15)“,
" at XMLStringifier.assertLegalName (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLStringifier.js:4:59)”,
" at XMLStringifier.module.exports.XMLStringifier.name (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLStringifier.js:29:19)“,
" at new XMLElement (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLElement.js:26:34)”,
" at XMLElement.module.exports.XMLNode.node (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLNode.js:304:15)“,
" at XMLElement.module.exports.XMLNode.element (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLNode.js:236:28)”,
" at XMLElement.module.exports.XMLNode.ele (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xmlbuilder/lib/XMLNode.js:531:19)“,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xml2js/lib/builder.js:65:42”,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xml2js/lib/builder.js:65:27",
" at Builder.exports.Builder.Builder.buildObject (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/xml2js/lib/builder.js:120:14)"
]
}
}

Please share your workflow

Share the output returned by the last node

no output, expected would be

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <_highlightResult>noneneya ... ... ...

Information on your n8n setup

  • n8n version: 1.114.4
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting: default: own, main
  • Running n8n via: Docker
  • Operating system: Win

Hello @Cenitor , how are you?

With aggregate, you need to set the root name to “data,” which is the name of the array you defined.

If this helped you, mark the answer as a solution.

1 Like

Well that was almost too easy - thanks, now I’m more fine :blush:!

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