[Home] [By Thread] [By Date] [Recent Entries]
On Sun, Nov 25, 2001 at 02:17:08AM -0800, Dare Obasanjo wrote: | the push model the API calls your methods as it sees parts of the | XML stream while in the pull model you are in complete control of | traversing the XML stream. | | One way of looking at it is that in the pull model, the big | while loop that iterates through all the nodes in document is | hidden from you while in pullmodel you're the one that writes it. vs. On Sun, Nov 25, 2001 at 01:44:33AM -0800, Dare Obasanjo wrote: | From where I sit they are very different. Batch parsing is loading an entire | stream or string into the DOM in one step with a loadXML or similar method, | then interacting with the XML from the DOM. Pull parsing is at the other end | of the horizon where you iterate through every node in your document | one-by-one (text, element, PI, comment, etc) and perform operations utilizing | the ones you are interested in. I think you had it right the first time. I'd define the push vs pull distinction as a flow control issue (who owns the while loop)? The code with the while loop has an easier job since it can use the program stack to keep track of context. The other partner in the interaction must keep their state via some other method (a call-back structure). In SAX, the parser is has the control loop and thus this makes SAX parsers easy to write. In DOM the control loop is owned by the library's user. Mixing access (random vs sequential) with flow control (push vs pull) is how everything gets confused. That said, sequential push and random pull variants are the easiest to implement. The sequential pull seems the hardest to implement. I've only just begun playing with random access push models... this is more or less events that can be revisited. Best, ;) Clark -- Clark C. Evans Axista, Inc. http://www.axista.com 800.926.5525 XCOLLA Collaborative Project Management Software
|

Cart



