- 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
diff --git a/SAX.c b/SAX.c
index d7e256b..5882d41 100644
--- a/SAX.c
+++ b/SAX.c
@@ -1189,7 +1189,8 @@
}
#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 @@
#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);