PHP DOM vs SimpleXML for Atom GData feed parsing

Posted by Geoff Adams on Stack Overflow See other posts from Stack Overflow or by Geoff Adams
Published on 2010-05-24T14:00:14Z Indexed on 2010/05/24 14:11 UTC
Read the original article Hit count: 528

I'm building a library to access the Google Analytics Data Export API. All the data the library accesses is in Atom format and utilises numerous different namespaces throughout. My experiments with the API have used SimpleXML for parsing so far, especially as all I have been doing is accessing the data held within the feed.

Now I'm coming to write a library I am wondering whether forging ahead with SimpleXML will be adequate or whether the enhanced functionality of the DOM module in PHP would be of benefit in the future. I haven't written much code for this part of the library yet so the choice is still open.

I have read that the PHP DOM module can be a better choice if you need to build an XML DOM on the fly or modify an existing one, but I'm not entirely sure I would need that functionality anyway due to the nature of the API (no pushing data to the server, for instance). SimpleXML is certainly easier to use and I have seen people saying that for read-only situations it is all you need.

Essentially the question is, what would you use? Compatibility will not be an issue as the server configuration will match the application's requirements. Is it worth building the library with PHP DOM in mind or should I stick with SimpleXML for now?

Update: Here are two examples of the kind of feeds I will be dealing with:

  1. Account feed
  2. Data feed

© Stack Overflow or respective owner

Related posts about php

Related posts about simplexml