title: PHP5: Iterating through a list of child nodes (equivalent of child_nodes())?
body: <p>All,</p>
  
  <p>I have an XML document that looks something like this:</p>
  
  <pre><code>&lt;root&gt;
      &lt;profile&gt;
          &lt;childA&gt;
          &lt;childB&gt;
          &lt;childC&gt;
      &lt;profile&gt;
      &lt;blah&gt;
      &lt;blah&gt;
      &lt;foo&gt;
      &lt;bar&gt;
  &lt;root&gt;
  </code></pre>
  
  <p>I'd like to be able to grab the 'profile' node, then iterate through it's children ('childA', 'childB', etc)</p>
  
  <p>So far, my code looks like this:</p>
  
  <pre><code>$doc = new DomDocument();
  $doc-&gt;loadXML(file_get_contents("php://input"));
  $profile_node = $doc-&gt;getElementsByTagName("profile")-&gt;item(0);
  </code></pre>
  
  <p>So far, so good. $profile_node has what I want.</p>
  
  <p>In PHP4, I guess you'd do something like this:</p>
  
  <pre><code>$childnodes = $profile_node-&gt;child_nodes();
  foreach ($childnodes as $node) {
      // do something with this node
  }
  </code></pre>
  
  <p>But, I can't find the equivalent of child_nodes() in PHP5.</p>
  
  <p>Since I'm pretty much a noob regarding PHP, I'd really appreciate a code example, so I can see the exact syntax.</p>