Structure of the Cargo-IMP parser configuration file

The Cargo-IMP parser needs an XML configuration file, in which all the message specific parsing rules are specified.

images/download/thumbnails/189463623/CargoIMP_5-version-1-modificationdate-1738737612053-api-v2.png


(1) Tag rules with attributes delim and segmentMinLength. All Cargo-IMP messages are defined within the rules tag. Simply use the delimiter and minimal segment length as it is given in this screenshot.
(2) Every single Cargo-IMP message is defined within a message tag.
(3) The id as it is given in the Cargo-IMP PDF message specification. You will also find this value in a Cargo-IMP data file in the first line, before the slant (STR/2). The id can be specified as a string and will then be interpreted as a Begins with match code. In addition to that, you can use regular expressions. To do so, use the prefix regex:. So id="ACD" or id="regex:^ACD.*" for example. The target for the ID check is the entire read in data line.
(4) The version as it is given in the Cargo-IMP PDF message specification. You will also find this value in a Cargo-IMP data file in the first line, after the slant (STR/2).
(5) The segment and its id, which is always the first field Standard Message Identifier in every Cargo-IMP format.
(6) The tag token is used to define the splitting of data in a token. A token is the data that can be found in between slants. Attribute pos describes the position of the token, where pos="1" describes the data (or token) from the start of a line until the first slant and pos="2" describes the data (or token) in between slant 1 and slant 2.

This XML configuration file can be found in ./etc/admin/datawizard/cargo-imp_rules.xml.