Get Value by XPath

Get Value by XPath

Logic name

Get Value by XPath (Document Mapper/Variable Mapper)

Function

This logic gets values by XPath.

Data types

Location

Type

Input handler

String

Logic output

String

= Hint =

For details, refer to Logic specifications (Document Mapper/Variable Mapper).

Properties

Category

Property

Description

Required settings

XPath expression

Specify the position to get the value by XPath expression.

Comment

Comment

You can write a description of the logic. It doesn't affect the conversion process.

Specification limits

  • This logic can't be used in Document Mapper with table model type of input/output data.

Notes

  • The input handler can only be mapped from the input source element because it specifies the element serving as the processing criteria. It can't be mapped from an attribute, a script variable or a Mapper logic and such.

  • Specify a relative path for XPath expression in case of getting the value associated with the currently processing node in the loop process.

  • When an absolute path is specified in XPath expression, the logic gets a value not from the element specified with the input handler, but from the root element.

Logic sample

Mapping definition

Logic settings and processing result

This logic outputs values from XML data by XPath expression.

Property settings

  • Get Value by XPath [1]

    Property

    Setting

    XPath expression

    data[1]

  • Get Value by XPath [2]

    Property

    Setting

    XPath expression

    .

  • Get Value by XPath [3]

    Property

    Setting

    XPath expression

    /root/element/sample/data[1]

Input data

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <element>
    <sample>
      <data>data1</data>
      <data>data2</data>
    </sample>
    <sample>
      <data>data3</data>
      <data>data4</data>
    </sample>
  </element>
</root>

Output data

data1,data2,data1

data3,data4,data1

 

= Hint =

For a list of logics, refer to Mapper Logic Guide.