EDI EDIFACT. Can anyone advise the Specifications (at least theory)?

Brief the essence of the problem. Used PHP, but the language does not necessarily get attached, just want to capture the essence of the mechanism.
There are 10 companies that will throw off EDI files. The standards are different (however they have given specification). Industry: trucking. EDI our EDI before I was not working, so please any tips. Thanks in advance.
I want to register classes with the abstract factory to be able to give them a SINGLE file, and it chewed it all properly sorted. And here is a small list of questions =)
About the EDI file.
1) UNH (this is the beginning of the envelope, as I understand it). And now, some companies throw everything in one UNH (info about each load), while others throw each load in a separate UNH - UNT.
2) In the specification there is a field "Position", but I never fully understood how best to work with him. The fact that it is responsible for the order of the fields - I understand, but many fields are skipped (Conditional)...
3) How to know exactly to what kind of group segments the line belongs to (the data segment). Also interested about nested groups of segments.

About the code
Because not all companies use EDIFACT, there is a standard (no name) which has the structure of style:
18AAAA1234567 7229932 2H000386CTNS 0000000752200006.86
Since initially the challenge was in parsing only 1 format (line above) and a rather rare application, and time was running out, it was written on the knee...
The idea was in the style of:
There is a class, inside it is an array of "specification" in which the arrays for the codes
$this->specification['18'] = array();
$this->specification['18'][] = array('column_range_start' => 2, 'column_range_end' => 16);
$this->specification['18'][] = array('column_range_start' => 17, 'column_range_end' => 31);

and so for each code specification. Then passed through each row, take the first 2 characters (code) and get where where to get info.
When asked to add to EDIFACT, with the same burning time and all on the same knee.
$this->specification['RFF'] = array('callback'=>'parseMblHblUML');

Well, row-by-row bust we just called this method and using the regular expressions were getting all of the required values.
I don't have 100% universal solution for all occasions. Just would like to hear the opinions and advice of professionals who can suggest how best to work with these EDI files. Because the normal literature I have not found. Does that somehow clarify to me what is EDI and what it eats
EDIFACT Standards Overview Tutorial."

Thanks for reading to the end =)
June 7th 19 at 14:47
0 answer

Find more questions by tags ProgrammingHierarchical structures