how to Retrieve Nested XML Elements with XmlDocument in C# - Need guide with XPath Expression
I'm relatively new to this, so bear with me... I'm working on a C# application where I'm using the `XmlDocument` class to parse an XML file. My XML structure looks like this: ```xml <library> <book> <title>The Great Gatsby</title> <author>F. Scott Fitzgerald</author> <genre>Fiction</genre> <ratings> <rating>5</rating> <rating>4</rating> </ratings> </book> <book> <title>1984</title> <author>George Orwell</author> <genre>Dystopian</genre> <ratings> <rating>5</rating> <rating>4</rating> </ratings> </book> </library> ``` I am trying to select all the ratings for a specific book, say "The Great Gatsby", using XPath. My current approach is as follows: ```csharp using System; using System.Xml; class Program { static void Main() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("path_to_your_xml_file.xml"); XmlNodeList ratings = xmlDoc.SelectNodes("/library/book[title='The Great Gatsby']/ratings/rating"); foreach (XmlNode rating in ratings) { Console.WriteLine(rating.InnerText); } } } ``` However, when I run this code, I don't see any output, and there are no exceptions being thrown, which makes it hard to debug. My XPath expression seems correct, but it returns an empty `XmlNodeList`. I've verified that the XML file is being loaded correctly and that the title matches exactly, including the case. I tried printing out the `InnerText` of the `book` node to confirm that the search is indeed happening, and it returns the title as expected. Additionally, I made sure there are no extra spaces or hidden characters in the XML file. Is there something I might be missing in the XPath expression, or is there any other configuration I should check? Any insights would be greatly appreciated!