I'm using php to parse my xml file, all I want to be able to do is to get the element child value from the attribute:
<question number="1">
<type>Main</type>
</question>
<question number="2">
<type>Secondary</type>
</question>
Pseudo Code (doesn't work):
$xmlDoc = new DOMDocument();
$xmlDoc->load('questions.xml');
$searchNode = $xmlDoc->getElementsByAttribute("number");
foreach( $searchNode as $searchNode ) {
if ($searchnode == "1"){
$xmlType = $searchNode->getElementsByTagName( "Type" );
$valueType = $xmlType->item(0)->nodeValue;
echo $valueType;
}else{
//Do nothing
}
}