--- title: "Parse XML" slug: "core-parse-xml-value" updated: 2026-04-27T08:35:45Z published: 2026-04-27T08:35:45Z canonical: "docs.lobstersoftware.com/core-parse-xml-value" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Parse XML > [!NOTE] > **Value resolver – Abstract** > > **Purpose:** This parses a string or content object into an XML DOM object that can be evaluated with the [Object property](/v1/docs/en/core-property-resolver) resolver via XPath expressions. ![images/download/attachments/201657493/image-2025-2-25_15-2-28-version-1-modificationdate-1740492148571-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-25_15-2-28-version-1-modificationdate-1740492148571-api-v2.png) The [Parse XML](/v1/docs/en/core-parse-xml-value) value resolver requires an XML structure given as a text (`String`) or "content" object as an *input value*, which is then parsed into a DOM object. The overarching data type "XML element" (`org.w3c.dom.Element`), which also applies to all parsed XML elements within a DOM object, is specified in the hint for the DOM object provided as the return value. The [Object property](/v1/docs/en/core-property-resolver) value resolver can be used to access the parsed content, whereby a valid XPath 2.0 expression must be specified in conjunction with the "XML element" data type instead of a path to a data field. Examples: | The screenshot on the right shows a very simple example for which a simple XML structure was entered as static [Text](/v1/docs/en/core-text-value-editor) in the **Entity resolver** of an [Execute with](/v1/docs/en/core-with-actor) event action. - The concatenated [Parse XML](/v1/docs/en/core-parse-xml-value) resolver generates a DOM object from this, which is subsequently used for different accesses. - The concatenated [Object property](/v1/docs/en/core-property-resolver) resolver accesses the second `li` element via the XPath expression `//li[2]]`, which is found when the complete DOM object is searched. - If a corresponding element exists, it is used as a *temporary reference object* for the following *action block*. - "XML Element" appears again as a type hint. - The *action block* contains a [Show alert](/v1/docs/en/freaction-show-alert) event action that displays two contents from the DOM object: - The [Object property](/v1/docs/en/core-property-resolver) resolver in the **Title** uses the XPath expression `//@topic[1]` to search the entire DOM object (`//`) again for an XML attribute `topi`c and returns exactly the attribute value of the first match (`[1]`). - The [Object property](/v1/docs/en/core-property-resolver) resolver for the **Message** begins a similar search relative to the *reference object* (`.`), which is searched completely for the first match (`[1]`) for an attribute with the name SRC. Accessing the attribute value here returns a text value (`reddot.bmp`). **NOTE:** The expressions in this example are aimed at quick, easily comprehensible "success" in the extremely simple setting. The "complete search" for elements in an XML structure using `//` simplifies the expressions considerably in formal terms, but should not be misunderstood as *best practice*. The approach is often too imprecise and can be computationally intensive. | ![images/download/attachments/201657493/image-2025-2-25_18-56-5-version-1-modificationdate-1740506165586-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-25_18-56-5-version-1-modificationdate-1740506165586-api-v2.png) | | --- | --- | ## Configuration The [Parse XML](/v1/docs/en/core-parse-xml-value) resolver does not use any parameters. A number of rules apply to read access to a DOM object via XPath expressions in the [Object property](/v1/docs/en/core-property-resolver) resolver, which will be explained using the example data used above. | Example data that can define a temporary *reference object* in the header of an [Execute with](/v1/docs/en/core-with-actor) (as above), for example. | ![images/download/attachments/201657493/image-2025-2-26_8-45-45-version-1-modificationdate-1740555945524-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_8-45-45-version-1-modificationdate-1740555945524-api-v2.png) | **IMPORTANT:** The *input value* for the [Parse XML](/v1/docs/en/core-parse-xml-value) value resolver must describe a well-formed XML document: - The XML syntax for describing elements, attributes (etc.) must be adhered to exactly. - The structure must be held together by exactly one parent element (*top node*). **CAUTION****:** Errors when parsing the *input value* are treated as an *exception*. The absence of an *input value* is also considered an error. In the context of a workflow, the event action [Try/Catch actor](/v1/docs/en/core-try-catch-actor) can be used to prevent the cancellation with *rollback* that may result. In [Association criteria](/v1/docs/en/core-association-criteria), however, an error during parsing is intercepted with the return value "Failed" (`$false`). | | --- | --- | --- | | **Scenario/Target** | **Configuration** | **Description** | | *No XPath expression.* | ![images/download/attachments/201657493/image-2025-2-26_8-48-1-version-1-modificationdate-1740556081586-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_8-48-1-version-1-modificationdate-1740556081586-api-v2.png) | Without an XPath expression, the [Object property](/v1/docs/en/core-property-resolver) value resolver returns the complete DOM object. The type hint for the return value is "XML element". This means that exactly one (or no) XML element is expected as the return value. | | *Read attribute value.* | ![images/download/attachments/201657493/image-2025-2-26_9-29-7-version-1-modificationdate-1740558547093-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_9-29-7-version-1-modificationdate-1740558547093-api-v2.png) | The XPath expression `@topic` searches the "XML element" expected as *input value* for an XML attribute whose name is exactly (including upper/lower case) `topic` and returns its value. As attributes must be uniquely named, exactly one (or no) return value is expected. The type hint for the return value is `String`. | | *Read all child elements of a type.* | ![images/download/attachments/201657493/image-2025-2-26_9-54-57-version-1-modificationdate-1740560097649-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_9-54-57-version-1-modificationdate-1740560097649-api-v2.png) | The XPath expression `li` searches in the "XML element" expected as *input value* (*here*: the *top node* `ul`) for direct child elements whose name is exactly (including upper/lower case) `li`, and returns these as a list. If no elements with the name you are looking for exist, an empty list (`[]`) is returned. The type hint for the return value is `XML Element[]`. | | *Read one child element of a type.* | ![images/download/attachments/201657493/image-2025-2-26_11-8-41-version-1-modificationdate-1740564520938-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_11-8-41-version-1-modificationdate-1740564520938-api-v2.png) | The XPath expression `li[1]`searches in the "XML element" expected as *input value* (*here*: the *top node* `ul`) for direct child elements whose name is exactly (including upper/lower case) `li`, and returns the first match. Instead of `1`, a different index value (ascending from 1) can be used. If there is no match with the addressed index, "no value" (`$null`) is returned. The type hint for the return value is `XML Element`. | | *Read selected child elements of a type.* | ![images/download/attachments/201657493/image-2025-2-26_16-13-21-version-1-modificationdate-1740582801677-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_16-13-21-version-1-modificationdate-1740582801677-api-v2.png) | The XPath expression `li[1]` searches in the "XML element" expected as *input value* (here: the top node `ul`) for direct child elements whose name is exactly (including upper/lower case) `li` and returns the subset of `li` elements that have at least one child element with the name `img`. In the sample data, all `li` elements fulfill this condition. The type hint for the return value is `XML Element[]`. | | ![images/download/attachments/201657493/image-2025-2-26_16-43-59-version-1-modificationdate-1740584639330-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_16-43-59-version-1-modificationdate-1740584639330-api-v2.png) | The XPath expression `li[img[starts-with(@SRC,"red")]]` searches in the "XML element" expected as *input value* (*here*: the *top node* `ul`) for direct child elements whose name is exactly (including upper/lower case) `li`, and returns the subset of `li` elements that have at least one child element with the name img whose `SRC` attribute contains a text value that begins with the `red` character string. In the sample data, exactly one `li` element fulfills this requirement. It is returned as the only entry in a list. The type hint for the return value is `XML Element[]`. | | *Search for all elements of a type and read a specific attribute value from each one.* | ![images/download/attachments/201657493/image-2025-2-26_17-15-12-version-1-modificationdate-1740586512422-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_17-15-12-version-1-modificationdate-1740586512422-api-v2.png) | The XPath expression `//img/@SRC` searches in the "XML element" expected as *input value* (*here*: the *top node* `ul`) for directly or indirectly contained child elements whose name is exactly (including upper/lower case) `img`, and outputs the text value of the `SRC` attribute for each element. `img` elements that do not have an `SRC` attribute are skipped (not relevant in the example). The type hint for the return value is `String[]`. | | *Search for all elements of a type for which the value of any attribute contains a text.* | ![images/download/attachments/201657493/image-2025-2-26_17-28-25-version-1-modificationdate-1740587305531-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_17-28-25-version-1-modificationdate-1740587305531-api-v2.png) | The XPath expression `//img/@SRC` searches in the "XML element" expected as *input value* (here: the top node `ul`) for directly or indirectly contained child elements whose name is exactly (including upper/lower case) `img` and which have at least one attribute with any name (`@*`) whose value contains the text "dot". `img` elements that do not have an attribute with the searched substring are skipped. In the example, all `img` elements are returned. The type hint for the return value is `XML Element[]`. | | *Search for elements of any type that have an attribute whose name corresponds to a text pattern.* | ![images/download/attachments/201657493/image-2025-2-26_17-42-28-version-1-modificationdate-1740588148049-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_17-42-28-version-1-modificationdate-1740588148049-api-v2.png) | The XPath expression `//*/@*[ends-with(name(),"c")]`searches all elements in the "XML element" expected as *input value* (including the *top node*) for those that have at least one attribute whose name (`name()`) contains a "c" as the last character. In the example, this only applies to the *top node* (`ul` with the `topic` attribute), which is returned as the only entry in a list. The type hint for the return value is `XML Element[]`. | | ![images/download/attachments/201657493/image-2025-2-26_17-46-29-version-1-modificationdate-1740588389662-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_17-46-29-version-1-modificationdate-1740588389662-api-v2.png) | The XPath expression `//*[@*[ends-with(lower-case(name()),"c")]]` searches all elements in the "XML element" "XML element" expected as *input value* (including the *top node*) for those that have at least one attribute whose name (`name()`) contains a "`c`" or a "`C`" as the last character. In the example, this applies to the *top node* (with the `topic` attribute) and all `img` elements (each with an `SRC` attribute), which are returned as a list. | | **The following examples use sample data in which the XML structure contains text nodes** | | Read text from an element. | ![images/download/attachments/201657493/image-2025-2-26_18-20-42-version-1-modificationdate-1740590442429-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_18-20-42-version-1-modificationdate-1740590442429-api-v2.png) | The XPath expression `text()`searches the "XML element" expected as *input value* for text nodes and returns the first text value found. Only the character string "`SEND` " (without inverted commas) is returned with the sample data. The type hint for the return value is `String`. | | ![images/download/attachments/201657493/image-2025-2-26_18-22-23-version-1-modificationdate-1740590543331-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_18-22-23-version-1-modificationdate-1740590543331-api-v2.png) | The XPath expression `/a/text()`searches the "XML element" expected as *input value* for text nodes and returns all text values that are contained directly in the *node* (*here*: `a` element). The sample data returns a list with the character strings "`SEND` " and " `NOW`" (without inverted commas) is returned. The type hint for the return value is `String[]`. | | ![images/download/attachments/201657493/image-2025-2-26_18-26-9-version-1-modificationdate-1740590769328-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-2-26_18-26-9-version-1-modificationdate-1740590769328-api-v2.png) | The XPath expression `/a/text()`searches the "XML element" expected as *input value* for text nodes and returns all text values that are contained directly or indirectly in the *top node* (*here*: `a` element). With the sample data, a list with the character strings`"SEND ", "EMAIL", " NOW"` (without inverted commas) is returned. The type hint for the return value is `String[]`. |