XML data format

The data to be loaded using the XMLLoader scripts must be created in the form of XML elements: one for each data object. The form of the XML elements closely matches the structure of the data object: The name of the top-level element is the name of the data object and each child element corresponds to a data field or child data object of the data object.

The top-level element has these attributes:

  • A state attribute: set this value to “INSERTED” when you are creating new data. You can use the value “MODIFIED” if you are modifying an existing data object using the XML data loader.
  • A type attribute: set this value to “BusinessObject”.

You can use a list data object to act as a container for a list of data objects to be loaded. You must provide a value for each element that is declared as mandatory in the data object definition.

The XMLLoader script essentially sets a classpath and then invokes an XMLLoader class, passing it parameters for the location of the Comergent.xml file, the operation (usually “persist”), the partner name (usually “matrix”), and a list of one or more files of data to be loaded.

The files must be in one of the following forms:

  • Either a set of XML elements: the root element must be named DataObjectData. For example:
    
    <PromotionData>
          <!--Record 1 ----------------------------------------------->
          <Promotion state="INSERTED" type="BusinessObject">
             <PromotionKey state="INSERTED">126</PromotionKey>
             <PromoCode state="INSERTED">ID 360</PromoCode>
             <PromotionName state="INSERTED">Packages</PromotionName>
             ...
          </Promotion>
          <!--Record 2 ----------------------------------------------->
          <Promotion state="INSERTED" type="BusinessObject">
             <PromotionKey state="INSERTED">127</PromotionKey>
             <PromoCode state="INSERTED">ID 3837</PromoCode>
             ...
          </Promotion>
          ...
    </PromotionData>
    
  • Or each file can point to a list of files:
    
    WEB-INF/xmldata/ProductCategoryList
    WEB-INF/xmldata/ProductList
    ...
    

By convention, the files that provide lists of other files have the suffix “lst”.