CML (PIM7)

Last modified by prodexa Admin on 24.02.2021, 21:11

General info

CML (Command Markup Language) is the common format that is used by jCatalog PIM (version 6+7) to store information about Product data. It is a XML based format and
 the main purpose is the support for import/export issues.

Import/Export of other formats (such as BMECat, CSV, etc) will be supported through transformation into/from CML, i.e. the import of the BMECat format will look like

 
          transformation
BMECat --------------------> CML ---> DB
           through XSLT
                      transformation
Excel ----> FlatML --------------------> CML ---> DB
                       through XSLT

CML also can be used to transform one file format into another without accessing the database, i.e.

          transformation          transformation
BMECat --------------------> CML -----------------> CSV
           through XSLT             through XSLT

CML can be used as well directly for the search index creation.

       unmarshalling                      Compass+Lucene
CML  ------------------> BusinessObjects -------------------> Search Index

Basic structure of CML

Sample CML file:

<?xml version="1.0" encoding="UTF-8"?>
<CML>
 <Context>
   <Supplier id="1234"></Supplier>
 </Context>
 <Command mode="insert">
   <Product id="4711">
     <AttributeValues>
       <AttributeValue attributeId="ShortDescription" languageId="de">Produktname</AttributeValue>
       <AttributeValue attributeId="ShortDescription" languageId="en">product name</AttributeValue>
     </AttributeValues>
   </Product>
 </Command>
</CML>

More Examples For Object Representation In CML are available.
 As you can see, every CML file can be divided into two main parts: Context and list of Commands.

Context

Context contains some default values (ProductCatalog, Contract, Supplier, Classification) as well as meta information (Header) about the CML file itself.

<Context>
   <Header>
     <Description>CML file from sample format</Description>
     <Generator>jCatalog</Generator>
   </Header>
   <Supplier id="1234"></Supplier>
   <ProductCatalog id="456"></ProductCatalog>
   <Contract id="standard" ></Contract>
</Context>

E.g. the following objects are supported in the context:

  • Contract
  • ProductCatalog
  • Supplier
  • Customer
  • Classification

Merge mode

The Merge mode is an additional element is allowed in the CML/Context, that controls how '1 to many'-related objects will be treated in an update command.

Commands

Command has two attributes: key and mode and should contain exactly one element (the object this command operates on) inside it.

mode is required only in CML files that represent updates to catalog/contracts. This attribute can be one of the following:

  • insert - insert new command. If a command with the same key exists in the file being updated, an error will be thrown.
  • update - update already existing command. If a command with the same key doesn't exist in the source file, an error will be thrown
  • insert-update - insert or update
  • replace - replace command. If a ommand with the same key does not exist in the source file, an error will be thrown
  • replace-insert - replace or insert
  • delete - delete existing command, an error will be thrown if there is no such command

The key attribute should be unique inside the CML file. Usually you shouldn't create these keys by yourself, instead the application will create this case after operations that modifiy the CML file.
 The key attribute is used only in the following operations on SSM files: sorting, diff, merge.

Two commands are considered equal if they have the same keys.

Command objects

Command objects represent the internal domain object modell in the jCatalog basic classes. Therefore allmost every data has a corresponding command object. Typical examples are:

  • Product
  • Catalog
  • Contract
  • Classification
  • ClassificationGroup
  • Attribute
  • Supplier
  • Customer
  • Address
  • ...

General rules of representation of Objects:

  1. CML/Command generally holds objects from the jcatalog-core, jcatalog-base
  2. Strongly one object inside Command
  3. The short name of object's class is name for the tag's name for object inside Command
  4. Generally object's properties represents as tags inside Object
  5. The property name with capitalized firs letter is the tag's name inside Object
  6. IDs represented as attributes of Object's tag (generally main properties and unique keys)

For more information please check the Examples For Object Representation In CML

Date, number and boolean formats.

In CML all numbers and all dates have the same format.

For numbers we are using "." as decimal separator, no grouping separator is used.
 Examples:

10
-4.56
100000.34

Date format pattern is yyyy-MM-dd HH:mm:ss.SSS (see javadocs for java.text.SimpleDateFormat) for more details).
 Examples:

2005-12-31 23:20:59.123
2003-06-03 00:00:00.000

Possible boolean values: true and false.

Tags:
Created by prodexa Admin on 11.12.2020, 17:07