我需要读取一个大的XML文件,但是我尝试过的所有内容都返回NULL。
public void readXml()
{
XElement xelement = XElement.Load(DewesoftDevices.xmlFileName);
IEnumerable<XElement> devices = xelement.Elements("Devices");
foreach (var device in devices)
{
Console.WriteLine(device);
}
}
这里是xml文件的一部分:
<?xml version="1.0" encoding="UTF-8"?>
<DataFileSetup>
<System Name="Local">
<SysInfo>
'Stuff in here that I dont need
</SysInfo>
<DewesoftSetup>
<Devices>
<StartStoreTime>43861.6768385532</StartStoreTime>
<SampleRate>100</SampleRate>
<BlockSize>1000</BlockSize>
<IBRate>10</IBRate>
</Devices>
</DewesoftSetup>
</System>
</DataFileSetup>
我不知道这是否重要,但这些文件远不及文件中的。
请尝试以下操作: