Simple use of the EDIFabric class.
The final product (if it ever goes to production ) will probably not look anything like this.
This is just a proof of concept.
EDI ([E]lectronic [D]ata [I]nterchange)
EDI has been around since the 1960's but EDI is still in use today by many major companies. When it's understood it can be compared to a DOM in that it has opening and closing envelopes encapsulating sections of data. The schema for the document is contained in a header of 105 characters and a major delimiter.
[[-flag] [value] [-flag] [value] ... ... ]
- -d [void] debug
- -c [string] The class ( EDI Template type ) to use
- -p [string] The "Ship To" company
- -f [string] The name and extension of the file: blah.edi
- -s [string] The status Send, Receive, Respond
The program attempts to normalize incoming EDI data from the EDIFabric object created from the EDI file. In some case inevidably there will be caveats for each company. The sub class builds on the custom template feature to add extra fields as required by customer specs. Adding a template and sub-class is very easy and I include a fake ACME company template and sub-class.
The class and subclass use the EDI Fabric templates that are just loose interfaces ( loose in that none of the variables or methods are required by the class ). The sub template inherits the parent making it easy to impliment the sub-class with a simple reinstantiation of the template using the sub-class. It will auomatically inherit the parent.
I was using a Python EDI library and it works fine to create an object with no schema whatsoever but, looping that data would be like reinventing the wheel.
This library is much easier and worth the price for a profesional implementation.