Man illustrationFlower illustration

Docy

Execute xpath

Estimated reading: 6 minutes 95 views

Execute xpath activity allows reaching the location of each element or attribution in the .xml file via Xpath and getting desired values.


*File nameIt is the full directory path, where the file is located, and the file name with its extension.
*Xml stringIf this field is used, File name field don’t need to be used. If Web API result is received in XML format, not file with XML content, XML content is written as string expression to reach Web API XML content using the activities in XML files. If this field is used, there is no need to use the File name field. Other fields, Prefix etc. XML is written to parse the content. Then, it is ensured that operations can be performed as a dataset.
*Xpath expressionThe Xpath of which element/attribute to be referenced is referenced and the information related to element or attribute is selected by using Filter field.
*FilterThe information type (element/attribute) to be accessed within Xpath is entered. In the dropdown menu, 2 information type (element/attribute) is selected.
PrefixThis is the area where prefixes are defined when using the elements in the XML file. In case more than one prefix is needed, other prefix fields are filled.
UriTo define the first prefix, URI of the prefix is provided here.
Prefix2This is the area where prefixes are defined when using the elements in the XML file.
Uri2To define prefix2, URI of the prefix is provided here.
Prefix3This is the area where prefixes are defined when using the elements in the XML file.
Uri3To define first prefix3, URI of the prefix is provided here.
*Output datasetDataset name of the returned xpath execution.
Note: * Fields selected with are required, others are optional

You can use the File name as shown in the example.

C:\Users\Alice\Documents\invoice.xml

You can use the Xml string as shown in the example.

<string name=”string_name” >text_string </string>

You can use the Xpath expressions shown in the example.


<? Xml version = “1.0” encoding = “UTF-8”?>
<Invoice>
<Return_ID>135672</Return_ID>
<Store_ID>23465</Store_ID>
<Store_Name>BELGE</Store_Name>
<Supplier_Name>Third Part Company</Supplier_Name>
<Supplier_Account_No>7330028047</Supplier_Account_No>
<Brand_ID>14235</Brand_ID>
</Invoice>
Let’s consider a file with .xml extension that has XML content in this way. Let’s want to access the Store_ID element in the tree structure in the file. The Xpath Statement to be written for this would be as follows:

//Invoice/Store_ID

You can use the Filter as shown in the example.

ELEMENT

Let’s use the XPath specified in the example above. This Xpath takes us to the Store_ID element in the tree structure. That is, the address of an element to be reached with XPath. Thus, ELEMENT is selected from the combobox.

You can use the Prefix shown in the example.

ds:Reference

Based on the XML file content above, this field is not filled because there is no prefix for the elements in the .xml file. The prefix is specified in an xml file as follows:
<ds:Reference Id=”Reference-Id-28eeffb3-146c-4a8a-9e12-19541d39ee0e” URI=””>. The prefix of the Reference element in this expression is ‘ds’.

You can use the Prefix2 shown in the example.

cac:AdditionalDocumentReference

Based on the XML file content above, this field is not filled because there is no prefix for the elements in the .xml file. The As in the above mentioned ‘Prefix’ example, if there is another prefix like “ds”, a prefix is written in this field again. Xpath information also varies according to usage.
<cac:AdditionalDocumentReference>
<cbc:ID>0.00</cbc:ID>
<cbc:IssueDate>2020-03-18</cbc:IssueDate>
<cbc:DocumentType>ALLOWANCETOTALAMOUNT</cbc:DocumentType>
</cac:AdditionalDocumentReference>
As can be seen in this example, different prefixes (prefixes) can be included in the .xml file.

You can use the Prefix3 shown in the example.

caa:Username

Suppose that the file specified in the prefix2 example also has a field like the following:
<caa:Username>john.smith</cbc:DocumentType>
If you want to reach this field in the XML file, in addition to the cac and cbc prefixes, the caa prefix is also introduced in this field; Prefix3: becomes caa.

You can use the URI as shown in the example.

urn: oasis: names: specification: ubl: schema: xsd: CommonAggregateComponents-2

The prefix contains Uri information in the .xml file.
xmlns: cac = “urn: oasis: names: specification: ubl: schema: xsd: CommonAggregateComponents-2”, the area to the left of the equation and in quotes contains the Uri information. When writing the expression Uri, the part between the double quotes is written:
It is shown as urn: oasis: names: specification: ubl: schema: xsd: CommonAggregateComponents-2.

You can use the URI2 as shown in the example.

urn: oasis: names: specification: ubl: schema: xsd: CommonAggregateComponents-2

The prefix contains Uri information in the .xml file.
The field specified in the expression xmlns: ext = “urn: oasis: names: specification: ubl: schema: xsd: CommonExtensionComponents-2”, to the left of the equation, and in quotes contains the Uri information. When writing the expression Uri, the part between the double quotes is written:
It is shown as urn: oasis: names: specification: ubl: schema: xsd: CommonExtensionComponents-2.

You can use the URI3 as shown in the example.

urn: oasis: names: specification: ubl: schema: xsd: CommonAggregateComponents-2

or Prefix3 defined above, Uri information similar to Uri and Uri2 is written in the specified format.

You can use the Output dataset as shown in the example.

outputvalue

CONTENTS