All in the <head> – Ponderings and code by Drew McLellan –

It's just this damn XML

I started working on a nice little personal project in PHP. It has a specific real-world use, and in evaluating the approaches I could take with the design, I decided that it didn’t need a database. Rare for me. I like databases. The only data this application needs to store is general system configuration settings, which I thought would be best stored as a simple XML file. I like XML – much more than databases.

So I began carrying out proof-of-concepts on each of the major parts of the project. I searched on the excellent php.net for the XML functions, and found them. Hmm.

Why is PHP’s XML implementation so crap? How has it managed this long without DOM support? I can see it’s on its way, but how has everyone been managing? Do PHP developers not care about XML?

I’ve settled with parsing my XML file out into an array of arrays (yuk), which is useable but hideous and putrid. I think I’m going to have to design my application in such a way as when DOMXML is widely supported in general PHP installations I’ll be able to easily recode to make use of it. At least there’s an interesting challenge in that.

Seriously, I’m not having a rant, I really want to know this. How do PHP developers deal with XML without a DOM? What do you use? Is there something altogether DOM-tastic out there that I’m missing?

I’ve had no problems with other parts of the project. The bit which I thought would be difficult (POP3 integration) was as easy as pie, if not easier. So praise be. It’s just this damn XML.