I have this following XML
<Logs>
<UnplugDate>
<Date>2013-09-10T09:20:00</Date>
<Date>2013-09-09T16:03:00</Date>
</UnplugDate>
What I'm trying to do here is to read the values of both variables under <UnplugDate> tag.
I try to use the hasChildNodes() but when I debug It doesn't go inside
foreach($unplug_date as $node)
block.
Any Idea how can I read these values? Thanks in advance
$logs = $key->getElementsByTagName(tag_constants::TAG_LOGS);
$unplug_date = $logs->item(0)->getElementsByTagName(tag_constants::TAG_UNPLUG_DATE)->item(0);
foreach($unplug_date as $node) {
if($node->hasChildNodes()) {
foreach ($node->childNodes as $unplug_date_value) {
$unplug_date_value = $unplug_date->getElementsByTagName(tag_constants::TAG_DATE)->item(0)->nodeValue;
}
}
}
NOTE:
tag_constants::TAG_LOGS -> Logs
tag_constants::TAG_UNPLUG_DATE -> UnplugDate
tag_constants::TAG_DATE -> Date