任何文件格式的解析器 [英] Parser for any file format

查看:144
本文介绍了任何文件格式的解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的要求之一是用户可以使用CSV,Excel,固定文件格式,XML等各种文件上传。



我可以使用任何公共解析器来解析给定列表中的任何文件,并将其转换为数据集或数据表以便插入数据库。



此外,如果有任何新文件格式出现在列表中,将来很容易附加一个具有该文件格式的逻辑。



i我正在使用asp.net和.net 3.5和MSSQL2008。

Hi,

One of my requirement is that a user can upload with various file like CSV, excel, Fixed file format, XML etc.

Can i have any common parser which can parse any file in the given list and convert it into dataset or datatable for DB insertion.

Also in future if any new file format comes which is not in the list, it should be very easy to attach a logic with that file format.

i am working on asp.net and .net 3.5 and MSSQL2008.

推荐答案

没有。

没有解析器这样的东西任何文件格式,虽然有可能创建一个可以扩展以解析新格式的类,但是有很多不同的格式(只是微软多年来使用的不同文件格式的数量是惊人的),它是尝试创建一个解析器来完成所有工作是不切实际的。



想想你需要什么文件支持,并查看每个解析器的现有解析器。 (他们将以完全不同的方式工作,所以让他们很好地一起工作将是相当多的工作)
No.
There is no such thing as a "parser for any file format", and though it would be possible to create a class that could be expanded to parse new formats, there are so many different formats (just the number of different file formats Microsoft have used over the years is staggering) that it is impractical to try and create a single parser to do all jobs.

Think of what files you need to support, and look at finding existing parsers for each of them. (They will all work in radically different ways, so getting them to work "nicely" together is going to be a fair amount of work anyway)


对于您列出的格式,您可能会尝试 OLEDB [ ^ ]。

等然而,文件格式列表中的固定格式会破坏上述方法。

干杯

Andi
For the formats you listed, you might try OLEDB[^].
The "etc." and the "fixed format" on the file format list distroys the above mentioned approach, though.
Cheers
Andi


这篇关于任何文件格式的解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆