--- title: "Extract data from XML by Tag" slug: "extract-data-from-xml-by-tag" description: "This article demonstrates how to extract data from a specific tag in an XML file by using a Flow." updated: 2024-01-05T13:54:29Z published: 2024-01-05T13:54:29Z canonical: "documentation.decisions.com/extract-data-from-xml-by-tag" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Extract data from XML by Tag Example Lab Article While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released. --- ## Overview | ## Example Lab Details | | --- | | **Version** | 6.10.2 | | **Root Folder** | XmlValue | | **Modules** | None | | **Dependencies** | None | This example will show you how, from an XML file, you can extract data from a specific tag within a Flow. --- ## Explanation Create a new Flow and name it "Extract Text from XML Tag." On the Start Step, add two inputs; XML Tag as a string and XML as FileData. ![Capture.PNG](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/Capture.PNG) In the steps catalog navigate to Data > Text and drag the "Get String From Bytes" Step onto the canvas and connect the Start Step to it. For the inputs, choose Select From Flow and choose "XML.Contents." This is a byte array that contains the XML data. ![image.png](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image%287%29.png) Next in the steps catalog under Data > Text, drag out the "Extract Text From Text" Step and connect "Get String From Bytes" to it. Cofigure the inputs as follows; ![image.png](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image%288%29.png) To ensure that what we have done is working, lets create a simple form to view the results. In the Steps Catalog, navigate to Forms [Interatcion] and drag "[Pick or Create Form]" onto the canvas and attach "Extract Text from Text" to it. Then create a new form by clicking on the new Form Step and choosing "Pick or Create Form" at the top left in the Properties panel. In the pop up name your Form "Show Form" and click Create. At the top add in a Text Area and Change the Data Name to "Block" and resize so you can view all of the XML. Then add a Text box below it so we can view the extracted data and change the Data Name to Block. Save and close the form. Back in the Flow Editor for inputs on the Form, Block will be "Seclect From Flow" and we will select "GetStringFromBytes_Output". For Out, choose "Seclect From Flow" and we will select "ExtractTextFromText1_Output". ![image.png](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image%289%29.png) Now we are ready to test our Flow. Choose Debug at the top, On the right you will need to choose, or drag, an XML file to be worked by the Flow. Under XML Tag, type in a tag that exists in your XML (Please Note: if the tag does not exist in your XML, this flow will fail) and click "Run Capturing All" at the bottom and view the results in the form. ![image.png](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image%2811%29.png) ![image.png](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image%2810%29.png) Reference Articles None --- ## Project Download The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 6.10.2 or later using our [Importing/Exporting](https://documentation.decisions.com/docs/importing-and-exporting-projects) article. ---