
Serialization XmlToIon
CertifiedConvert an XML file to the Amazon ION format
Serialization XmlToIon
Convert an XML file to the Amazon ION format
Without a query, the whole document is inspected: if the root element has exactly one repeated, complex child element (e.g. <catalog><book>...</book><book>...</book></catalog>), each occurrence of that child becomes its own flat ION record — this also applies when there is only a single occurrence, so the output shape does not depend on record count. Otherwise, the whole document is parsed into a single nested ION record. Set unwrapRootCollection to false to always get a single nested record. When query is set (e.g., /catalog/book), uses StAX streaming to extract each matching element as a separate ION record — suitable for large files. External entity resolution is disabled for security.
type: io.kestra.plugin.serdes.xml.XmlToIonExamples
Convert an XML file to the Amazon ION format.
id: xml_to_ion
namespace: company.team
tasks:
- id: http_download
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/xml/products.xml
- id: to_ion
type: io.kestra.plugin.serdes.xml.XmlToIon
from: "{{ outputs.http_download.uri }}"
Properties
from *Requiredstring
Source file URI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}.
charset string
UTF-8The name of a supported charset
Default value is UTF-8.
parserConfiguration Non-dynamic
XML parser configuration
List of XML tags that must be parsed as lists
query string
Path selector to stream matching elements from the XML file
When set, uses StAX streaming to extract elements matching the given path
(e.g. /catalog/book). Each matching element is written as a separate ION record.
When not set, the root's single repeated child element (if any) is unwrapped into
separate ION records; see unwrapRootCollection.
unwrapRootCollection booleanstring
trueWhether to unwrap the root element's repeated child into individual records
Only used when query is not set. When the root element has exactly one distinct, complex child element name (an element with attributes or child elements of its own) and no meaningful text of its own, each occurrence of that child is written as a separate, flat ION record — regardless of whether there is one occurrence or several, so the output shape is stable. Set to false to always parse the whole document into a single nested ION record instead. This is useful for config-shaped XML such as <config><database><host>x</host></database></config>, which is structurally ambiguous with a one-record collection and would otherwise lose the database nesting level. Default value is true.
Outputs
size integer
0The number of records converted
uri string
uriURI of a temporary result file
Metrics
records counter
Number of records converted