Home > XML IDE - XML Editor > XML Editor Key Features > EDI Tools > EDIFACT to XML
Translating EDIFACT documents to XMLStylus Studio® has a built-in comprehensive dictionary of EDIFACT messages, segments, elements and codelists. It uses this EDIFACT respository for helping you write clean EDIFACT and diagnose problems with existing EDIFACT data streams. This page will cover these topics relating to using the EDIFACT XML Converter:
(Note that the EDIFACT converter and the X12 converter use the same URL; the EDI converter engine figures out from the document itself whether it should switch to EDIFACT or X12 mode. Pretty cool, huh?) (If you think this is keen, neat, cool or groovy, see also the data conversion API for using this stuff from your own programs as through you had prepared them from scratch. For the rest of the recipe, see the XML Converters page.) The EDIFACT URLThe "secret sauce" to using EDIFACT with all of the various XML Tools is that Stylus Studio® has an advanced URI Resolver that does on-the-fly conversions of documents from one syntax to another. Anything that can be addressed by URL can be morphed in real time through one of these converters. EDIFACT is just one type; others include one for Comma-Separated Values and one to convert HTML into XML. The way an EDI file is converted is by taking any place a regular XML URL would go,
and instead putting the URL to the EDIFACT file, and prepending it with the
special For example, to treat
There can be other options before the
The File|Open dialog and EDIFACT documentsTo create the URL, it can be done manually or through the Open|File dialog. Since just opening the file naturally exposes the URL, let's see how simple it is to convert EDIFACT to XML. First, use the same File|Open dialog you are used to in other applications to choose the file, except right before hitting Open, put a check in the special box labeled "Convert to XML using converter". Open the EDIFACT document in the XML editorNext we choose the proper converter, which in this case is the "Electronic Data Interchange (EDI)" converter. On the right side, there are several options that vary by converter. Changing them changes the URL prefix shown at the bottom of the dialog. Properly formed EDIFACT files will open without any changes, but occasionally you might need to suppress some of the automatic structural validation to get things to open.
So, after picking the filename, checking one checkbox, pressing one button (Open), choosing the converter and pressing another button (OK), we've got a converted file in our XML editor. Using EDIFACT as input to XQueryTo use this file as input to XQuery for example, we could use this same File|Open step to fill the "Main input:" field in the XQuery Scenario dialog: Then run an XQuery program consisting of solely a single period, and you should get as output the entire EDIFACT file but in XML form. Using EDIFACT as input to XSLTUsing XSLT, go to the "Source XML URL:" field in the XSLT Scenario dialog: and try the following only slightly more sophisticated XSLT transform: <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:copy-of select="node()"/> </xsl:template> </xsl:stylesheet> From this you see that it is trivial to use EDIFACT anywhere you are accustomed to using XML. Happy transforming!
|
PURCHASE STYLUS STUDIO ONLINE TODAY!!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Try Stylus EDIFACT Mapping ToolsDownload a free trial of our industry-leading EDIFACT mapping tools today! Attend a Live Webinar This Week!Learn about Stylus Studio's unique features and benefits in just under an hour. Register for the Stylus Studio QuickStart Training WebCast! Why Pay More for XML Tools?With Stylus Studio® X16 XML Enterprise Suite, you get the most comprehensive XML tool suite at one incredibly low price. Value: it's just one of many reasons why smart XML developers are choosing Stylus Studio! Stylus Studio® EDIFACT ZoneSimplify your next legacy data integration project with the help of the EDIFACT Zone, the world's largest, free online reference covering all EDIFACT and UN/CEFACT versions. Related XSD Features & Tutorials |