Altova MapForce 2024 Basic Edition

Multiple Sources to One Target

Home Prev Top Next

In this tutorial, you will learn to merge the data from a new file called Library.xml with the data from Books.xml. The result will be a target file called MergedLibrary.xml, which will contain the data from both source files. The target file will be based on the Library.xsd schema. Note that the source files have different schemas. If the source files had the same schema, you could also merge their data using a different approach, described in Multiple Sources to Multiple Targets. The image below represents an abstract model of the data transformation described in this tutorial.

MF_Tut2_MultSourceToOne

The code listing below shows an extract from Books.xml that will be used as the first data source.

 

<books>
  <book id="1">
     <author>Mark Twain</author>
     <title>The Adventures of Tom Sawyer</title>
     <category>Fiction</category>
     <year>1876</year>
  </book>
</books>

 

The code listing below shows an extract from Library.xml that will be used as the second data source:

 

<library>

  <publication>

     <id>5</id>

     <author>Alexandre Dumas</author>

     <title>The Three Musketeers</title>

     <genre>Fiction</genre>

     <publish_year>1844</publish_year>

  </publication>

</library>

 

This is how we want our merged data to look in the target file called MergedLibrary.xml:

 

<library>

  <publication>

     <id>1</id>

     <author>Mark Twain</author>

     <title>The Adventures of Tom Sawyer</title>

     <genre>Fiction</genre>

     <publish_year>1876</publish_year>

  </publication>

  <publication>

     <id>5</id>

     <author>Alexandre Dumas</author>

     <title>The Three Musketeers</title>

     <genre>Fiction</genre>

     <publish_year>1844</publish_year>

  </publication>

</library>

 

To carry out the transformation, take the steps described in the subsections below.

 

© 2017-2023 Altova GmbH