jpsstack
jpsstack

Reputation: 1291

How to access an XML value in Node-RED

I'm receiving an XML response from an HTTP GET request which I need a specific value from. I transformed it in an JavaScript object. How can I access it's values, for example the CompName? I thought I can use the function node, but couldn't figure out, how exactly.

enter image description here

Upvotes: 0

Views: 6830

Answers (1)

knolleary
knolleary

Reputation: 10117

In the Debug sidebar, when you hover over an message element, a set of buttons appears on the right-hand side.

The first of these, when clicked, will copy the path to the selected element, relative to the msg object. That will help you figure out the path you need for any particular element

In this instance, you'll find the CompName in the screenshot you've shared is:

msg.payload.feed.entry[0].content[0]['m:properties'][0]['d:CompName'][0]

Upvotes: 4

Related Questions