Issue with XML file
-
Hi guys, I am writing data from dataset into an xml file. However, the xml file does not open correctly either in the browser or in excel. Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this? With Best Regards, Mayur
-
Hi guys, I am writing data from dataset into an xml file. However, the xml file does not open correctly either in the browser or in excel. Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this? With Best Regards, Mayur
You'd be better off parsing it with a SAX implimentation rather than the DOM. I believe XMLDataDocument is optimised for this sort of thing. Christian Graus - Microsoft MVP - C++
-
You'd be better off parsing it with a SAX implimentation rather than the DOM. I believe XMLDataDocument is optimised for this sort of thing. Christian Graus - Microsoft MVP - C++
I am a fresher in .net. I did not understand what you tried to explain in your reply. please explain it to me in simpler terms. With Best Regards, Mayur
-
I am a fresher in .net. I did not understand what you tried to explain in your reply. please explain it to me in simpler terms. With Best Regards, Mayur
SAX and DOM are the two ( standard ) ways to parse XML. I think if you use the XMLDataDocument class, you might be fine. Christian Graus - Microsoft MVP - C++
-
Hi guys, I am writing data from dataset into an xml file. However, the xml file does not open correctly either in the browser or in excel. Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this? With Best Regards, Mayur
mayhem_rules wrote:
Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
I'd really question why you want to store that amount of data in an XML file. Many people mistakenly confuse XML for some sort of database - which it is not. Large amounts of data are better stored in a database. Is this application sending data to another system which can only accept XML input? ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-) -- modified at 17:14 Tuesday 28th February, 2006
-
mayhem_rules wrote:
Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
I'd really question why you want to store that amount of data in an XML file. Many people mistakenly confuse XML for some sort of database - which it is not. Large amounts of data are better stored in a database. Is this application sending data to another system which can only accept XML input? ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-) -- modified at 17:14 Tuesday 28th February, 2006
No, I am not using the xml file as a database. Actually the issue is something else. I need to get the records in excel for the user. However, I do not know how to do that. I searched the internet and found information on writing to xml and opening the xml file in Excel. However, the xml file does not open in excel. Maybe the size of the xml file is the issue. I hope u have understood my problem. Please guide me with this. thnx. With Best Regards, Mayur
-
No, I am not using the xml file as a database. Actually the issue is something else. I need to get the records in excel for the user. However, I do not know how to do that. I searched the internet and found information on writing to xml and opening the xml file in Excel. However, the xml file does not open in excel. Maybe the size of the xml file is the issue. I hope u have understood my problem. Please guide me with this. thnx. With Best Regards, Mayur
Ok, I see. Excel can diectly import CSV (comma separated value) files or TAB separated files. Maybe that would be a better way. With XML, you have the overhead of a begin tag and an end tag wrapping each value which, depending on the tag names, can be rather long and a huge overhead per row of data. CSV (or TAB) delimited files on the other hand incur only a single character overhead between each value in each row of data which equates to a very much smaller file. For example consider a Customer table defined in the database with the following (abstract) column names: "CustomerName", "Address", "Country", "TelephoneNumber" Assume some test data: "steve", "111 nowhere street", "australia", "123456789" "brian", "222 right rd", "usa", "123456789" "tony", "333 left ave", "israel", "123456789" "angela", "444 circular cres", "mars", "123456789" "george", "555 main st", "moon", "123456789" Note that the CSV file format is that shown above - quite compact. If we extract this data to an XML file, it could end up looking something like this for each row (it is not accurate and is for explanation only): steve
111 nowhere street
australia 123456789 ... Can you see the extra overhead in just one row of data? In this particular case the overhead exceeds the actual row data size. Multiple this by a factor of 50,000 (i.e. the rows in your database) and it is huge. In short, yes XML is a good way of transporting data between dissimilar applications provided the number of data is relatively low and there is no other viable method. ...Steve
-
Ok, I see. Excel can diectly import CSV (comma separated value) files or TAB separated files. Maybe that would be a better way. With XML, you have the overhead of a begin tag and an end tag wrapping each value which, depending on the tag names, can be rather long and a huge overhead per row of data. CSV (or TAB) delimited files on the other hand incur only a single character overhead between each value in each row of data which equates to a very much smaller file. For example consider a Customer table defined in the database with the following (abstract) column names: "CustomerName", "Address", "Country", "TelephoneNumber" Assume some test data: "steve", "111 nowhere street", "australia", "123456789" "brian", "222 right rd", "usa", "123456789" "tony", "333 left ave", "israel", "123456789" "angela", "444 circular cres", "mars", "123456789" "george", "555 main st", "moon", "123456789" Note that the CSV file format is that shown above - quite compact. If we extract this data to an XML file, it could end up looking something like this for each row (it is not accurate and is for explanation only): steve
111 nowhere street
australia 123456789 ... Can you see the extra overhead in just one row of data? In this particular case the overhead exceeds the actual row data size. Multiple this by a factor of 50,000 (i.e. the rows in your database) and it is huge. In short, yes XML is a good way of transporting data between dissimilar applications provided the number of data is relatively low and there is no other viable method. ...Steve
Steve, Thnx a lot for your reply. That clears much of my doubts. However, my main problem still remains. How do I export data to EXCEL or CSV or TSV. Please help. With Best Regards, Mayur
-
Steve, Thnx a lot for your reply. That clears much of my doubts. However, my main problem still remains. How do I export data to EXCEL or CSV or TSV. Please help. With Best Regards, Mayur
mayhem_rules wrote:
How do I export data to EXCEL or CSV or TSV
Depends in which format the data is currently. From Microsoft SQL Server (Query Analyzer) you can run a query against the MSSQL database and export the results directly to CSV. Other database engine management tools also offer this feature. Also, I believe that Excel can hook into MS SQL Server directly - and possibly other databases with an ODBC connector. (You'll need to look that up in the Excel help.) If the data is in a proprietary or other file format (i.e. non-database), you may need a simple program to extract the data and write a flat file (which is what a CSV really is anyway) into the format outlined in previous posts. This is easily done with VB (look up the file handling functions). ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)