Don't expand entities in data when !expandEntities

If ctx->expandEntities is false, then don't expand entities in data.
Patch from Bob Dunlop, <rdunlop@guralp.com>.

I'm not 100% sure of the correctness of the behaviour of entity expansion in
general -- shouldn't expandEntities toggle between either doing an entity
content lookup and substituting the result in the data, or causing a specific
"there's an entity here" callback? At present it seems to toggle between
lookup/substitute and treating entities (including their leading ampersands) as
character data, which seems wrong. To be reviewed.
This commit is contained in:
Laurence Withers 2009-01-13 13:39:43 +00:00
parent 5fc84b759e
commit 857d0545da
1 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* libCStreamedXML/src/libCStreamedXML/300_parser.c /* libCStreamedXML/src/libCStreamedXML/300_parser.c
* *
* (c)2006, Laurence Withers. Released under the GNU GPL. See file * (c)2006-2009, Laurence Withers. Released under the GNU GPL. See file
* COPYING for more information / terms of license. * COPYING for more information / terms of license.
*/ */
@ -216,10 +216,13 @@ int csxml_feedChar(struct csxml* ctx, char ch)
break; break;
case ClassEntity: case ClassEntity:
if(ctx->expandEntities) {
ctx->parsingAttr = 0; ctx->parsingAttr = 0;
ctx->state = StateEntity; ctx->state = StateEntity;
break; break;
}
/* fall through */
default: default:
APPEND_CH(buffer, ch); APPEND_CH(buffer, ch);
break; break;