Question

I want to parse an xml file which stores a bunch of data near the bottom of the xml file. The files will always be small enough, well under 100kb but the data is always the last information in the file.

I am not looking for someone to tell me how to do this, im happy to do the leg work, what i don't know is the most efficient way to do this. There seems to be a bunch of possible ways, i havent done it yet but DOMdocument, fopen all seem to allow me access to the information. All im going to pull is the value of item_name, there will be more than one. here is an example

<item name="bird"></item name>
<item name="cat"></item name>
<item name="dog"></item name>

So i'm trying to retrieve all the item names, in this case bird, cat and dog is what i want.

Can someone point me in the right direction what function is best to access and read the information to parse this information.

Was it helpful?

Solution

You can instantiate SimpleXMLElement and iterate through all its items.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top