【发布时间】:2017-03-23 05:32:25
【问题描述】:
我有一个 XML 文件,我只需要从中提取标签中的属性值。这种结构中的 XML 外观
<customer>
<customerMiddleInitial>W</customerMiddleInitial>
<name>
<FirstName>XXXXXXXX</FirstName>
<LastName> YYYYYYYY</LastName>
</name>
<customerBirth>1983-01-01</customerBirth>
<customerWorkPhone>020 1234567</customerWorkPhone>
<customerMobilePhone>0799 1234567</customerMobilePhone>
<previousCust>0</previousCust>
<timeOnFile>10</timeOnFile>
<customerId>CUST123</customerId>
</customer>
所以,我想提取标签之间的所有细节。预期的输出应该是所有客户的详细信息。
如何在 C# 中实现它? 任何帮助将不胜感激。
【问题讨论】:
-
如何在 C# 中解析 XML:msdn.microsoft.com/fr-fr/library/cc189056(v=vs.95).aspx
-
stackoverflow.com/questions/364253/… 我想你会在上面的链接中找到答案。
-
没有任何尝试过的代码,这只是许多旧的“如何在 C# 中解析 XML”有点问题的重复......
标签: c# xml xml-parsing