Re: Php.XPath 3.2 released!!
Brought to you by:
bs_php,
nigelswinson
From: Tim U. <ti...@di...> - 2002-07-22 15:50:06
|
Hello all. I was using a very old version of phpxpath and have been reluctant to upgrade because it has been working so well for me. SInce I lurk here I knew the later versions were faster so I finally downloaded the latest version and decided to test it. It turns out that phpxpath is now a whole new animal and the API has changed quite a bit. Here is a snippet of how I was using this class. $xml = new XPath(); $xml->load_string ($results_xml); $a = $xml->get_attributes($xml->root); $resultcount = $a['COUNT']; if ($resultcount): // we know we have results so let's deal with them. $results = $xml->evaluate("/RESULTS/RESULT"); foreach ($results as $result): // everything we need is in here. $atrributes = $xml->get_attributes($result); $cases = $xml->evaluate($result . '/CASES/CASE'); foreach ($cases as $case): $case = $xml->get_attributes($case); foreach ($case as $key => $value): Do something here with the case attributes. endforeach; endforeach; endforeach; else: $error .= "No results found"; endif; To me this was a very neat way of dealing with XML files. Has this all now gone away? What is the eqavalent code in the new API. :wq Tim Uckun US Investigations Services/Due Diligence http://www.diligence.com/ |