XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement
 Resource Guide -> Relational Databases, Java, GUIs, Example Files, Demos, Web Services, XML Editors, XPath, XQuery, XSLT Software -> Flat File Mapping

Flat File Mapping


Link: http://www.stylusstudio.com/flat_file_mapper.html
Source Author or Organization: Stylus Studio

Flat File Mapping: Flat File mapping is the process of taking data stored in any type of flat file, for example, comma separated values (CSV), tab separated values (CSV), or literally any other kind of proprietary data format, and then mapping it to some other target XML data model, generally for the purposes using the converted data contained inside the flat files as part of a legacy data integration project. Stylus Studio provides several different and highly flexible ways to integrate flat files with XML, databases, EDI data, Web services, and any literally other data format.

Basic Flat File Mapings: Stylus Studio supports basic one-time data conversions of flat files to XML, for example, using an XML document wizard, you could easily convert CSV to XML by following a sequence of easy steps – for example, specifying the names of the columns, optionally excluding certain rows, etc. Creating basic flat file mappings in Stylus Studio is very similar to using the Microsoft SQL Server Import / Export utility, except that the mapping operation produces an XML file as its output.

Advanced Flat File Mappings: More often, developers need programmatic access to the data stored in flat files as part of a live data integration application, for example, suppose you are writing a Web service application which interacts with various different suppliers, organizations or customer systems – some of which use legacy software that provide data output feeds in non-XML formats, like CSV, EDI, etc. Integrating these legacy applications into a modern XML-based computing environment can be challenging since the structure of the flat files and text documents can vary significantly from application to application. Developers need to be able to gain access to any flat file data in a programmatic way, converting the non-XML data to XML on-the-fly for use by your Web service application. For these types of flat file mapping applications, a more advanced approach is recommended.

Integrating with Flat Files: Stylus Studio provides a standards-based approach to integrating and deploying legacy and XML data based data integration applications: XQuery 1.0, XSLT 1.0 / 2.0 and XPath 1.0 / 2.0. To access flat files as XML, follow these easy steps:

  • Configuring Flat Files as Data Sources: Load the flat file into Convert to XML, Stylus Studio's advanced flat file mapping tool for getting any non-XML data source into an XML data source. When you load a flat file into Convert to XML, the design window presents you with a properties windows that allows you to specify whether the file is fixed length, what delimiters it uses, what patterns to look for, etc. Just select the respective settings associated with the file you're trying to and you can append, insert, and remove fields as well as change field header names and values as required before importing the file. It's easy to filter and process the data exactly as you need it to be and you can preview the converted data by typing the F5 key and viewing the XML output preview.
  • Creating Flat File Mappings: Once you've configured your flat file to work as an XML data source, Stylus Studio supports the use of flat files as both the source and target of any XSLT mapping or XQuery mapping application – note that you are not limited you to basic one-to-one mappings - you can mix multiple, different input data sources (For example, X12, EDIFACT, EDI, relational data, etc.) and multiple targets to map any combination of these data formats. For an example of how to read and write to EDI files from XQuery, watch a free 5 minute video demonstration that demonstrates all the steps.
  • Generating the Java Application: Once you have finished defining the data mappings using either XSLT or XQuery, use the Stylus Studio Java Code Generator to automatically write the Java program code required to programmatically marshal data from the non-XML source to the targeted XQuery or XSLT processor for use in your customized data integration and Web services applications. Using auto-generated Java code ensures compatibility and interoperability across different platforms, servers, XML processing components and database environments.
  • Deploying the Flat File Mapping Application: The Java application is able to programmatically access the flat file data through the use of XML deployment adapters, which are high-performance Java components that stream non-XML data into XML on the fly for use by widely adopted XML processing components including Apache Xalan, Saxon the XSLT and XQuery Processor, and DataDirect XQuery. For more information on using XML deployment adapters, watch a brief online video demonstration or read the XML Adapters FAQ.

Developers can download a free trial of Stylus Studio flat file mapping tools today.