HI, I want to know about the XML parsing in PHP. If anyone is having sample codes and examples, please post it here. Thanks, Krishna Srinivasan
Download from http://xmlsapiens.org their free cms. It includes xml parsing function. Really good starting point.
I use this to parse data from an external site retrieved using curl. Look here for explanations... http://www.php.net/xml_parse_into_struct $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $returnData, $vals, $index); xml_parser_free($xml_parser); //create an associative array from the return structure $nNumTags = count($vals); for ($nIndex = 0; $nIndex < $nNumTags; $nIndex++) { $strTagName = $vals[$nIndex]['tag']; $strValue = $vals[$nIndex]['value']; $strLevel = $vals[$nIndex]['level']; if($strLevel == "2") { $aResult[$strTagName] = $strValue; } } print_r($aResult); PHP: