我有一个 xml 文件,我想将message
属性中的值从string
以下结构中检索到数组中:
<Exceptions>
<Exception Name="Address">
<Error id="Line1" message="Address Line 1 is required"/>
<Error id="Line1Length" message="Address Line 1 must be in-between 1 and 50"/>
<Error id="Line2Length" message="Address Line 2 must be in-between 1 and 50"/>
</Exception>
<Exception Name="Email">
<Error id="Line1" message="Email is required"/>
</Exception>
</Exceptions>
如何使用 LINQ-XML 做到这一点?