Re: How to jump into and loop through XML element
| From: | Aschwin Wesselius | Date: | Mon, 04 Aug 2008 11:49:56 +0000 |
| Subject: | Re: How to jump into and loop through XML element | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-277663@lists.php.net to get a copy of this message | ||
Ethan Whitt wrote:
PHP newbie coming over from Perl. Been trying to convert some of my Perl scripts over to PHP5. I am making a request to Amazon and receiving the following response. How can I jump down to the <Item> element and loop through all the ones that exist. I have been trying to do this with XML Simple, but with no success. Thanks, EthanHi, I'm not that much an XML guru, but I use XSL for most of the XML lookups I need. I agree, it is an extra step, but it keeps the data (XML) and the code (PHP) much more separated. XSL can make use of the XPath syntax and therefore the selections of the nodes are very easy. I haven't looked into a PHP implementation of XPath or the like (if any exists). Another step the XSL can do for you is the output formatting (hence the S for Stylesheet) and transformations (some use the XSLT for that, wich is the same in my opinion). If you have different XSL files, you can have different formatting on the same data. But anyhow Simple XML should be what it's called after.... Simple.... -- Aschwin Wesselius /'What you would like to be done to you, do that to the other....'/