From: olivier T. <ot...@zo...> - 2007-05-25 06:12:53
|
Hello, I've been writing event handling code for the SPO parser[1], and since the APIs are so similar, I've been thinking that it would be great if the handlers could be used for SAX parsing, too. Of course, they are similar, but not identical, and I've been running into walls trying to use the same handlers for different parsers, e.g, in no particular order $element->{Attributes}->{$attr}->{Value} versus @{$element->{Attributes}->{$attr}->{CdataChunks}} or, get_location versus location (or the set_document_locator() event, even though apparently there are too few SAX parsers that seem to implement it...) etc. And I end up building handler code that tries one, then fails, then try the other, and eventually somewhat works. What I am wondering, and I was thinking you may be able to help me, is: * Is there any plan/effort to get the two APIs any closer? (doubt it, they've both been around for a while) * Has anyone ever built a list of the differences between the two APIs? * Has anyone ever worked on some kind of "converter" that would be put between the SPO parser and a SAX handler, or vice versa. Bjoern [2] maybe? Or is this a futile idea? [1] http://search.cpan.org/dist/SGML-Parser-OpenSP/ [2] http://aspn.activestate.com/ASPN/Mail/Message/2154830 Thanks! -- olivier |