xml2edi - translate XML messages back to UN/EDIFACT
xml2edi [-i] [-i extension] filename.xml > filename.edi
xml2edi is able to translate those XML messages to XML, which are conforming to the semantic translation of UN/EDIFACT to XML. This semantic translation is currently static coded. And no external entities are used. Version 0.5 will provide more freedom in XML to UN/EDIFACT translation by using RDF for semantic mapping.
When reading UN/EDIFACT on a screen, I prefer a newline as a advice segment seperator. Some UN/EDIFACT parsers may not like this, so its optional.
The 0.34 version provided some first 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.
XML files have to contain documents of namespace:message type, where namespace is either the default edifact or matched by the extension SDBM. Future versions from 0.7x up will focus on orders, invoices and so on. Current translation is flat and ignores the TRED/EDMD documents.
Most bugs are better 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 found some missbehavior.
I call XML::Edifact an aproach towards XML/EDI as a prototype in Perl. Nothing is carved in stone, but should be better viewed as painted on wood with the coal from fire, intended to become thrown into the fire to provide coal for the release. So drop me a note, if you think something has to 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@Bakunin.North.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
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.