Hi,
I couldnt find an answer to my question in the php manual, so i try it
here.
Basically i just want to know if the following is possible.
Suppose you have this xml file:
<root>
<news id="1">
<title>Test</title>
<message>Just a test</message>
</news>
<news id="2">
<title>Test 2</title>
<message>yet another test</message>
</news>
</root>
And then you do the following xpath query:
$nodes = $xpath->query("./news/*", $dom->documentElemen t);
Now, how can i tell how many childs news has? Because $nodes has 4
elements, so one news element could have 4 childs or there are 2 news
elements with 2 childs...
Is there a solution?
I couldnt find an answer to my question in the php manual, so i try it
here.
Basically i just want to know if the following is possible.
Suppose you have this xml file:
<root>
<news id="1">
<title>Test</title>
<message>Just a test</message>
</news>
<news id="2">
<title>Test 2</title>
<message>yet another test</message>
</news>
</root>
And then you do the following xpath query:
$nodes = $xpath->query("./news/*", $dom->documentElemen t);
Now, how can i tell how many childs news has? Because $nodes has 4
elements, so one news element could have 4 childs or there are 2 news
elements with 2 childs...
Is there a solution?
Comment