Re: PACKAGE PROPOSAL: XML_XMLPull

From: Date: Sat, 13 Sep 2003 10:25:43 +0000
Subject: Re: PACKAGE PROPOSAL: XML_XMLPull
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21465@lists.php.net to get a copy of this message
Understood - I'll have a look at what I can do with XML_Parser - can see Thomas's angle. My main "agenda" is I'd like to see the Pull API work with both Expat and PEAR::XML_HTMLSax. OK - so back the drawing board ;) using XML_Parser. On Sat, 13 Sep 2003 11:58:03 +0200, <nicos@php.net> wrote:
"Tomas V.V.Cox" <cox@idecnet.com> a écrit dans le message de news:5513049884.20030913080032@idecnet.com...
On Saturday, September 13, 2003 1:07, Harry Fuecks wrote:
Would like to propose PEAR::XML_XMLPull, which is a pull based API for parsing XML, that (arguably) makes it alot easier to parse XML. I've prepared a PEAR package (0.1.0rc1) here: http://sourceforge.net/project/showfiles.php?group_id=87488&release_id=184205 - you need to have PEAR::XML_SaxFilters 0.2.0 installed first to run the example.
Essentially what XMLPull does is eliminate the need for handler functions (as with the SAX API) and rather deal with something like a switch statement, e.g.;
while ( $event = $parser->parse() ) {
    switch ( $type = $event->getType() ) {
        case XML_PULL_START_TAG:
                // Start tag handled here
        break;
        case XML_PULL_END_TAG:
                // End tag handled here
        break;
        case XML_PULL_TEXT:
                // Character data handled here
        break;
    }
}
There's more info on XML Pull at http://www.xmlpull.org (the API I've defined only loosely conforms to the Java API described there).
This stuff can be implemented in less than 30 lines of code extending XML_Parser. If you people fell that pull "style" parsing is interesting, I'd provide it as addon of XML_Parser but not as a bloated separate package IMHO. It even provides not related stuff like var streaming while we already have a package for it. Sorry if I sound harsh, just haven't still slept, hope you get my point.
+1 for an implementation in XML_Parser.
-- Tomas V.V.Cox                          mailto:cox@idecnet.com


« previous php.pear.dev (#21465) next »