【发布时间】:2014-06-15 15:48:33
【问题描述】:
我是 C#、Silverlight 5 和 XAML 初学者的新手。我正在做一个 VS-2012 项目,我不需要使用任何 CycleClip Board Ring 来完成这项任务。我的 VS 项目中有一个 XML 文件。假设文件如下:
FileName is FileXml.xml
<?xml version="1.0" encoding="utf-8" ?>
<parameter>
<name>mounts</name>
<unit></unit>
<component>
<type>List</type>
<attributes>
<type>Integer</type>
<displayed>4</displayed>
<add_remove>yes</add_remove>
<item>25</item>
</attributes>
<attributes>
<ccypair>XAUUSD</ccypair>
<item>100</item>
</attributes>
</component >
</parameter>
我必须解析这个 XML 文件,并且必须在 C# 中创建对象。这样我才能使用“bands_amounts”(名称)和通过这些对象访问的所有其他元素。如何使用 C# 代码做到这一点?
【问题讨论】:
标签: c# xml object xml-parsing xml-serialization