"The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination." - Fred Brooks
Bookmark and Share      
Convert in both ways: CSV(Excel, mdb etc.) to XML and then XML back to CSV(Excel, mdb etc.)

The XML Converter is data conversion software tool to interactively create a data transformation. It allows you to use XML documents by exporting source data into XML file.

You are probably in need to convert your data in both ways: CSV(Excel, mdb etc.) to XML and then XML back to CSV(Excel, mdb etc.). In other words, you need to put in a middleware solution that can convert the outgoing XML into CSV and then convert the incoming CSV back into XML. How can Rustemsoft’s software help to use this to set up a batch command-line process to do this?

We have 2 command-line executables for that solution.

XML Converter Professional includes XMLConverterCmd executable module that runs within the console window or DOS-batch command file and converts CSV to XML:
https://rustemsoft.com/xmlconverter3.html

XMLFox Professional includes XMLFoxCmd executable module that runs within the console window or DOS-batch command file and converts XML to CSV:
https://xmlfox.com/xml_editor_pro.htm

XML Converter
More about XML Converter
Download XML Converter
Order XML Converter

XMLFox Advance XML/XSD Editor
More about XMLFox Advance Editor
Download XMLFox Editor
Order XMLFox Advance


XML Converter Professional Edition executable module has the following command-line interface:

XMLConverterCmd -s[SourceFileName]
                          -n[SourceTableName/or Number]
                          -g[TargetTypeName]
                          -t[TargetFileName]
                          -m[MappingMethod]
                          -w[WritingMethod]
                          -l[NeedXSLtemplate]
                          -h[NeedXLSheader]
                          -r[ShowRegForm]
                          -help
                          -![+|-]


More about XML Converter with command-line interface

Download XML Converter with command-line interface

Order XML Converter Professional Edition


Command-line arguments

XMLConverterCmd can accept quite a few command-line arguments. Many of these arguments can be omitted and XMLConverterCmd can use default values instead of them. XMLConverterCmd expects command line arguments to be preceded by the "-" (dash) as normally used by DOS programs. Also you can use a special configuration file default.cfg for defining and sending your parameters to XMLConverterCmd.exe. If you define arguments in command-line then their values will have a high priority than the values have been defined in default.cfg.
There is a description of some XML Converter command-line arguments:

SourceFileName
A Name of Data Source file with full path like:
C:/MyDirectory/MyBook.xls

SourceTableName/or Number
A Name or a number of spreadsheet or table, which belongs to your Data Source file.
Default is empty string

If you decide to define the [SourceTableName/or Number] argument as a number of table/spreadsheet you have to put this parameter after [SourceFileName] arguments. Otherwise, if [SourceTableName/or Number] argument is name of table/spreadsheet and contents spaces inside you must enclose it in "[ ]" brackets:

XMLConverterCmd.exe -rXLS -sC:\MyDir\MyBook.xls -n[First sheet 10] ...

Also you can leave this argument empty. It means XML Converter will generate one common xml output file where data from all of your Data Source's spreadsheets/tables will be stored. In this case you can create your own XML database. This software gives you ability to generate an output as a set of XML tables.

MappingMethod
The Mapping method determines how each Source data column is mapped when a XML document is saved. This argument should be omitted when TargetTypeName is not xml.
Values:
e - Map out as Element
a - Map out as Attribute
r - Map out as Row Content Default is e

NeedXSLtemplate
Argument is replying to question: "Would you like to accompany your XML document with a template XSL style-sheet?" This argument should be omitted when TargetTypeName is not xml.
Values:
yes
no Default is no

ShowRegForm
If you are not a registered user of the XML Converter Professional Edition yet you can order the software online. After that we will send to you your secure installation code and you will run your software with the parameter:
XMLConverterCmd.exe -r
A special registration form will appear where you will be able to legalize your Converter.

Example
If you want to get one XML file generated from all of MyBook.xls spreadsheets you can use the signature:
XMLConverterCmd.exe -sC:\MyDir\MyBook.xls n
For this case final MyBook.xml file will be saved in directory C:\MyDir\ and will content data from all spreadsheets. Also, this file will have special tags, such as "workbook", "worksheet", "row", "field column=""", which allow you to directly access and read the XML file by using DOM or SAX software.


The XMLConverterCmd.exe returns error codes:
0 - Ok
1 - Syntax error in command line
2 - Source file does not exist
3 - Source table does not exist
4 - Can't open source file
5 - Can't create XML file
6 - Error of XSL-template creating
7 - Can't create XSD file
8 - Error of DTD creating
9 - Can't connect to data
10 - Can't read data format
11 - Error of TrasX-Schema creating
12 - Error in "micro" - module
13 - Target file is not created

Example
If you want to get one XML file generated from all of "MyBook.xls" spreadsheets you can use the signature:
XMLConverterCmd.exe -sC:\\MyDir\\MyBook.xls n
For this case final "MyBook.xml" file will be saved in directory "C:\MyDir\" and will content data from all spreadsheets. Also, this file will have special tags, such as "workbook", "worksheet", "row", "field column=""", which allow you to directly access and read the XML file by using DOM or SAX software.

Also XMLConverterCmd supports ErrorLevel DOS variable. When using a dos batch file to execute XMLConverterCmd.exe, how do you go about error handling? There is the ErrorLevel variable being passed back to the batch file that can be interrogated to determine successful/unsuccessful completion of XML Converter Cmd. To try the functionality you should have a .bat file like the following:

@Echo Off
XMLConverterCmd.exe
goto %errorlevel%
:0
echo Ok
goto end
:1
echo Syntax error in command line
goto end
:2
echo Source file does not exist
goto end
:end

XMLConverterCMD.err file
When XMLConverterCmd.exe interrupts its execution the special file XMLConverterCmd.err will be created where error reports are stored. This error message file contains both error numbers and their associated text messages. The error report is accompanied by the date and time when it occurred. Since the error message file created with XMLConverterCmd is a binary text file it can be accessed by any text editor.


XMLFox Professional Edition executable module has the following command-line interface:

-SOURCE=[Path+FileName] Source XML file Name with full path
-OUTPUT=[Path+FileName] Target file Name with full path
-TYPE=[Number] Conversion type.
0 - convert into Text file
1 - convert into Excel file
2 - convert into CSV file
3 - convert into HTML file
4 - convert into MS Access mdb file
5 - convert into SQL Server database
-MSACCESSTYPE=[Number] MS Access DB type to be created.
95 - MS Access 95
97 - MS Access 97
00 - MS Access 2000
03 - MS Access 2003
-USERID User ID for MS SQL Server database connection
-PASSWORD Password for MS SQL Server database connection
-DATASOURCE Data Source for MS SQL Server database connection
-INITIALCATALOG Initial Catalog for MS SQL Server DB connection
-EXTPROPERTIES Extended Properties for MS SQL Server connection
-HIDE Hide the console window when process runs
-WRITELOG Write Log file with info about conversion process
-? Display this usage message

Option key is '-', options are recognized by a first character
ExamplesDownload XMLFox Pro
Convert XML into Excel file:
XMLFoxCmd -s=C:/MyDir/My.xml -o=C:/Dir_New/MyExcelFile.xls -t=1 -h -w

Upload XML into MS SQL Server Database:
XMLFoxCmd -s=C:/MyDir/My.xml -u=MyID -p=Psw -d=SQLHost -i=MyDBase -t=5 -h -w


Command-line arguments

XMLFoxCmd can accept quite a few command-line arguments. Many of these arguments can be omitted and XMLFoxCmd can use default values instead of them. XMLFoxCmd expects command line arguments to be preceded by the "-" (dash) as normally used by DOS programs.






Copyright © 2001-2024 Rustemsoft LLC All Rights Reserved.