Adding tag and attribute to xml file

31 views
Skip to first unread message

Timo Nisula

unread,
Mar 27, 2018, 9:50:44 AM3/27/18
to Node-RED
How I can add attribute to xml file? I managed to add tag but not attribute to it.

I have following xml file


I can add tag when I use this:
msg.payload.data.shipment[0].service[0].val = 'both';

But I need add attribute n="returnlabel" also. I have tried this day to get it working but no...

Result what I need is this


BR,
Timnis
Auto Generated Inline Image 1
Auto Generated Inline Image 2

Timo Nisula

unread,
Mar 27, 2018, 10:06:42 AM3/27/18
to Node-RED
I use following flow to testing
Auto Generated Inline Image 1

Dave C-J

unread,
Mar 27, 2018, 10:46:41 AM3/27/18
to node...@googlegroups.com
The XML node is two way.. - so best way to find out what you need is to send in some XML that you want and it will show you the JSON you need to build to send back in...
so send in some XML with teh attribute as you want it and see how that comes out.
Reply all
Reply to author
Forward
0 new messages