Basic XML structure

In this article we will describe the basic xml structure in a mapping that is needed to create a valid XML file. This should come in very handy if you don’t have an XML example file to create the mapping structure.

First, you need a data line with the following properties:

  • Type: Data
  • Subtype: Header
  • Encoding: <the one that is suitable for your message>
  • Version: 1.0

Below this line, you need a second data line with the following properties:

  • Type: Data
  • Subtype: Element
  • Name: <the name of the message>

The rest of the structure needs to be indented below the line, the first ones are the declaration of namespaces, if you need to use them

  • Type: Data
  • Subtype: Attribute
  • Name: <the name of the namespace>
  • SrcType etc: <depending on the namespace>

After that the header and lines structure follow. It is useful to think about the repetition of the elements and normally there’s one header and several lines. That means that you have to insert your EDI Document buffer table loop as the next line, with all necessary filters to initialize fields and indent the lines for the header and lines below. The structure should look like this so far (with the + indicating the level of indention):

Header
<MessageCode>
+<NameSpaceDeclaration>
+EDI Document loop
++<header>
+++<orderno>
+++<buyer>
+++<shipto>
+++<etc.>
++<lines>
+++EDI Document Line loop
++++<line>
+++++<lineno>
+++++<itemno>
+++++<description>
+++++<quantity>
+++++<etc.>

The EDI Document Line is inserted below the element <lines> because the seperate <line> could be repeated . Below is a screenshot of an example maping:

The content fields from the XML structure are collapsed here on this screenshot. For example, the shipto-element contains the fields for the name and address information of the ship-to address.