XML到CSV [英] XML to CSV

查看:163
本文介绍了XML到CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的XML文件很大(194 mb).我想使用C#代码将其转换为CSV文件.请帮帮我.

提前谢谢.

已经做完了,但是生成了空文件.帮帮我..

 静态  void  Main(字符串 []参数)
{
    getsubnode();
}

公共 静态  void  getsubnode()
{
    XmlDocument doc =  XmlDocument();
    doc.Load(" );

    StreamWriter wr =  StreamWriter(" 字符串 Temp = " ;
    wr.WriteLine(Temp);
    wr.Close();
            
} 



[edit]添加了OP的更新[/edit]

如果我写错了,请纠正我.由于文件太大,我不想在代码中使用标签.对此是否有解决方案?

解决方案

开始与 XmlReader [ StreamWriter [使用XSL将XML转换为CSV

2. XML到CSV转换器

3. http://www.csvreader.com/code/cs/xml_to_csv.php

I have large XML file(194 mb). I want to convert it into a CSV file using C# code. Please help me.

Thanks in advance.

have done like this but empty file is generated.help me..

static void Main(string[] args)
{
    getsubnode();
}

public static void getsubnode()
{
    XmlDocument doc = new XmlDocument();
    doc.Load("D:\\FXOPT\\EXP0D.xml");

    StreamWriter wr = new StreamWriter("D:\\X.csv", true);
    string Temp = "";
    wr.WriteLine(Temp);
    wr.Close();
            
}



[edit]added OP''s update[/edit]

Please correct me if I am wrong.I dont want tags to be used in my code because file size is very big.Is there any solution for this?

解决方案

Start with the XmlReader[^] class to read your data and write the CSV data via a normal StreamWriter[^].


Well, you need to add all the code to extract the data from your XML document and write it to your output file. The code above writes a single blank line, so is not very useful. I suggest you spend some time studying the XMLDocument class and its methods to see how to extract the data. You will probably find some sample code on the internet if you try a Google search.


Hi
See this link

1. Convert XML to CSV, with XSL

2. an XML to CSV converter

3. http://www.csvreader.com/code/cs/xml_to_csv.php


这篇关于XML到CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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