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. Scalar text values keep their XML lexical form when they would otherwise be corrupted by numeric coercion (e.g. 25E2568 is not mistaken for scientific notation and overflowed to Infinity); see parserConfiguration to control number/boolean typing explicitly.

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.

Controls how repeated elements and scalar text values are typed. By default, values that look numeric or boolean (e.g. true, 12.5) are converted to the matching ION type, except when doing so would silently corrupt the value — for example 25E2568 looks like scientific notation but is far outside the range of a double, so it is kept as the string "25E2568" instead of becoming Infinity.

Definitions
forceListarray
SubTypestring

List of XML tags that must be parsed as lists

forceStringarray
SubTypestring

List of XML tags that must always be kept as strings

Element and attribute names listed here are never converted to a number or a boolean, regardless of their text content. Use this for identifiers that happen to look numeric (lot numbers, SKUs, ZIP codes) so they never get reformatted. Namespaced elements must be prefixed the same way they appear in the source XML (e.g. ns: code).

keepBooleanAsStringbooleanstring
Defaultfalse

Whether to keep every boolean-looking value as a string

When true, true/false text values are never converted to an ION boolean. forceString still takes precedence for the names it lists, this flag only widens the same behavior to every element and attribute. Default value is false.

keepNumberAsStringbooleanstring
Defaultfalse

Whether to keep every numeric-looking value as a string

When true, no scalar text value is ever converted to an ION number. forceString still takes precedence for the names it lists, this flag only widens the same behavior to every element and attribute. Default value is false.

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