Creating data in XML format
You can create data that you want to load into your database with the Data Load utility in an XML formatted file. This XML file must follow a specific XML format, which is similar in structure and content to the supported CSV format for loading catalog data.
Before you begin
About this task
If you choose to create and use an XML formatted file, ensure that your file uses the CSV column names as the XML element names and uses a CSV-like file structure. Your file must also specify a keyword to associate the business object you are loading with a mediator and separate individual objects of a business object type within different elements. You must also configure the utility to use the XML data reader instead of the CSV data reader which is the default data reader. For more information about configuring the XML data reader, see Configuring the XML data reader.
<?xml version="1.0" encoding="UTF-8"?>
<Catalogs loadItemName="Catalog">
<Catalog Delete="0">
<Identifier>Spring Fashions</Identifier>
<MasterCatalog>FALSE</MasterCatalog>
<Description>Spring Fashions</Description>
<Name>Spring Fashions</Name>
<ShortDescription>Spring Fashions</ShortDescription>
<LongDescription>Fashions for the Spring season</LongDescription>
</Catalog>
<Catalog Delete="0">
<Identifier>Fall Fashions</Identifier>
<MasterCatalog>FALSE</MasterCatalog>
<Description>Fall Fashions</Description>
<Name>Fall Fashions</Name>
<ShortDescription>Fall Fashions</ShortDescription>
<LongDescription>Fashions for the Fall season</LongDescription>
</Catalog>
</Catalogs>
- The first line in the preceding example identifies the file that you are loading as an XML file.
- The second line is the root element and contains the keyword that corresponds to the catalog
business object type to upload. For example, you can specify the
Catalog
keyword for loading a catalog, or theCatalogEntry
keyword for loading catalog entries. You must specify the business object keyword as theloadItemName
at this root level. The keyword is case-sensitive. - The third line is an example of a second-level element that identifies the objects that are being loaded. For example, the preceding code identifies that a catalog object is being loaded. Identify each object that you are loading in your file at this level. For example, in the preceding code, two catalog objects are being loaded, a Spring Fashions catalog and a Fall Fashions catalog. If you are deleting objects with this file, you can identify whether an object is to be deleted at this level. If the value for the Delete attribute is 1, the catalog object is to be deleted. If the value for the Delete attribute is 0, the catalog object is not to be deleted. If you do not specify a value for the Delete attribute, the value defaults to 0. You can also specify Delete as an element nested within the object element.
- The elements that are nested within the second level (object) elements contain the object
information. For example, the object
Identifier
orShortDescription
. Within these XML elements, the corresponding value for the catalog object that is being loaded must be included. The names of the object information elements are case-sensitive and must match the CSV column names for the same business object type. The elements must be unique for each object that you are loading with an XML file. For example, you cannot include twoShortDescription
elements nested within an object. You can include the information for an object that you are loading as XML elements nested with the object element, or as attributes within the object element. If you are adding your object information as attributes, these XML attributes must be included in the following format:
Where<object attribute="attribute_value">
object
is the object that you are loading, andattribute
is the name of the attribute that you are loading. For example,<Catalog Identifier="Spring Fashions">
Procedure
- Open an XML or text editor.
-
In the first line of your file, add the following code to define your file as an XML
file:
<?xml version="1.0" encoding="UTF-8"?>
-
After the line that defines your file as an XML file, specify an element
for the business object type that you are loading information about. You must specify this object
type in the root element for your file by specifying the keyword for the business object. In this
element, you must include an element name that distinguishes your root element from other elements
within your file.
This root element must be specified with the following format:
Where elementName is the distinguishing name for the root element, and keyword is the keyword that is used to identify the business object type that you are loading.<?xml version="1.0" encoding="UTF-8"?> <elementName loadItemName="keyword"> </elementName>
For example, the following element is used to specify that a file contains catalog data.<?xml version="1.0" encoding="UTF-8"?> <CatalogObjects loadItemName="Catalog"> </CatalogObjects>
Note: TheloadItemName
declaration is required in files that are being upload with Management Center and optional for files that are loaded with the Data Load utility. As a best practice, include this declaration. By including theloadItemName
declaration, your file can be loaded with both the Data Load utility or Management Center without requiring you to add theloadItemName
declaration later.When you are specifying a keyword, select one of the following keywords. These keywords are case-sensitive, so ensure that you type the keyword exactly as shown:Attachment
AttachmentAsset
AttachmentAssetLanguage
AttachmentDescription
AttributeDictionaryAttributeAllowedValues
AttributeDictionaryAttributeAndAllowedValues
AttributeDictionaryAttributeFolderRelationship
Catalog
CatalogDescription
CatalogGroup
CatalogGroupAsset
CatalogGroupAssociation
CatalogGroupAttachment
CatalogGroupCalculationCode
CatalogGroupDescription
CatalogGroupRelationship
CatalogGroupSEO
CatalogEntry
CatalogEntryAsset
CatalogEntryAssociation
CatalogEntryATPInventory
CatalogEntryAttachment
CatalogEntryAttributeDictionaryAttributeRelationship
CatalogEntryCalculationCode
CatalogEntryComponent
CatalogEntryDescription
CatalogEntryDescriptiveAttributeAndValue
CatalogEntryDescriptionOverride
CatalogEntryDescriptionUpdate
CatalogEntryInventory
CatalogEntryOfferPrice
CatalogEntryParentCatalogGroupRelationship
CatalogEntryParentProductRelationship
CatalogEntrySEO
CatalogEntryUpdate
CatalogFilter
CatalogFilterCategory
CatalogFilterCatentry
CatalogFilterCondition
CatalogFilterConditionGroup
ListPriceList
MarketingActivity
MarketingCampaign
MarketingContent
MarketingContentAttachment
MarketingContentAttachmentDescription
MarketingContentDescription
MarketingContentImageMap
MarketingElement
MarketingElementNVP
MarketingSpot
MarketingSpotDefaultContent
MarketingSpotDefaultTitle
MemberGroup
MemberGroupCondition
MemberGroupDescription
Offer
ProductDefiningAttributeAndAllowedValues
SKUDefiningAttributeValue
-
Following the line that defines the object type that your loading, specify the object that you
are loading. Specify the object within an element that is nested within your root element.
For example,
<?xml version="1.0" encoding="UTF-8"?> <CatalogObjects loadItemName="Catalog">
<Catalog>
</Catalog>
</CatalogObjects> -
Add the information for the object that you are loading. You can add this information as
elements or as attributes in the element that specifies the object that you are loading.
These attributes or elements must use the specific XML element name for the object. These names are the same as the CSV column names and are case-sensitive. You must enter these names exactly as they appear in the appropriate CSV column and XML element definitions topic. If you are adding custom information, you must enter the attribute or element names to be the same as the name in the corresponding mediator that maps the information to the correct location in the business object noun.
- If you are adding your object information in XML elements, nest these elements within the object
element you defined in the previous step. For
example:
<Catalog>
<Identifier>Spring Fashions</Identifier>
<MasterCatalog>FALSE</MasterCatalog>
<Description>Spring Fashions</Description>
<Name>Spring Fashions</Name>
<ShortDescription>Spring Fashions</ShortDescription>
<LongDescription>Fashions for the Spring season</LongDescription>
</Catalog> - If you are adding your object information as attributes, these XML attributes must be included
in the following format:
Where<object attribute="attribute_value">
object
is the object that you are loading, andattribute
is the name of the attribute that you are loading. For example,<Catalog Identifier="Spring Fashions">
You can also include an element or attribute that specifies the sequence or delete value for the object. For example,- Attribute
<CatalogEntry Sequence="1.0" Delete="0">
- Element
<Delete>0</Delete>
You can set the delete value to be
1
or0
. If you set the value to1
, then the object is deleted. If you specify the value as0
, or omit the value, the value defaults to0
and no deletion occurs.Note: Working with element and attribute values:For more information, see Configuring the XML data reader.You can use either elements or attributes to add data to be loaded. Typically, they are loaded the same by using either method. However, they are loaded differently when the value is empty.
For example, for a catalog entry, you can specify the Name use element:
Or, you can use an attribute:<CatalogEntry> <Name>Spring Fashions</Name> </CatalogEntry>
The preceding samples are equivalent when loading. However, if the value for the Name is empty, it is handled differently by the XML handler. That is, the following samples are handled differently:<CatalogEntry Name="Spring Fashions"> </CatalogEntry>
<CatalogEntry> <Name></Name> </CatalogEntry>
<CatalogEntry Name=""> </CatalogEntry>
By default, all elements with empty values are treated as null. However, attributes with empty values are treated as empty values. That is, the value is null in the database if you use an element for Name, and the value is empty in the database if you use an attribute for Name. This default behavior can be changed by using the following optional configuration properties.- ignoreEmptyElementText
- If set to false, empty elements are treated as empty values. The default value is true.
- ignoreEmptyAttributeValue
- If set it to true, empty attribute values are treated as null. The default value is false.
<DataReader>
element,<LoadItem>
element, or<LoadOrder>
element as:<_config:property name="ignoreEmptyElementText" value="false" />
- If you are adding your object information in XML elements, nest these elements within the object
element you defined in the previous step. For
example:
- Optional:
Repeat steps 4 and 5 to add information for more objects within your file. Each object must be
specified within a separate XML element. Do not nest your objects deeply. Nest the element for each
object you are including directly within your root element.
For example, to include three catalog objects within a file, your file can resemble the following code:
<CatalogObjects loadItemName="Catalog"> <Catalog> <Identifier>Spring Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Spring Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Spring Fashions</ShortDescription> <LongDescription>Fashions for the Spring season</LongDescription> </Catalog> <Catalog Delete="0"> <Identifier>Summer Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Summer Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Summer Fashions</ShortDescription> <LongDescription>Fashions for the Summer season</LongDescription> </Catalog> <Catalog Delete="0"> <Identifier>Fall Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Fall Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Fall Fashions</ShortDescription> <LongDescription>Fashions for the Fall season</LongDescription> </Catalog> </CatalogObjects>
-
Save and close your file.
Your completed file can resemble the following code:
<?xml version="1.0" encoding="UTF-8"?> <CatalogObjects loadItemName="Catalog"> <Catalog> <Identifier>Spring Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Spring Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Spring Fashions</ShortDescription> <LongDescription>Fashions for the Spring season</LongDescription> </Catalog> <Catalog Delete="0"> <Identifier>Summer Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Summer Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Summer Fashions</ShortDescription> <LongDescription>Fashions for the Summer season</LongDescription> </Catalog> <Catalog Delete="0"> <Identifier>Fall Fashions</Identifier> <MasterCatalog>FALSE</MasterCatalog> <Description>Fall Fashions</Description> <Name>Spring Fashions</Name> <ShortDescription>Fall Fashions</ShortDescription> <LongDescription>Fashions for the Fall season</LongDescription> </Catalog> </CatalogObjects>