XML Activities
Version: 1.0.0 · ID: zoan-packages-xml · Author: Zoan Software
The XML package reads, queries and modifies XML documents, a data exchange format widely used in integrations (electronic billing, SOAP web services, configurations, healthcare files). It allows you to extract data from an XML and modify it without having to parse the text by hand.
How this package works
Section titled “How this package works”Activities work on XML text (a string), not on an open file. The typical pattern is:
- Read XML reads the file and returns its contents as string.
- You query values with XML Query Text / XML Query All, or modify them with XML Set Value / XML Add Element (which return the modified XML).
- Write XML saves the result to a file.
Read XML path = = ruta → output: xmlXML Query Text xml = = xml xpath = "//Factura/Total" → output: totalXPath in a scoop
Section titled “XPath in a scoop”| XPath | Select |
|---|---|
//Numero | All <Numero> items at any level |
//Factura/Numero | The <Numero> direct children of <Factura> |
//Factura[@id='5'] | The <Factura> with attribute id="5" |
//Item[2] | The second <Item> |
Activities
Section titled “Activities”| Activity | Type | Output | What it does |
|---|---|---|---|
| Read XML | xml-read | string | Read an XML file as text |
| Write XML | xml-write | string | Save XML text to a file |
| XML Query Text | xml-query-text | string | First value that matches an XPath |
| XML Query All | xml-query-all | List | All values that match |
| XML Set Value | xml-set-value | string | Change the value of an element |
| XML Add Element | xml-add-element | string | Add a child element |
Next steps
Section titled “Next steps”- Read XML — read an XML file.
- XML Query Text — extract data with XPath.
- JSON — for data in JSON format.