Execute XPath Activity
The Execute XPath activity enables locating specific elements or attributes within an XML file or string using XPath expressions. It retrieves desired values, allowing for structured data extraction and processing into a dataset.
| Field | Description | Requirement |
|---|---|---|
| File name | Specifies the path to the XML file to be processed. This field is not required if Xml string is provided. | Required |
| Xml string | Provides the XML content directly as a string for processing. If this field is used, the content is parsed to allow operations as a dataset, and the File name field is not required. | Required |
| Xpath expression | Defines the XPath query to reference the desired element or attribute within the XML content. | Required |
| Filter | Determines the type of information to extract from the XPath result. Select ELEMENT for element content or ATTRIBUTE for attribute values. | Required |
| Prefix | Defines a namespace prefix used in the XML file. This is necessary when elements or attributes are part of a namespace. | Optional |
| Uri | Specifies the Uniform Resource Identifier (URI) for the first defined Prefix. | Optional |
| Prefix2 | Defines a second namespace prefix, if multiple prefixes are required for elements in the XML file. | Optional |
| Uri2 | Specifies the URI for the second defined Prefix2. | Optional |
| Prefix3 | Defines a third namespace prefix, if additional prefixes are required. | Optional |
| Uri3 | Specifies the URI for the third defined Prefix3. | Optional |
| Output dataset | Assigns a name to the dataset that will store the results of the XPath execution. | Required |
| Delimiter | Specifies the character used to separate multiple XPath expressions when more than one is provided in the Xpath expression field. | Optional |
Action Types & Examples
Retrieve XPath Result
- Format:
string - Example Result:
storeID
Implementation Examples
Field Setup - File name: C:\Users\Alice\Documents\invoice.xml - Xml string: <string name="string_name">text_string</string> - Xpath expression: //Invoice/Store_ID - Filter: ELEMENT - Prefix: ds - Uri: urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 - Prefix2: cac - Uri2: urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2 - Prefix3: caa - Uri3: urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 - Output dataset: xpathResultDataset - Delimiter: ,
Execution Parameters - fileNameVariable: myInvoicePath - xmlContentVariable: myXmlData
Technical Notes
The File name and Xml string fields are mutually exclusive; only one should be configured. When using a single XPath expression, the Delimiter field must remain empty. If multiple XPath expressions are provided, the Delimiter field must contain the character separating them. In such cases, each XPath expression will serve as a header in the output dataset, with corresponding values populated row by row.