Re: characterData

"Gert Cuykens" <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
On 7/21/07, Gert Cuykens <[email protected]> wrote:
> On 7/21/07, Nick MacDonald <[email protected]> wrote:
> > Since you are NOT guaranteed to get only ONE CharacterData handler
> > call, you should really be writing:
> >
> > static void
> > characterData(void *userData, const XML_Char *s, int l)
> > {
> >   PAGE *page = (PAGE *)userData;
> >   if (NULL == page->data)
> >   {
> >     char *data=malloc(l);
> >     memcpy(data,s,l);
> >     page->data=data;
> >     page->dataSize=l;  /* a new structure member */
> >   }
> >   else
> >   {
> >     char *data=realloc(data, l+page->dataSize);
> >     memcpy(data+page->dataSize,s,l);
> >     page->data=data;
> >     page->dataSize+=l;
> >   }
> > }
> >
>
> Thanks :)
>

Anything else :)

http://dfo.svn.sourceforge.net/viewvc/dfo/trunk/cgi/xml.c?view=markup

PS Can this mysql cgi be added in the expat example's for your next release ?
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.