Home > XML IDE - XML Editor > XML Editor Key Features > EDI Tools > X12 to XML
Translating X12 documents to XMLX12 and other EDI dialects are handled easily by Stylus Studio®, which has a comprehensive set of tools for managing and converting X12 transaction sets, segments, elements, and codelists. It uses this X12 dictionary for helping you write syntactically pure and semantically accurate X12 and to diagnose problems with incoming and outgoing X12 data. This page will cover these areas involved with the X12 XML Converter:
(Note that the X12 converter and the EDIFACT converter use the same URL; the EDI converter engine figures out from the document itself whether it should switch to EDIFACT or X12 mode. Not too shabby, huh?) (And while we are in parentheses, remember that the data conversion utilities can be called from your own programs through the data conversion API. More details can also be found on the XML Converters page. Now back to your regularly-scheduled and un-parenthesized content.) The X12 URLThe "special ingredient" to using X12 with different sorts of 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 converted in real time through one of these converters. X12 is just one type; others include one for making HTML into proper XML (actually, XHTML) and another one to convert Comma-Separated Values to 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 X12 file, and prepending it with the
special For example, to treat
There can be other options before the
The File|Open dialog and X12 documentsCreating the URL can be done manually or through the Open|File dialog. Since just opening the file automatically exposes the URL, let's see how straight forward it is to go from X12 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 X12 document in the XML editorNext we select the correct 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 X12 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 choosing the filename, checking one checkbox, pressing one button (Open), selecting the converter and pressing another button (OK), we've got a converted file in our XML editor. Using X12 as input to XSLTTo use this file as input to XSLT for example, we could use this same File|Open step to fill the "Source XML URL:" field in the XSLT Scenario dialog: and try the following identity transform that just copies the input to the output: <?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> Using X12 as input to XQueryUsing XQuery, go to 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 X12 file but in XML form. From this you see that it is trivial to use X12 anywhere you are accustomed to using XML. Happy converting!
|
PURCHASE STYLUS STUDIO ONLINE TODAY!!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Try Stylus X12 ToolsSimplify working with X12 technologies using Stylus Studio®'s award-winning X12 Tools — Download a free trial 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! Ask Someone You KnowDoes your company use Stylus Studio? Do your competitors? Engineers from over 100,000 leading companies use Stylus Studio, and now you can ask someone from your own organization about their experiences using Stylus Studio. Deploy your X12 ApplicationsOnly Stylus Studio provides the necessary tools and components to develop and deploy your data integration applications that access legacy data formats including X12, EDIFACT and EDI to a live production environment using W3C XML Standards. |