Developers |
Home:Developers:Tutorials & Examples:EDI Translation EDI Translation: How to Transform a directory of EDI messagesThe recent release of DataDirect XQuery 3.1 features new integration with with DataDirect XML Converters, and since DataDirect XML Converters supports the ability to query all files in a directory, this opens up a new range of use cases and solutions for EDI translation. Suppose you have a directory with EDI messages and need to transform or translate them all to XML, for example to translate the EDI messages into an XML data format for consumption by some other business process. In a previous tutorial on XQuery generating multiple XML documents we learned how to query a directory of XML document, and to transform and save each of the documents into a new XML file. To refresh our mind, the following query copies all XML files from one to another directory: declare function local:get-file-name($document-uri as xs:string){
An EDI Translation ExampleNow suppose that we have a directory of EDI messages, and want to transform them all into XML. Only a few changes to the above query are needed. The argument to declare function local:get-file-name($document-uri as xs:string){
What if the resulting XML document needs to conform to a specific XML Schema? No problem, XQuery is schema aware and is designed to perform such transformations. Assume we need to transform EDIFACT messages, we start from our previous query and simply add some transformation logic. for $edi in fn:collection("converter:///EDI?file:///C:/input?select=*.edi")
We have still fairly simple code with already significant functionality. You're now ready to use any of the built-in DataDirect XQuery functionality. Assume the data needs to be enriched with data from a Web service or your customer data stored in a relational database. Let's extend the previous example and add a shipping address to the result, which is obtained out of the for $edi in fn:collection("converter:///EDI?file:///C:/input?select=*.edi")
EDI Translation of Directories in a NutshellThis tutorial demonstrated how to query, enrich and transform XML messages which came from a XML-translated directory of EDI files. To get started with EDI translation, download a free trial of DataDirect XML Converters and/or DataDirect XQuery today. |





