Match Codes, Unique Names, Reserved Names (XML)
If you generate a structure automatically, you do not have to worry about the match codes, unique names and reserved names. These will then be generated automatically. The following explanations are only for your understanding and if you want to make manual extensions or changes.
Match Codes
Concerns only the source structure, i.e. parsed XML files.
In document type XML, nodes and fields have match codes equal to the name of the XML element. The attribute fields TYPE_attr and TYPE-1_attr and the nodes TYPE and TYPE-1 have the same match code Equals TYPE.
The value fields TYPE_val and TYPE-1_val do not have match codes. Values will be assigned to the fields via the name match with the node. If match codes are defined for these fields, they will be ignored.
For automatic generation of match codes for XML, see section Checking and Creating Match Codes.
Unique Node and Field Names
In XML, elements with the same name can occur in different hierarchy levels of the XML document. To ensure the uniqueness of the names of all nodes and fields in a profile in Lobster_data, a numeric suffix is therefore appended to each name that already exists in the structure. The number is continuously incremented, but it can also be changed after the structure import if the uniqueness of the names is preserved. The order of the suffix numbers is irrelevant. Note: Theoretically, the same name of a field or node of the source structure can be used in the target structure (and vice versa). However, one should refrain from doing so to prevent confusion. Note : Suffixes are recognised internally by the character - and # and a following digit. For the field name somename-0sometext, the suffix -0sometext would be recognised. This does not matter in the automated case, but can be useful in the case of a manual adjustment.
Suffix in source structure |
-<number> |
Suffix in target structure |
#<number> |
Reserved Names
The following suffixes in field names are reserved.
_val: A field with this suffix contains the value of the XML element.
_attr: Fields with this suffix can be used to add attributes to an XML element. As an example, id_attr would add the attribute id to the element.
The following suffixes are only relevant for target structures when generating XML files with the XMLNoTemplateUnit.
_nsdef: (e.g. xsd_nsdef) This suffix defines an additional namespace in the XML element (XSD). The content of this field is the namespace itself, e.g. http://www.w3.org/2001/XMLSchema.
_name: Field to rename the XML element that is created out of the corresponding parent node. The name of the XML element is no longer determined by the name of the parent node but the value of the field (not name). The field name needs a prefix that is equal to the name of the parent node that shall be renamed. So if you want to rename parent node POS, you have to use field name POS_name.
Example
In an XML document, for example, an element TYPE may occur at multiple locations in the hierarchy and, additionally, an attribute TYPE may be assigned to other elements. Following an example file.
<
ORDER
TYPE
=
"abc"
>
<
ADDR
>
<
TYPE
quali
=
"17"
>WE</
TYPE
>
<
TYPE
quali
=
"18"
>WI</
TYPE
>
</
ADDR
>
<
POSITION
TYPE
=
"xyz"
>
</
POSITION
>
<
POSITION
TYPE
=
"abc"
>
</
POSITION
>
<
TYPEDEFINITIONS
>
<
TYPE
source
=
"Buyer"
>BY</
TYPE
>
<
TYPE
source
=
"Seller"
>SE</
TYPE
>
</
TYPEDEFINITIONS
>
</
ORDER
>
The following screenshot shows the corresponding source and target structure for the XML snippet in the listing above.
Element ORDER has an attribute TYPE. It is represented by node ORDER and filed TYPE_attr.
Element TYPE in ADDR has an attribute quali and a value. It is represented by node TYPE, the attribute field quali_attr and the value field TYPE_val. The value field has to use the name of the node and suffix _val as its name.
Within the element TYPEDEFINITIONS, there can be several elements TYPE with attribute source and a value. This is represented by the node TYPE-1 (resp. TYPE#1) with the value field TYPE-1_val (resp. TYPE#1_val) and the attribute field source_attr. Even if the attribute were missing, the element TYPE could occur multiple times within TYPEDEFINITIONS with different values.
Important note: The suffixes _val and _attr are always placed after the suffixes for uniqueness (see TYPE-1_val, TYPE-1_attr, TYPE#1_val and TYPE#1_attr).