[
Lists Home |
Date Index |
Thread Index
]
----- Original Message -----
From: "Joe Gregorio" <joe@bitworking.org>
> > Have you looked at the API of James Clark's Expat?
>
> Based on your question I just took a look at
> Expat and saw a mix of calls in xmlparse.h,
> some using strings that are null terminated,
> some that are not:
>
> /* s is not 0 terminated. */
> typedef void (*XML_CharacterDataHandler)(void *userData,
> const XML_Char *s,
> int len);
>
> /* target and data are 0 terminated */
> typedef void (*XML_ProcessingInstructionHandler)(void *userData,
> const XML_Char *target,
> const XML_Char *data);
>
> /* data is 0 terminated */
> typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
>
>
> Now this was a quick look and I could be poking
> around in the wrong file, please point me
> it the right direction if that's the case.
The right file in the current Expat would be expat.h, but that does not
change your observation. As far as I can tell there are two reasons:
1) Due to a low frequency, the impact of copying is low for some call-backs
2) Based on its internal logic Expat needs to copy some data out anyway
(e.g. it has to remember the name of a start tag to check for the proper
occurrence of the end-tag). In that case Expat will pass the internal copy
which is a null-termninated string.
Karl
|