Customizing the Data Load utility for XML input

This tutorial demonstrates how to customize the Data Load utility to load data from an XML file.

Feature Pack 6 or laterNote: Support for loading XML formatted files with the Data Load utility is provided by default. You do not have to complete this customization to use XML formatted input files with the Data Load utility. For more information about the supported format for Data Load utility input files, see File format for Data Load input files.

If your XML files use a different format than the format that is supported by default, you can use this tutorial to help you create an XML reader that supports the XML format of your files.

In the tutorial "Adding new properties to a WebSphere Commerce service by using the data service layer", you customize the catalog service. The customization adds support warranty information and care instructions for catalog entries. Now, you load the warranty and care instruction information into your target database by using the Data Load utility.

The following diagram shows the data load process flow.

Data load process flow.
  1. The data reader reads the input file, and transforms the input into a data object. Data objects are typically Map objects.
  2. The business object builder instantiates the business object and populates it from the data in the data object.
  3. The business object mediator converts the business object into physical object.
  4. The data writer writes the physical object into the database.

The provided CSV reader reads the input files and creates Map objects. XML files are difficult to represent in a Map object because they have complex structures. In this scenario, you create a reader that builds the logical object directly from the input XML file. Since this reader is creating a logical object, the default business object builder is used. The default business object builder returns the input data object without changing it.

Learning objectives

After completing this tutorial, you should be able to complete the following tasks.
  • Create your XML data reader
  • Configure the Data Load utility to use your data reader and mediator

Time required

This tutorial is expected to take 1 hour to complete.

Skill level

Intermediate

Audience

This tutorial is intended for WebSphere Commerce developers who want to customize the data load utility to read from XML files.

System requirements

Before you begin this tutorial, ensure that you complete the following prerequisites:

Prerequisites

Saving the sample code

Before you begin this tutorial, download the DataLoadSample.zip. Save this file onto your development machine. As an example, you might save it into the WCDE_installdir directory.

Knowledge prerequisites

Before you begin this tutorial, ensure that you have: