I have a simple issue but I don't know how to fix it. I have an XML document that looks like this
<hotel>
<rooms>
</rooms>
<rates>
<rooms>
</rooms>
</rates>
</hotel>
Now, in my code I have the following
XElement hotel = xDoc.Descendants("hotel").Single();
XElement rooms = hotel.Descendants("rooms").Single();
The last line fails because there are two rooms
nodes. What I want Descendants
to do is give the immediate descendants of the current node, not every descendant no matter where it is in the document. How is this possible?
Thanks,
Sachin