我从数据库中得到xml的数据
<?xml version="1.0" encoding="utf-8"?>
<root Title="001" Type="line" LineColor="R,G,B,1" LineWidth="1" LineType="Solid">
<Section Title="KSS1" StartPoint="0" FinishPoint="50" >
<Description Spread="KSS1" />
<Description LastDate="08 22 2008" />
<Description Direction="--->" />
<Description ActualCumm="69" />
<Description Kilometer="69" />
</Section>
<Section Title="KSS2" StartPoint="0" FinishPoint="50" >
<Description Spread="KSS2" />
<Description LastDate="08 22 2008" />
<Description Direction="--->" />
<Description ActualCumm="65" />
<Description Kilometer="69" />
</Section>
</root>
这是一张表datatable.我想用代码把它写成Line1_001.xml,请问怎么做?
------解决方案--------------------------------------------------------
这是表里面的某个字段吧
先把它放到一个string里面,然后
- C# code
string str = "";//字段值,也就是那段XML XmlDocument doc = new XmlDocument(); doc.LoadXml(str); doc.Save("Line1_001.xml");