[Expat-discuss] expat parsing destructively?

Mark 11mjazbdg02 at sneakemail.com
Mon Oct 29 11:22:46 CET 2007


I think this is extremely unlikely this will work.  You are assuming that expat will always return a pointer to the data contained within the original memory buffer and not in any internal buffers.   

---- Original Message ----
Simply allocate 2 copies of the same data... i.e. read in the data to
one buffer, malloc() another buffer the same size, and do a huge
memcpy() to make a duplicate copy.  Now let eXpat scan one copy, and
doing some quick and dirty pointer math, you can now find
corresponding locations in the "non-eXpat" buffer and destroy it to
your hearts content.  When you're all done, simply free both buffers.
Its a little more memory intensive.. but sounds fairly elegant to me,
and you don't need to worry about doing anything unsupported by eXpat.


--------------------------------------
Protect yourself from spam, 
use http://sneakemail.com


More information about the Expat-discuss mailing list