Reading simple XML files

PEDI has a step named Get XML Data used to read XML structures. This recipe shows how to read an XML file containing information about museums using this step.

Getting ready

In this exercise, you will use a file named museum.xml with the following structure:

<museums>
   <museum id_museum= '…'>
      <name>…</name> 
      <city>…</city>
      <country>…</country> 
   </museum>
</museums>

We will be making use of Path, which is used to query XML documents to retrieve and compute information. If you are new to Path, it is recommended to check out the excellent tutorials over at http://www.w3schools.com/xpath/ to get a better understanding of Path before digging into the recipe.

How to do it...

Perform the following steps:

  1. Create a new transformation.

Get Pentaho Data Integration Cookbook Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.