Re: How to jump into and loop through XML element

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, Ethan

Hi,

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....'/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux