日期:2014-05-17  浏览次数:21208 次

关于复杂XML解析成DataTable,求大神解答
XML文件如下:
<?xml version="1.0" encoding="gb2312"?>
<air_info ret_value="1" date="14SEP(FRI)" from="SHA" to="CAN" fromname="上海虹桥" toname="广州" Mileage="1308" fule_adult="130" fule_child="60">
  <airline line_number="MU5307" share_line="" company="东方航空" sc="SHA" sa="上海虹桥机场" ac="CAN" aa="广州白云机场" stime="0730" atime="0950" airrax="50" fulerax="130" fueladu="130" fuelchd="60" food="1" food_detail="S" dfly="1" type="320" et="1" stn="T2" atn="--">
  <c b="F" u="0" d="230折" p="2940" s="2" t="2"></c>
  <c b="P" u="0" d="*未知" p="0" s="0" t="Q"></c>
  <c b="A" u="0" d="*未知" p="0" s="0" t="S"></c>
  <c b="Y" u="0" d="100折" p="1280" s="A" t="A"></c>
  <c b="K" u="0" d="*未知" p="0" s="A" t="A"></c>
  <c b="B" u="0" d="95折" p="1220" s="A" t="A"></c>
  <c b="E" u="0" d="90折" p="1150" s="A" t="A"></c>
  <c b="H" u="0" d="85折" p="1090" s="A" t="A"></c>
  <c b="L" u="0" d="80折" p="1040" s="A" t="A"></c>
  <c b="M" u="0" d="77折" p="990" s="0" t="Q"></c>
  <c b="N" u="0" d="73折" p="930" s="0" t="Q"></c>
  <c b="R" u="0" d="70折" p="880" s="0" t="Q"></c>
  <c b="S" u="0" d="65折" p="830" s="0" t="Q"></c>
  <c b="V" u="0" d="55折" p="700" s="0" t="Q"></c>
  <c b="T" u="0" d="50折" p="640" s="0" t="Q"></c>
  <c b="W" u="0" d="*未知" p="0" s="0" t="Q"></c>
  <c b="G" u="0" d="*未知" p="0" s="0" t="Q"></c>
  <c b="X" u="0" d="*未知" p="0" s="0" t="Q"></c>
  <c b="Q" u="0" d="*未知" p="0" s="A" t="A"></c>
  <c b="I" u="0" d="*未知" p="0" s="5" t="5"></c>
  </airline>
</air_info>

------解决方案--------------------
//讲某路径下xml文件读入DataSet
string fileName = DataCom.UploadPath + "\\" + tableName;
if (File.Exists(fileName + ".xml") == false)
{
MessageBox.Show("没有数据包。");
return false;
}

////初始化XML架构文件操作流
//FileStream F