I have a xml file and I want to retrieve the values from the message attributes into a string array from the below structure:
<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>
How can I do this using LINQ-XML?
Also if you didn’t provide full structure of xml file, then:
BTW this will return
IEnumerable<string> messages. If you want array, then applyToArray()after select operator.