<![CDATA[I've added two new public static function to
The first one is
registerTagClass. This takes two arguments, the first is a tag name and the second is a class (that extends
ExtendXML. This will make all children of that tag name become that class instead.
The second is
registerTagCallback. This takes one argument, a callback. That callback must take one argument, a tag name and must return the class (as a string) that those tags should become.
If for example you were parsing HTML and you wanted all paragraph
p tags to be handled by
ParagraphXML, you could use:
A word of warning, it’s case sensitive. If a callback is registered this will be used regardless of any calls to
If you’ve never used callbacks before, they take one of three forms. Either a string that is the name of a function, an array with the first element a class name (as a string) and the second element a static method of that class (as a string) or finally, as an array with the first element an object and the second element a method of that object.
EXML, ExtendXML, SimpleXML, XML, parsing XML, PHP5, callbacks, programming, coding, parsing HTML, OOP]]>