Serialization XmlToIon

Serialization XmlToIon

Certified

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.

yaml
type: io.kestra.plugin.serdes.xml.XmlToIon

Convert an XML file to the Amazon ION format.

yaml
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

Source file URI

DefaultUTF-8

The name of a supported charset

Default value is UTF-8.

Definitions
forceListarray
SubTypestring

List of XML tags that must be parsed as lists

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.

Defaulttrue

Whether 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.

Default0

The number of records converted

Formaturi

URI of a temporary result file

Number of records converted