Re: expat parsing destructively?

"Mukesh Kumar" <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <7C83A8A6B56D3A478333B1DF47E18586072422@MPBABGEX01.corp.mphasis.com>
Hi Mark,
 it only extends one more heap memory...  :)  basically it is used as temporary buffer  & later on he is calling free, bascially the similar logics works for me too... it is just a small trick.........   :)
 
Regards,
-Mukesh Kumar
Sr.Sofrware Engineer,
India,
Bangalore.

________________________________

From: [email protected] on behalf of Mark
Sent: Mon 10/29/2007 3:52 PM
To: [email protected]
Subject: Re: [Expat-discuss] expat parsing destructively?



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 <http://sneakemail.com/> 
_______________________________________________
Expat-discuss mailing list
[email protected]
http://mail.libexpat.org/mailman/listinfo/expat-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.