简体   繁体   English

从数据库生成文本文件

[英]Generating text file from database

I have a requirement to hand-code an text file from data residing in a SQL table. 我需要从驻留在SQL表中的数据中手动编码文本文件。 Just wondering if there are any best practices here. 只是想知道这里是否有最佳实践。 Should I write it as an XMLDocument first and transform using XSL or just use Streamwriter and skip transformation altogether? 我应该先将其编写为XMLDocument并使用XSL进行转换,还是仅使用Streamwriter并完全跳过转换? The generated text file will be in EDIFACT format, so layout is very specific. 生成的文本文件将采用EDIFACT格式,因此布局非常具体。

The normal thing to do is just write the EDIFACT data directly. 通常要做的就是直接写入EDIFACT数据。

Creating it as an XMLDocument and transforming it to EDIFACT might be useful if there's a library already available to do the transformation. 如果已经有一个库可以进行转换,则将其创建为XMLDocument并将其转换为EDIFACT 可能会很有用。 I say this because there's a lot of language support for XML output. 我之所以这样说,是因为XML输出支持多种语言。

I can't see how XSL will help you here, but I've never had to output EDIFACT data. 我在这里看不到XSL将如何为您提供帮助,但我从未输出过EDIFACT数据。

http://www.stylusstudio.com/edi/XML_to_EDIFACT.html http://www.stylusstudio.com/edi/XML_to_EDIFACT.html

This URL has an example XSLT for translating XML to EDIFACT which might solve your problem. 该URL有一个示例XSLT,用于将XML转换为EDIFACT,这可能会解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM