title: Select inner/child Elements with HtmlAgilityPack
body: <p>I would like to extract the both source attributes from this html-snippet:</p>
  
  <pre><code>&lt;audio controls&gt;
  &lt;source src="horse.mp3" type="audio/mpeg"&gt;
  &lt;source src="horse.ogg" type="audio/ogg"&gt;
  &lt;embed height="50" width="100" src="horse.mp3"&gt;
  &lt;/audio&gt;
  </code></pre>
  
  <p>Here is what I do:</p>
  
  <p>First off all, im extracting all audio-tags (including the one you can see above):</p>
  
  <pre><code>var audio_tags = HtmlDoc.DocumentNode.SelectNodes("//" + HTML.TAG_AUDIO); 
  </code></pre>
  
  <p>After that, I try to extract the source-elements using from the HtmlNodeCollection audio_tags using this piece of code:</p>
  
  <pre><code>foreach (HtmlNode link in audio_tags)
          {
              if (link != null)
              {
                  string url;
                  string type;
                  // select all source tags, see here for an example: http://www.w3schools.com/html/html_sounds.asp
                  if(link.HasChildNodes)
                  {
                      var children = link.ChildNodes;
                      if (children != null)
                      {
                          foreach (HtmlNode child in children)
                          {
                              Console.WriteLine(children[0].GetAttributeValue("type", "err").ToString() + "||" + children[0].OriginalName);
                              Console.WriteLine(children[1].GetAttributeValue("type", "errrr").ToString() + "||" + children[1].OriginalName);
   ...
  </code></pre>
  
  <p>The writelines indicate, that the first element isn't existing, because "err" is printed. But it should rather be the first source-element. I'd be glad about some hints.</p>
  
  <p>edit:</p>
  
  <p>The output from those writlines is:</p>
  
  <pre><code> err||#text
   audio/mpeg||source
  </code></pre>
  
  <p>And the nr. of elements of children is 2.</p>