title: yaml-cpp InvalidNode exception
body: <p>I am attempting to use yaml-cpp to process the following yaml:</p>
  
  <pre><code>- hosts: localhost
    tasks:
      - shell: whoami
      - shell: hostname
  </code></pre>
  
  <p>I have a constraint that I do not control the yaml coming in. It seems overly complex to me, but I have to process that.</p>
  
  <p>Looking at <a href="http://yaml-online-parser.appspot.com/?yaml=-+hosts%3A+localhost%0A++tasks%3A%0A++++-+shell%3A+whoami%0A++++-+shell%3A+hostname&amp;type=canonical_yaml" rel="nofollow">http://yaml-online-parser.appspot.com/?yaml=-+hosts%3A+localhost%0A++tasks%3A%0A++++-+shell%3A+whoami%0A++++-+shell%3A+hostname&amp;type=canonical_yaml</a></p>
  
  <p>shows the yaml as good.</p>
  
  <p>I am using the following code to try to get to the tasks:</p>
  
  <pre><code>YAML::Node pb = YAML::LoadFile(str_pbFilename);
  
  printNodeInfo(pb);
  
  if (pb.Type() == YAML::NodeType::Sequence)
  {
      int count = 0;
      for (YAML::const_iterator it = pb.begin(); it != pb.end(); ++it)
      {
          if (it-&gt;first)
          {
              cout &lt;&lt; "found first" &lt;&lt; endl;
          }
          count++;
          cout &lt;&lt; "count = " &lt;&lt; count &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>exception when I attempt to access anything it-> related (first or second) inside the iteration for loop:</p>
  
  <pre><code>Unhandled exception at 0x7524C41F in ProcYaml.exe: Microsoft C++ exception: YAML::InvalidNode at memory location 0x0040F748.
  </code></pre>
  
  <p>printNodeInfo(pb) shows:</p>
  
  <pre><code>  Node size: 1
    Node Tag: ?
    Node is of Type: Sequence
  </code></pre>
  
  <p>I am uncertain what I need to do to process this first Sequence node and get into the elements that I need: the hosts and the tasks to process for each host.</p>
  
  <p>count prints out as 1 when I remove the exception throwing code (if (it->first) {...})</p>
  
  <p>I guess my main misunderstanding in this is: How am I to do anything with pb if I cannot iterate over it? I am new to yaml and yaml-cpp, so I am sure there is a noob factor here.</p>