[Expat-discuss] Character Data

Fred L. Drake, Jr. fdrake@acm.org
Mon, 13 Aug 2001 14:50:02 -0400 (EDT)


Vassilii Nemtchinov writes:
 > that the whole purpose of event-driven parser has been defied since I have 
 > to set sentinels  myself and not rely entirely on the parser. Secondly, in 

  No; you still avoid an enormous portion of the work involved with
something like building a DOM has been avoided.  Unless you're having
to keep everything indefinately, you get a win there.  Internal state
tracking and short-term data accumulation are common with event-based
parsing, XML or otherwise.

 > the worst case I have to allocate as many sentinels as I have elements in 
 > the document (same goes for separate buffers for character data). I am sure 
 > that somebody found a better solution for getting character data.

  How many buffers you need to allocate and how many state variables
you need depends entirely on your application.  If you're searching
the text for a match, for example, there are certainly incremental
algorithms that can be applied.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation