I have an loaded an XML document with the following structure:
<?xml version="1.0" encoding="UTF-8" ?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<sheetData>
<row r="1" spans="1:2">
<c r="A1" t="s">
<v>0</v>
</c>
<c r="B1" t="s">
<v>1</v>
</c>
</row>
</sheetData>
</worksheet>
I want to query the document for any elements named c
that has the attribute t = s
.
I have tried many different variations on how to do this:
XDocument xmlDoc = XDocument.Load(@"..\..\Sheet1.xml");
var rows = from row in xmlDoc.Root.Descendants("worksheet").Elements("sheetData")
select row;
But it always returns an empty set.
What am I missing?