# How can i read stream xml file using Node red

**URL:** <https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [21 March 2022 12:29 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146 "2022-03-21T12:29:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fathi2022](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@Fathi2022](https://discourse.nodered.org/u/Fathi2022)\
**Post date:** [21 March 2022 12:29 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/1 "2022-03-21T12:29:41Z")

</div>

Node-red to read XML file

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [21 March 2022 12:33 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/2 "2022-03-21T12:33:50Z")

</div>

Use xml Node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 March 2022 14:04 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/3 "2022-03-21T14:04:01Z")

</div>

Preceded by a File Read node of course.

---

<div class="post-metadata">

**Author:** ![Fathi2022](https://avatars.discourse-cdn.com/v4/letter/f/b487fb/32.png) [@Fathi2022](https://discourse.nodered.org/u/Fathi2022)\
**Post date:** [22 March 2022 13:25 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/4 "2022-03-22T13:25:06Z")

</div>

how can I use the Node, please?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 March 2022 13:41 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/5 "2022-03-22T13:41:57Z")

</div>

What have you tried so far? Make sure you read the help text for the node.

Are you a beginner with node-red? If so then I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [22 March 2022 16:34 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/6 "2022-03-22T16:34:17Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/6/f67dea2363eaaa9c6b312f4fe575d62a7d914ac3.png)

So you see the XML node converts the XML file into a JS Object in the msg.payload and can be directly used further or a JS Object will be converted into a XML file

[books.txt](https://discourse.nodered.org/uploads/short-url/jT5PXagctrR1CTyGhI0JFnjOkJw.txt) (4,4 KB)

You need to adapt the file read node to read your xml file.

```auto
[
    {
        "id": "f4cc57ee920b7cfb",
        "type": "file in",
        "z": "f87aa05e3297dcd1",
        "name": "",
        "filename": "H:\\books.txt",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 570,
        "y": 880,
        "wires": [
            [
                "d6f801e6a8cf89e2"
            ]
        ]
    },
    {
        "id": "6007593cedca3cea",
        "type": "debug",
        "z": "f87aa05e3297dcd1",
        "name": "Óutput JS Object",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 880,
        "wires": []
    },
    {
        "id": "e7e35ef120976dd1",
        "type": "inject",
        "z": "f87aa05e3297dcd1",
        "name": "",
        "props": [
            {
                "p": "trigger",
                "v": "true",
                "vt": "bool"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 370,
        "y": 880,
        "wires": [
            [
                "f4cc57ee920b7cfb"
            ]
        ]
    },
    {
        "id": "d6f801e6a8cf89e2",
        "type": "xml",
        "z": "f87aa05e3297dcd1",
        "name": "",
        "property": "payload",
        "attr": "",
        "chr": "",
        "x": 730,
        "y": 880,
        "wires": [
            [
                "6007593cedca3cea",
                "aae6c8cea7b7f6d5"
            ]
        ]
    },
    {
        "id": "aae6c8cea7b7f6d5",
        "type": "xml",
        "z": "f87aa05e3297dcd1",
        "name": "",
        "property": "payload",
        "attr": "",
        "chr": "",
        "x": 890,
        "y": 940,
        "wires": [
            [
                "7d08e59b1984cd6e"
            ]
        ]
    },
    {
        "id": "7d08e59b1984cd6e",
        "type": "debug",
        "z": "f87aa05e3297dcd1",
        "name": "Output XML File",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1060,
        "y": 940,
        "wires": []
    }
]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 May 2022 16:35 UTC](https://discourse.nodered.org/t/how-can-i-read-stream-xml-file-using-node-red/60146/7 "2022-05-21T16:35:16Z")

</div>

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