I’m a beginner at processing XML with PHP. I have just started reading about SimpleXML and related methods of parsing data from XML files, but I’m struggling with it. Once PHP has the data, I’ll be in fairly familiar territory, but the part before that is not so easy!
The examples that I have so far seen show how to, for instance, find and display all names from an address book or all titles from data about books. But I would like to know if it is possible to fetch selected sets of data from a small XML file (maybe 50-60 datasets) based on certain criteria, which are:
- The first 5 entries
- Entries that match certain categories
An example of one complete dataset would be something like this:
<page>
<date>01 May 2010</date>
<url>http://www.example.com/articlename.php</url>
<title>Page title</title>
<desc>Description of page</desc>
<category>Category1,Category2</category>
</page>
I understand that a CMS can do this sort of thing and more, but that wouldn’t be the right solution for me (I’m happier when just coding my own pages) and would entail changing my service provider (and paying a lot more).