mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-17 18:19:32 +08:00
- parser.c SAX.c: the new content parsing code raised an
ugly bug in the characters() SAX callback. Found it just because of strangeness in XSLT XML Rec ouptut :-( Daniel
This commit is contained in:
parent
6c831207f8
commit
80f3257163
@ -1,3 +1,9 @@
|
||||
Wed Mar 7 20:43:47 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* parser.c SAX.c: the new content parsing code raised an
|
||||
ugly bug in the characters() SAX callback. Found it
|
||||
just because of strangeness in XSLT XML Rec ouptut :-(
|
||||
|
||||
Wed Mar 7 16:50:22 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||
|
||||
* Makefile.am: Martin Baulig suggested to add -lm
|
||||
|
9
SAX.c
9
SAX.c
@ -1189,7 +1189,8 @@ characters(void *ctx, const xmlChar *ch, int len)
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if ((xmlNodeIsText(lastChild)) && (ctxt->nodemem != 0)) {
|
||||
int isText = xmlNodeIsText(lastChild);
|
||||
if ((isText) && (ctxt->nodemem != 0)) {
|
||||
#ifndef XML_USE_BUFFER_CONTENT
|
||||
/*
|
||||
* The whole point of maintaining nodelen and nodemem,
|
||||
@ -1220,6 +1221,12 @@ characters(void *ctx, const xmlChar *ch, int len)
|
||||
#else
|
||||
xmlTextConcat(lastChild, ch, len);
|
||||
#endif
|
||||
} else if (isText) {
|
||||
xmlTextConcat(lastChild, ch, len);
|
||||
if (ctxt->node->children != NULL) {
|
||||
ctxt->nodelen = xmlStrlen(lastChild->content);
|
||||
ctxt->nodemem = ctxt->nodelen + 1;
|
||||
}
|
||||
} else {
|
||||
/* Mixed content, first time */
|
||||
lastChild = xmlNewTextLen(ch, len);
|
||||
|
25
parser.c
25
parser.c
@ -2450,15 +2450,17 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
|
||||
continue; /* while */
|
||||
}
|
||||
nbchar = in - ctxt->input->cur;
|
||||
if (IS_BLANK(*ctxt->input->cur) &&
|
||||
areBlanks(ctxt, ctxt->input->cur, nbchar)) {
|
||||
if (ctxt->sax->ignorableWhitespace != NULL)
|
||||
ctxt->sax->ignorableWhitespace(ctxt->userData,
|
||||
ctxt->input->cur, nbchar);
|
||||
} else {
|
||||
if (ctxt->sax->characters != NULL)
|
||||
ctxt->sax->characters(ctxt->userData,
|
||||
ctxt->input->cur, nbchar);
|
||||
if (nbchar > 0) {
|
||||
if (IS_BLANK(*ctxt->input->cur) &&
|
||||
areBlanks(ctxt, ctxt->input->cur, nbchar)) {
|
||||
if (ctxt->sax->ignorableWhitespace != NULL)
|
||||
ctxt->sax->ignorableWhitespace(ctxt->userData,
|
||||
ctxt->input->cur, nbchar);
|
||||
} else {
|
||||
if (ctxt->sax->characters != NULL)
|
||||
ctxt->sax->characters(ctxt->userData,
|
||||
ctxt->input->cur, nbchar);
|
||||
}
|
||||
}
|
||||
ctxt->input->cur = in;
|
||||
if (*in == 0xD) {
|
||||
@ -2471,7 +2473,10 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
|
||||
}
|
||||
in--;
|
||||
}
|
||||
if ((*in == '<') || (*in == '&')) {
|
||||
if (*in == '<') {
|
||||
return;
|
||||
}
|
||||
if (*in == '&') {
|
||||
return;
|
||||
}
|
||||
SHRINK;
|
||||
|
Loading…
Reference in New Issue
Block a user