From 4acec0538515f0b356a455858c5f22ebe877cf8e Mon Sep 17 00:00:00 2001 From: ZJ van de Weg Date: Wed, 27 Sep 2023 16:19:05 +0200 Subject: [PATCH] core nodes: XML use case --- src/_includes/core-nodes/XML-use-case.md | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/_includes/core-nodes/XML-use-case.md diff --git a/src/_includes/core-nodes/XML-use-case.md b/src/_includes/core-nodes/XML-use-case.md new file mode 100644 index 0000000000..0499a99c11 --- /dev/null +++ b/src/_includes/core-nodes/XML-use-case.md @@ -0,0 +1,44 @@ +The XML node in Node-RED is a node that can be used to parse and generate XML data. + +The XML node will parse the input to JSON when the input is recognized as XML. +When it's formatted as JSON, the node will output XML. This allows bi-directional +convertion of XML and JSON data, which can be useful for integrating with other systems and services that only support one of these formats. + +The XML core node has generally 2 use-cases: + +* **Parsing and extracting XML data:** The XML node can be used to parse XML data and extract specific elements and attributes. This can be useful for tasks such as reading data from XML files, parsing XML messages from devices, or extracting data from XML (usually SOAP) APIs. +* **Generating XML data:** The XML node can be used to generate XML data from scratch. This can be useful for tasks such as creating XML files, generating XML messages to send to devices, or creating XML documents to be consumed by other systems and services. + +As the node can construct and deconstruct, the modification of XML is an implicit +capability. + +## Examples + +### Parsing XML data + +Providing the following data in the XML node: + +```xml + + + + 25.5 + 65 + 10 + + +``` + +The `XML` node parses the XML data and converts it to JSON. + +```json +{ + "weatherdata": { + "current": { + "temperature": 25.5, + "humidity": 65, + "wind": 10 + } + } +} +```