edi2xml - translate UN/EDIFACT messages to XML
edi2xml [-i] [-x extension] filename.edi > filename.xml
edi2xml is able to translate into XML any UN/EDIFACT message or message fragment that does not use code list extensions.
Prior versions of edi2xml provided a form that was more human readable. But the intends caused problems with stupid non-validating XML parsers, so the default is now without intends. If you want to view them, the -i flag provides the old style.
The 0.34 version provided an initial way to use namespace migration for code list extensions. This way is still crude and not XML/RDF. For patching an extension SDBM into edi2xml, use the -x switch without the trailing .dir/.pag.
Message fragments have to be preceded by an UNA Service advice String. Messages may have an optional leading UNA, or may start with a UNB Interchange Header, if the default Service advice String has been used.
Most bugs might better be called not yet implemented, e.g. missing external RDF files, as can be seen in the Roadmap section of the README file, but the existing code has certainly many others. Drop me a note, if you find some misbehavior.
I call XML::Edifact an aproach towards XML/EDI as a prototype in Perl. Nothing is carved in stone, but should be seen as painted on wood with the coal from fire, intended to be thrown into the fire to provide fuel for the release. So drop me a note, if you think something should be changed.
XML::Edifact XML::Parser.
For further study, browse at http://www.unece.org/trade/, http://www.unece.org/trade/untdid/download/d99a.zip, http://www.w3.org/TR/REC-xml, http://www.xmledi.org/ and http://www.xml-edifact.org/.
Kraehe@Copyleft.de - Michael Koehne - MK25-RIPE
SCRIPT
use Config;
my $file = $ARGV[0];
$script =~ s/\~(\w+)\~/$Config{$1}/eg; if (!(open(FILE, ">$file")) || !(print FILE $script) || !(close(FILE))) { die "Error while writing $file: $!\n"; } print "Extracted $file from ",__FILE__," with variable substitutions.\n";
# end 0;
To install XML::Edifact, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Edifact
CPAN shell
perl -MCPAN -e shell install XML::Edifact
For more information on module installation, please visit the detailed CPAN module installation guide.