SimpleXML Vs. SXML
I had a chance to really play with PHPs native XML support.
It's interesting, but a little leaky in its abstraction. I had to futz around with the options to make it recognize CDATA sections, which involved passing options to libxml.
$xml = simplexml_load_file($file, 'SimpleXMLElement', LIBXML_NOCDATA);
Additionally, trying to serialize and unserialize SimpleXML objects is a dirty, hacky job. I didn't even bother trying to tackle that (though others have). In Short, native support for xml, isn't quite native inside of PHP.
This is quite a contrast from sxml, (S-expression XM) where it Just Works™. If I recall, the code to parse an xpath expression in SXML is dirt easy. On top of that, working with xml as native scheme/lisp lists is like mana from heaven! Though I guess PHP has native xpath as part of SimpleXML, but I wonder how easy it would be to write an xpath parser?
Anyway, Native XML handling, no matter the language, rocks.

Comments
Post new comment