Extending SimpleXML

I posted a while ago about problems with extending SimpleXML (which I intend to do so I can add automatic microformat support). Well I think I’ve come up with a solution. I’ve created a class called ExtendXML that is completely extendable (see the other post for an explanation of why SimpleXML isn’t extendable) that provides all of the functionality of SimpleXML. The initial call is similar to using SimpleXML (except I made the functions static class methods instead): ExtendXML::load_string($xmlString, [$class, [$simpleClass]]); ExtendXML::load_file($xmlFile, [$class, [$simpleClass]]); The $class argument contains the name of the class that will be returned. This should extend ExtendXML and defaults to ExtendXML. The $simpleClass argument contains the name of the SimpleXML class that will be passed to SimpleXML functions. This should extend SimpleXMLElement and defaults to SimpleXMLElement. The object returned can then be used the same as a SimpleXMLElement object. I haven’t tested it much or documented it yet, but it supports child tags (returning objects are of the class ExtendXML or whatever you specified), attributes and xpath expressions. ExtendXML PHP5, OOP, ArrayAccess, SPL, programming, code, tutorial, microformats, XML, SimpleXML