title: How to use TinyXml to parse for a specific element
body: <p>I would like to parse a group of elements out of a <code>TinyXml</code> output. Essentially, I need to pick out any port element's <code>"portid"</code> attribute of the port has a state of <code>"open"</code> (shown below for port 23).</p>
  
  <p>What's the best way to do this? Here's the (simplified) listing for the output from TinyXml:</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;nmaprun&gt;
      &lt;host&gt;
          &lt;ports&gt;
              &lt;port protocol="tcp" portid="22"&gt;
                  &lt;state state="filtered"/&gt;
              &lt;/port&gt;
              &lt;port protocol="tcp" portid="23"&gt;
                  &lt;state state="open "/&gt;
              &lt;/port&gt;
              &lt;port protocol="tcp" portid="24"&gt;
                  &lt;state state="filtered" /&gt;
              &lt;/port&gt;
              &lt;port protocol="tcp" portid="25"&gt;
                  &lt;state state="filtered" /&gt;
              &lt;/port&gt;
              &lt;port protocol="tcp" portid="80"&gt;
                  &lt;state state="filtered" /&gt;
              &lt;/port&gt;
          &lt;/ports&gt;
      &lt;/host&gt;
  &lt;/nmaprun&gt;
  </code></pre>