改造平面文件使用XSLT样的技术来支持XML平面、文件、技术、XSLT

2023-09-04 05:37:56 作者:平生欢

我设计其由数以CSV文件的形式伙伴的接收数据的系统。该文件可能会有所不同,在列的数目和次序。在大多数情况下,我会想选择列的子集,也许重新排列,并把他们开了一个解析器。我显然preFER能够输入的数据转换成一些标准格式,以使解析器尽可能简单。

I'm designing a system which is receiving data from a number of partners in the form of CSV files. The files may differ in the number and ordering of columns. For the most part, I will want to choose a subset of the columns, maybe reorder them, and hand them off to a parser. I would obviously prefer to be able to transform the incoming data into some canonical format so as to make the parser as simple as possible.

理想情况下,我想是能够产生对于使用一些图形工具每个传入数据格式的转换和变换为文档存储在数据库中或在磁盘上。当数据的接收,我会申请正确的转换(别提我如何确定正确的转换),以获得一个XML文档中的规范格式。如果传入文件已包含的XML我只想创造每种格式的XSLT文档,并一直在我的方式。

Ideally, I would like to be able to generate a transformation for each incoming data format using some graphical tool and store the transformation as a document in a database or on disk. Upon receival of data, I would apply the correct transformation (never mind how I determine the correct transformation) to get an XML document in a canonical format. If the incoming files had contained XML I would just have created an XSLT document for each format and been on my way.

我(不管它们被称为或)在过去类似的东西使用的BizTalk的平面文件的XSLT扩展,但我不希望的BizTalk的麻烦(我买不起,要么)在这个项目上。

I've used BizTalk's Flat File XSLT Extensions (or whatever they are called) for something similar in the past, but I don't want the hassle of BizTalk (and I can't afford it either) on this project.

有谁知道是否有替代技术和/或XSLT扩展,这将使我实现我的目标,以一种优雅的方式?

Does anyone know if there are alternative technologies and/or XSLT extensions which would enable me to achieve my goal in an elegant way?

我开发的.NET 3.5 SP1我在C#应用程序(将因此$由.NET支持的e $ PFER技术)。

I'm developing my app in C# on .NET 3.5 SP1 (thus would prefer technologies supported by .NET).

推荐答案

XSLT提供了新的功能,使其更容易地分析非XML文件。

XSLT provides new features that make it easier to parse non-XML files.

安德鲁·韦尔奇发布了 XSLT 2.0例如可以转换CSV成XML

Andrew Welch posted an XSLT 2.0 example that converts CSV into XML