From documentation:
Skips the child elements of the current node.
Here is code:
var reader = DocumentFormat.OpenXml.OpenXmlReader.Create(worksheetPart);
// Header
while (reader.Read())
{
if (reader.ElementType == typeof (Row)) // reader is at row r="1"
{
headers = GetHeaders((Row)reader.LoadCurrentElement(), _doc.WorkbookPart);
reader.ReadNextSibling(); // reader is at row r="2"
break;
}
}
//...
reader.Skip(); // reader is at row r="3"
Worksheet xml (cut):
<x:sheetData xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:row r="1" spans="1:1">
<x:c r="A1" s="1" t="s">
<x:v>36</x:v>
</x:c>
</x:row>
<x:row r="2" spans="1:1"> <!-- before calling Skip reader is here -->
<x:c r="A2" s="1" t="s">
<x:v>38</x:v>
</x:c>
</x:row> <!-- I expect reader to be here after calling Skip because closing tag != child element -->
<x:row r="3" spans="1:1"> <!-- after calling Skip reader goes here -->
<x:c r="A3" s="1" t="s">
<x:v>38</x:v>
</x:c>
</x:row>
</x:sheetData>
Why Skip
skips also </x:row>
?
<x:row>
is the start tag (marks the beginning) and </x:row>
is the end tag (marks the end) of one element in a XML file.
When you have parsed the XML document it is represented as tree of node objects, each node having parents, siblings and children.
So don't confound the representation as tree in memory with the representation as file.