XML to http-response

351 views
Skip to first unread message

Alexander Muller

unread,
Mar 14, 2016, 9:13:19 AM3/14/16
to Node-RED
Hi,

I simply need to visualize XML data on the node-red webserver (for example on: <ip.addr>:1880/xml), 
but if I send the XML information to the http response node, the webpage doesnt show the whole XML structure and just every value in one row. I tried it with a JSON object and it worked just fine, but not
with XML. What step do I need to add?

Thanks a lot!

Nicholas O'Leary

unread,
Mar 14, 2016, 9:16:24 AM3/14/16
to Node-RED Mailing List
If you want the browser to know it is xml data and then display with formatting, you need to set the appropriate content-type header in the response, most likely to 'application/xml';

In a Function node:
    msg.headers = {
        "content-type": "application/xml"
    };
    return msg;

Nick



--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Alexander Muller

unread,
Mar 14, 2016, 11:22:09 AM3/14/16
to Node-RED
Thank you very much!
Reply all
Reply to author
Forward
0 new messages