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