![]() While the XSL Transformations template language looks like the natural choice for the conversion from XML to CSV, it is not very well suited for conversions the other way around. Or you can also invoke it explicitly: $ ruby csv2xml.rb input.csv > output.xml ![]() In order to execute this script it, you must save the previous as 'csv2xml.rb' and change the permissions to executable. Where the 'csv2xml.fferc' configuration file looks something like the following: structure csv2xml, separator) Once installed, an 'input.csv' file can be converted to an 'output.xml' file using the ffe tool with the following instructions on the command line: $ ffe -o output.xml -c csv2xml.fferc input.csv It is available as the 'ffe' package in Ubuntu Universe, and can be installed as follows: $ sudo aptitude update The Flat File Extractor is a command-line tool that allows you to convert arbitrary text files to XML. For more information, you can read the Command Line Howto in this Wiki. If some part is not available, you can write or modify a custom script in your scripting language of choice. It allows you to combine existing programs with redirections and pipes, creating your own custom tools. Unfortunately, only a Windows version exists. Additionally, as like as in the OIO tool, you may choose first line entries as element names. Then choose path and define delimiter as encoding (!). How to convert now? In menu klick convert - import textfile - "convert CSV to XML" (2nd option). It's not free, but when you work a lot with XML, maybe it's worth to you because it's like a Swiss Army Knife for XML use. Nevertheless, it's good for ASCII but it has some problems with Unicode.Īnother tool for CSV2XML conversion is the Altova XMLSpy. define the delimiter and define the first line as source for the element names (very useful!). It's possible to use it as a standalone or as a Java Web Start Application or integrated in own software projects. Flat elements are a little bit harder to process, but it can be done.Ī specialized tool based on Java should be mentionned here, the CSV2XML Konverter published by OIO for free use. Or you can get a flat element naming replacing with. It should be possible to use a similar mechanism for reading labels from the first row. It allows you to get distinct element names for each data column. Please note, that the use of 'position()' in the 'table:table-cell' template might be problematic. $ xsltproc -output "output.xml" "odf.xsl" "content.xml"Ī basic 'odf.xsl' stylesheet might look like: ![]() Convert it with an XSLT stylesheet and xsltproc:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |