# Using a Split node or split message

**URL:** <https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855>\
**Category:** General\
**Created:** [6 October 2020 20:20 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855 "2020-10-06T20:20:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![niclas.w82](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/niclas.w82/32/31813_2.png) [@niclas.w82](https://discourse.nodered.org/u/niclas.w82)\
**Post date:** [6 October 2020 20:20 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/1 "2020-10-06T20:20:52Z")

</div>

Hi.

I would need some help splitting a message so it is a valid xml. I have used "\<batch name" to split in the beginning of the xml. But I want i still want \<batch name in the beginning of the payload.

Hope you understand what I mean.

Best Regards Niclas!

 ![Skärmavbild 2020-10-06 kl. 22.13.45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/59c8a904c093cf3c3ad971ed42cc3286b0ff7743.jpeg)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [6 October 2020 20:44 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/2 "2020-10-06T20:44:12Z")

</div>

I **suspect** that is not the right node to do what you want.

---

<div class="post-metadata">

**Author:** ![niclas.w82](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/niclas.w82/32/31813_2.png) [@niclas.w82](https://discourse.nodered.org/u/niclas.w82)\
**Post date:** [6 October 2020 20:47 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/3 "2020-10-06T20:47:13Z")

</div>

I solved it. just tried to add a function node after with "\<batch name"+msg.payload.

not nice but it worked for now.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [6 October 2020 20:48 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/4 "2020-10-06T20:48:12Z")

</div>

I guess it comes down to: "so long as it works".

---

<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:** [6 October 2020 20:48 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/5 "2020-10-06T20:48:27Z")

</div>

If you are starting with valid xml then you should be able to feed that into an xml node and it will convert it to a javascript object. Then you can access the contents much more easily.

---

<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:** [20 October 2020 20:48 UTC](https://discourse.nodered.org/t/using-a-split-node-or-split-message/33855/6 "2020-10-20T20:48:35Z")

</div>

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