Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I can't stand PHP's DomDocument OR SimpleXML. I think it's mainly PHP's libraries at fault, though - I've made short work of tasks that were quite annoying in PHP using Beautiful Soup in Python.


PHP's DomDocument is pretty much the same as every other platform's DomDocument. Nearly the whole XML API universe is full of suck.


There are neat implementations out there. I particularly like C#'s LInQ for XML. Lets you shred that (untyped) XML into strongly typed objects faster than you can say "wow that's declarative".

If you have a typed format (i.e. XSD), there are enough tools out there to generate the code <-> XML interchange boilerplate. In C#, this is typically solved by creating a serializable class with attributes/annotations denoting what XML nodes the actual class-properties map to. Again, fairly painless. And declarative.

If your main beef with XML is that the libraries you have to work with is an exact replica of the W3C DOM-model, then it is your tooling which sucks. XML is just fine, when used correctly ofcourse.

Think how jQuery managed to make writing JS fun, as opposed to when you had to work with the plain DOM. HTML is not that far from XML and if tooling can make that kind of difference, judging a technology exclusively based on your lacking libraries (or lack of exposure to good ones) can really not be considered fair by any means.

Now with that said, I find JSON nice as well, but for different reasons and with different drawbacks.


> Think how jQuery managed to make writing JS fun, as opposed to when you had to work with the plain DOM.

Speaking of that, http://code.google.com/p/phpquery/ is an interesting project. I haven't used it, but it seems like it could make some XML parsing less strenuous.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: