【发布时间】:2009-04-15 09:15:58
【问题描述】:
这是我的 XML 文件:
<?xml version="1.0" standalone="no" ?>
<!-- This file represents The Details of the user and the responces: -->
<Survey>
<Clientdetails>
<ClientName xmlns="yash" />
<ClientCompanyName xmlns="lnt" />
<ClientTelNo. xmlns="546" />
<ClientMobileNo xmlns="56" />
<ClientEMail xmlns="56" />
</Clientdetails>
<ClientResponces>
<Question1>
<responce>1</responce>
</Question1>
<Question2>
<responce>2</responce>
</Question2>
<Question3>
<responce>3</responce>
</Question3>
<Question4>
<responce>3</responce>
</Question4>
<Question5>
<Question5.1>
<responce>3</responce>
</Question5.1>
<Question5.2>
<responce>3</responce>
</Question5.2>
<Question5.3>
<responce>2</responce>
</Question5.3>
<Question5.4>
<responce>3</responce>
</Question5.4>
<Question5.5>
<responce>3</responce>
</Question5.5>
<Question5.6>
<responce>3</responce>
</Question5.6>
<Question5.7>
<responce>3</responce>
</Question5.7>
<Question5.8>
<responce>2</responce>
</Question5.8>
<Question5.9>
<responce>1</responce>
</Question5.9>
<Question5.10>
<responce>2</responce>
</Question5.10>
<Question5.11>
<responce>0</responce>
</Question5.11>
<Question5.12>
<responce>0</responce>
</Question5.12>
<Question5.13>
<responce>0</responce>
</Question5.13>
<Question5.14>
<responce>0</responce>
</Question5.14>
<Question5.15>
<responce>0</responce>
</Question5.15>
<Question5.16>
<responce>0</responce>
</Question5.16>
<Question5.17>
<responce>0</responce>
</Question5.17>
</Question5>
</ClientResponces>
</Survey>
我想将这些数据读入 DataSet。我只想要客户给出的回答,对于第 5 个问题,我想要其 17 个子问题的平均值。
例如,DataSet 应该只包含以下内容:
1
2
3
3
4
如何在 C# 中做到这一点?
【问题讨论】:
-
嗯??你的问题是什么?您只需打开 xml 文件并插入数据即可。
-
编辑问题以正确显示 XML。
-
向我们展示您的尝试并提出具体问题。我将此标记为家庭作业,直到我看到一些努力。
-
@Cerebrus:我不确定初步标记是否有用。当您看到一些努力时,您将删除标签,此时这将成为一个 wiki,并且没有人可以再获得代表了。这是两个无用且可避免的编辑,因为您有怀疑。不太好。
-
@Tomalak:你能解释一下为什么如果标签被删除,这会变成一个维基吗?提前致谢。