mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03: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:
@ -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>
|
Wed Mar 7 16:50:22 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* Makefile.am: Martin Baulig suggested to add -lm
|
* 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
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if ((xmlNodeIsText(lastChild)) && (ctxt->nodemem != 0)) {
|
int isText = xmlNodeIsText(lastChild);
|
||||||
|
if ((isText) && (ctxt->nodemem != 0)) {
|
||||||
#ifndef XML_USE_BUFFER_CONTENT
|
#ifndef XML_USE_BUFFER_CONTENT
|
||||||
/*
|
/*
|
||||||
* The whole point of maintaining nodelen and nodemem,
|
* The whole point of maintaining nodelen and nodemem,
|
||||||
@ -1220,6 +1221,12 @@ characters(void *ctx, const xmlChar *ch, int len)
|
|||||||
#else
|
#else
|
||||||
xmlTextConcat(lastChild, ch, len);
|
xmlTextConcat(lastChild, ch, len);
|
||||||
#endif
|
#endif
|
||||||
|
} else if (isText) {
|
||||||
|
xmlTextConcat(lastChild, ch, len);
|
||||||
|
if (ctxt->node->children != NULL) {
|
||||||
|
ctxt->nodelen = xmlStrlen(lastChild->content);
|
||||||
|
ctxt->nodemem = ctxt->nodelen + 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Mixed content, first time */
|
/* Mixed content, first time */
|
||||||
lastChild = xmlNewTextLen(ch, len);
|
lastChild = xmlNewTextLen(ch, len);
|
||||||
|
25
parser.c
25
parser.c
@ -2450,15 +2450,17 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
|
|||||||
continue; /* while */
|
continue; /* while */
|
||||||
}
|
}
|
||||||
nbchar = in - ctxt->input->cur;
|
nbchar = in - ctxt->input->cur;
|
||||||
if (IS_BLANK(*ctxt->input->cur) &&
|
if (nbchar > 0) {
|
||||||
areBlanks(ctxt, ctxt->input->cur, nbchar)) {
|
if (IS_BLANK(*ctxt->input->cur) &&
|
||||||
if (ctxt->sax->ignorableWhitespace != NULL)
|
areBlanks(ctxt, ctxt->input->cur, nbchar)) {
|
||||||
ctxt->sax->ignorableWhitespace(ctxt->userData,
|
if (ctxt->sax->ignorableWhitespace != NULL)
|
||||||
ctxt->input->cur, nbchar);
|
ctxt->sax->ignorableWhitespace(ctxt->userData,
|
||||||
} else {
|
ctxt->input->cur, nbchar);
|
||||||
if (ctxt->sax->characters != NULL)
|
} else {
|
||||||
ctxt->sax->characters(ctxt->userData,
|
if (ctxt->sax->characters != NULL)
|
||||||
ctxt->input->cur, nbchar);
|
ctxt->sax->characters(ctxt->userData,
|
||||||
|
ctxt->input->cur, nbchar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ctxt->input->cur = in;
|
ctxt->input->cur = in;
|
||||||
if (*in == 0xD) {
|
if (*in == 0xD) {
|
||||||
@ -2471,7 +2473,10 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
|
|||||||
}
|
}
|
||||||
in--;
|
in--;
|
||||||
}
|
}
|
||||||
if ((*in == '<') || (*in == '&')) {
|
if (*in == '<') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (*in == '&') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SHRINK;
|
SHRINK;
|
||||||
|
Reference in New Issue
Block a user