c# - How OpenXmlReader.Skip supposed to work? -


from documentation:

skips child elements of current node.

here code:

var reader = documentformat.openxml.openxmlreader.create(worksheetpart);  // header while (reader.read()) {     if (reader.elementtype == typeof (row)) // reader @ row r="1"     {         headers = getheaders((row)reader.loadcurrentelement(), _doc.workbookpart);         reader.readnextsibling(); // reader @ row r="2"         break;     } }  //... reader.skip(); // reader @ 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 here -->       <x:c r="a2" s="1" t="s">         <x:v>38</x:v>       </x:c>   </x:row> <!-- expect reader 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 </x:row>?

<x:row> start tag (marks beginning) , </x:row> end tag (marks end) of one element in xml file.

when have parsed xml document represented tree of node objects, each node having parents, siblings , children.

so don't confound representation tree in memory representation file.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -