Reading XML file from Nextcloud and read XML Data

Hi I am trying to read a XML file that I have downloaded from nextclud.
No matter what I try I only get errors. I have tried to read other posts in the forum about XML but can’t get it to work.

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "typeVersion": 1,
      "position": [
        1270,
        340
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        1060,
        340
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "/Maintenance/FireDoorData/RCCLSymphonytest/Firedoors.xml"
      },
      "name": "Nextcloud",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        810,
        380
      ],
      "credentials": {
        "nextCloudApi": "DNVGL incubator nextcloud"
      }
    },
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    }
  ],
  "connections": {
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Nextcloud",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

If you have “Set all Data” on the MoveBinaryData node set it tries to JSON parse the data as the “json” property always has to contain an object. If you deactivate that option it will work as expected as it then writes that data in a key, which can be a string.

Here your workflow with that one setting changed:

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "typeVersion": 1,
      "position": [
        1040,
        400
      ]
    },
    {
      "parameters": {
        "setAllData": false,
        "options": {}
      },
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        830,
        400
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "path": "/Maintenance/FireDoorData/RCCLSymphonytest/Firedoors.xml"
      },
      "name": "Nextcloud",
      "type": "n8n-nodes-base.nextCloud",
      "typeVersion": 1,
      "position": [
        600,
        400
      ],
      "credentials": {
        "nextCloudApi": "DNVGL incubator nextcloud"
      }
    }
  ],
  "connections": {
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nextcloud": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like