Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

how to skip to 2nd Element

$
0
0

Hi Guys,

I was trying to get the value of the 2nd <Row>..<Cell> values but my linq wont work. I can't even get the first <Row>..<Cell> at all (query below).

var query = doc.Root.Elements("Worksheet").Elements("Table").Elements("Row").Select(x => (string)x).ToList();

Kindly help

<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" 
 xmlns:o="urn:schemas-microsoft-:office:office" 
 xmlns:x="urn:schemas-microsoft-com:office:excel" 
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" 
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  <Version>14.00</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <AllowPNG/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>9997</WindowHeight>
  <WindowWidth>9997</WindowWidth>
  <WindowTopX>121</WindowTopX>
  <WindowTopY>136</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s62">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
   <Interior/>
   <NumberFormat ss:Format="@"/>
   <Protection/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Table">
  <Table ss:ExpandedColumnCount="10" ss:ExpandedRowCount="3" x:FullColumns="1"
   x:FullRows="1" ss:DefaultColumnWidth="51.267015706806284"
   ss:DefaultRowHeight="14.32460732984293">
   <Column ss:Width="40.712041884816756"/>
   <Column ss:StyleID="s62" ss:Width="126.282722513089"/>

   <Row>
    <Cell ss:StyleID="s62"><Data ss:Type="String">Panel ID</Data></Cell>
    <Cell><Data ss:Type="String">Panel Name</Data></Cell>

   </Row>
   <Row>
    <Cell><Data ss:Type="Number">1490</Data></Cell>
    <Cell><Data ss:Type="String">13.8kV MAIN SWITCHGEAR</Data></Cell>

   </Row>
   <Row>
    <Cell><Data ss:Type="Number">2314</Data></Cell>
    <Cell><Data ss:Type="String">test1</Data></Cell>

   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>9</ActiveRow>
     <ActiveCol>5</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>