Home
About
Search
Welcome to M-Files Empower – our new support experience. We'd love to hear what you think!Give feedback
Home/Support and troubleshooting/Examples and how to

Simple XPATH example for M-Files External File Source

Last updated on 17 June 2021

Admin
Connections to External File Sources (Integrated)

Overview

It can be sometimes difficult to define XPATH expressions when using M-Files external file sources to read XML files. This document gives very basic example which kind of XPATH can be used to read a specific field from XML file.

Solution

M-Files external file sources can be used to read documents to M-Files from specific folders. This is explained in user manual: https://www.m-files.com/user-guide/2018/eng/Connections_to_external_sources_File_sources.html

There can be used XML files for metadata:

https://www.m-files.com/user-guide/2018/eng/Connection_to_external_database_metadata.html

If your XML file is e.g. like this:

<?xml version="1.0" encoding="utf-8"?>

<Example version="8.8.1">

  <FirstLevel>

    <Transaction>

      <Money>1234</Money>

      <ActionCode>76</ActionCode>

      <Details>

        <TargetDate>2019-06-14</TargetDate>

      </Details>

    </Transaction>

  </FirstLevel>

</Example>

You can read field "Money" with XPATH expression to Integer property:

//*//*//*//*[local-name()='Money']

So in your definitions, it would look like this:

Keywords

M-Files, XPATH, external file sources

Still need help?