Using LINQ, How do I only get the author element value for the following XML:
<?xml version="1.0" encoding="utf-8"?>
<quotes>
<category name="Sport">
<author>James Small
<quote>Quote One</quote>
<quote>Quote Two</quote>
</author>
</category>
<category name="Music">
<author>
Stephen Swann
<quote />
</author>
</category>
</quotes>
I’m new to LINQ but I’ve tried
Dim quotesXMLList As IEnumerable(Of XElement) = From n In q.Descendants("category") _
Select n
For Each n In quotesXMLList
authorList.Add(n.Value)
Next
but n.value returns the author and all the child element values.
This query returns all the author names: