I have a question regarding reading an xml file with php. I have a sample php file:
///file.xml
<appender name="app1">
<param name="param1"></param>
</appender>
Now i want to get the value of the param name. I have this code.
function getURL($aURL){
$objDOM = new DOMDocument();
////the file.xml
$objDOM->load($aURL);
$note = $objDOM->getElementsByTagName("appender");
foreach ( $note as $value) {
///First try
$name = $value->getElementsByTagName("name")->firstChild->nodeValue;
///Second try
///$logName = $value->getElementsByTagName("name");
///$name = $logName->item(0)->nodeValue;
}
}
For my First and Second try both returns empty. Does not give the "app1" value.
Can someone help me on this?
Thank you.