XML Reader XPath Filter

Hi,

I’m trying to use the XPath filter in the XML Reader node but it keeps on returning an empty table. I’ve attached the XML file. Currently I’m using the file for testing but it will grow in size so I want to use the filter option to only read certain parts. I cannot find an example that shows how to configure the node. I think it has to do with the namespaces since when I remove them I can use the filter and it works. But with the namespaces I only get an empty table.

I cannot remove the namespaces as it is a file that will be downloaded from a 3rd party and I do not have control of what goes into the XML file.

CurrentTenements.xml (160.3 KB)

Hi Willem,

I’ve made a small workflow in which your XML file is read and some parts are filtered out using the XPath node.
Configuring an XPath node is not very difficult, but you might need several nodes to achieve what you want. So something like this (you can find it in the workflow as well).

afbeelding

In each node you:

  • choose correct XML column
  • double click on the tag(s) you want to extract
  • Click Add XPath
  • Specify the query options, and when you choose as type ‘Node cell’ with multiple rows you will get new XML columns in the output which you can later split in additional details in a next Node.

xml_xpath_example.knwf (11.7 KB)

Hope this helps you further.

Kind regards,
Jan

4 Likes

Thanks JanDua,

I’ve got the workflow working using XPath, but was trying to get the XML Reader to work with the filter option in it. When I edit the XML and remove the namespace then I can specify the XPath filter. But when the namespaces are in the file it doesn’t work. Was wondering if there is a way to get the XPath Filter to work with my file.

Sorry, I didn’t understand you wanted to use the XPath-query within the XML-reader.

I just tried the following:

This reads just the part of the XML for the two tenents in your example XML.

I guess you can choose any tag which gives you an XML as output, like the ones you specify in the XPath-node with data type Nodeset.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.