Since
reader.GetAttribute("28")
doesn't get the attribute with a value of "28", I'm not surprised you get no output. It gets the attribute with the name of "28", and that wouldn't be a valid attribute name.
So find the correct type of element first.
Then get the attribute by the correct name.
Then check if its value is 28.
The
inner.Read()
loop should be using
inner
instead of
reader
:
while (inner.Read())
{
if (inner.Name == "title")
{
data.Add(inner.ReadString());
}
}
Finally to write all the strings of a
List<string>
to the
Console
, try:
data.ForEach(Console.WriteLine);