[Moved] CSV File to XML File
-
Hi All
Is there any way by which i can convert CSV file to XML file.
or Can i export contents of QTableWidget to XML File
-
Nope, you should write your own custom converter.
-
Don't fear. Writing XML with Qt is very simple.
The documentation of QDomDocument contains template code for you. -
To read content of a CSV-File you could split the content by using QRegExp. Use ; as splitter.
-
[quote author="jensen82" date="1310472822"]To read content of a CSV-File you could split the content by using QRegExp. Use ; as splitter.[/quote]
No, don' t do that. What happens if the contents between " happens to contain a semicolon? Then you are in big trouble. Use a decent CSV parser instead, it is not as trivial as just splitting lines on a separator. -
There is no need to write a CSV parser. There are millions available.
A Qt CSV parser:
http://sourceforge.net/projects/qcsv/ -
I'm using boost::spirit for text-parsing. Very fast!
-
Hm, Spirit is overhead for csv parsing I think.
-
I moved this thread to the brainstorm forum, as it's only marginally Qt related.