dear everyone, my problem is that i made xml nodes in variable and then i tried to explode it
my xml is
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<channel>
<request>
<username>username</username>
<request_id>11111</request_id>
<request_type>request_type</request_type>
<reply_table>
<mydata>
<first_td>0001AA</first_td>
<second_td>N</second_td>
<third_td>N</third_td>
<fourth_td />
<fifth_td>SU</fifth_td>
<sixth_td> HELP DESK</sixth_td>
</mydata>
<mydata>
<first_td>0009IO</first_td>
<second_td>N</second_td>
<third_td>N</third_td>
<fourth_td />
<fifth_td>SU</fifth_td>
<sixth_td> KARIM MOHA</sixth_td>
</mydata>
<mydata>
<first_td>0099PO</first_td>
<second_td>N</second_td>
<third_td>N</third_td>
<fourth_td />
<fifth_td>SU</fifth_td>
<sixth_td> KAMAL AHME</sixth_td>
</mydata>
</reply_table>
</request>
<request>
<username>username</username>
<request_id>11111</request_id>
<request_type>request_type</request_type>
<reply_table>
<mydata>
<first_td>0001AA</first_td>
<second_td>N</second_td>
<third_td>N</third_td>
<fourth_td />
<fifth_td>SU</fifth_td>
<sixth_td> HELP DESK</sixth_td>
</mydata>
<mydata>
<first_td>0009IO</first_td>
<second_td>N</second_td>
<third_td>N</third_td>
<fourth_td />
<fifth_td>SU</fifth_td>
<sixth_td> KARIM MOHA</sixth_td>
</mydata>
</reply_table>
</request>
</channel>
i want to explode it using the tag <request>, i made it by using for each
$dom= new DOMDocument();
$dom-> loadXML($xmlo);
$counter=1;
$channel=$dom->getElementsByTagName("channel"); // first node of xml
$request=$dom->getElementsByTagName("request");// sub node of xml
foreach( $request as $data_result)
{
/// code goes here
// exploding < mydata>inside the for each of request
}
the problem is in the nodes <mydata> and its inner nodes,
example: the node <first_td> exists 3 times in first request and 2 times in second request, but when I tried to explode it by using for each loop, it shows the 5 nodes at same time,
so how to solve this