Re: Getting data from XML
[email protected] (Jason Barnett) Sun, 18 Jul 2004 19:13:44 -0400
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
Eamon Reyn wrote: > Hey People, > > I was wondering if anyone could point me to an example or give me an example > of data extraction from an XML document where you do not necessarily know > the contents of the XML document. > > I am using PHP 5 RC3 and can see a lot of references to methods like > getelementbytagname or getbyid etc but what if the data I am getting is not > what I expected however I still want to display it. > > How do I go about this. > > Thanks in advance, > Eamon. The easy way to do this is to use SimpleXML and then iterate over each element with a foreach(). You could put this into a function if you want to recursively iterate through every element in the document.