title: LINQ to XML Take next node from XML
body: <p>I have the following XML</p>
  
  <pre><code> &lt;File Path="NA"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;               
                 &lt;DocType&gt;Invoice&lt;/DocType&gt;                              
             &lt;/Fields&gt;
   &lt;/File&gt;
   &lt;File Path="C:\tmp\test.pdf"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;       
                 &lt;DocType&gt;Check&lt;/DocType&gt;               
             &lt;/Fields&gt;
   &lt;/File&gt;
   &lt;File Path="NA"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;               
                 &lt;DocType&gt;PO&lt;/DocType&gt;                              
             &lt;/Fields&gt;
   &lt;/File&gt;
   &lt;File Path="NA"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;               
                 &lt;DocType&gt;300&lt;/DocType&gt;                              
             &lt;/Fields&gt;
   &lt;/File&gt;
   &lt;File Path="NA"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;               
                 &lt;DocType&gt;Invoice&lt;/DocType&gt;                              
             &lt;/Fields&gt;
   &lt;/File&gt;
   &lt;File Path="C:\tmp\test2.pdf"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;       
                 &lt;DocType&gt;Bill&lt;/DocType&gt;               
             &lt;/Fields&gt;
   &lt;/File&gt;
  </code></pre>
  
  <p>I am looking to take the File Node/Element that follows any time the DocType element is Invoice.</p>
  
  <p>I have tried using the following Linq:</p>
  
  <pre><code>    var files = xmlDoc.Descendants("File")
       .Where(e =&gt; e.Element("Fields").Element("DocType").Value == "Invoice")
              .Skip(1).ToList();
  </code></pre>
  
  <p>But that is just returning all the file elements with the Invoice Doc Type skipping the first one. I need the correct linq syntax to get the following nodes/elements. Basically any node that follows the Invoice DocType node. Any help would be appreciated.</p>
  
  <pre><code>&lt;File Path="C:\tmp\test.pdf"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;       
                 &lt;DocType&gt;Check&lt;/DocType&gt;               
             &lt;/Fields&gt;
   &lt;/File&gt;
  &lt;File Path="C:\tmp\test2.pdf"&gt;
             &lt;Fields&gt;
                 &lt;Side&gt;F&lt;/Side&gt;       
                 &lt;DocType&gt;Bill&lt;/DocType&gt;               
             &lt;/Fields&gt;
   &lt;/File&gt;
  </code></pre>