Best XML Parser for PHP

Murat Ayfer picture Murat Ayfer · Oct 9, 2008 · Viewed 187.3k times · Source

I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.

I recently saw SimpleXML but I haven't tried it yet. Is it any simpler? What advantages and disadvantages do both have? Any other parsers you've used?

Answer

Robert K picture Robert K · Oct 9, 2008

I would have to say SimpleXML takes the cake because it is firstly an extension, written in C, and is very fast. But second, the parsed document takes the form of a PHP object. So you can "query" like $root->myElement.