im getting the error as Fatal error: Call to undefined method DOMText::getAttribute()
is there any error in the php code,if not is then how can i parse through the document.
this is the xml
<?xml version="1.0" encoding="UTF-8" ?>
<v>
<var type="app" vrs="1.4.9.0" />
<var type="prof" vrs="20061204014012" />
<var type="vars" vrs="20070222010025" />
<var type="mod" vrs="20070314043540" />
</v>
this is the php code im using to parse the xml
<?
$objXDom = new domDocument();
$objXDom->load($versionXMLPath);
$arrTypes = array('app', 'prof', 'vars','mod');
list($arrTypes['AppVersion'], $arrTypes['Profile'], $arrTypes['AppwiseSettingVar'], $arrTypes['modules']) = $arrTypes;
$pstrType='modules';
$pstrValue='20070314';
//echo $arrTypes[$pstrType]."<br>";
foreach ($objXDom->documentElement->childNodes as $objChild)
{
if ($objChild->getAttribute('type') == $arrTypes[$pstrType] )
{
//$objChild->->set_value("Hello");
$attrs = $objChild->attributes;
$objChild->setAttribute ( 'vrs',$pstrValue) ;
// echo $objChild->getAttribute('name');
//echo $attrs;
}
}
?>