using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
class Program
{
static void Main()
string xmlData = @"<html>
<head></head>
<body>
<document>
<Name>Carl</Name>
<Surname>Smith</Surname>
<Age>40</Age>
<Gender>M</Gender>
</document>
</body>
</html>";
XDocument doc = XDocument.Parse(xmlData);
// Extract values into a list of strings
List<string> values = doc.Descendants("document")
.Elements()
.Select(element => element.Value)
.ToList();
// Print the values
values.ForEach(Console.WriteLine);
}