fixed the heuristic used when trying to detect mixed-content elememts if
* parser.c: fixed the heuristic used when trying to detect mixed-content
elememts if the parser wants to treat ignorable whitespaces
in a non-standard way, should fix bug #300263
Daniel
diff --git a/ChangeLog b/ChangeLog
index 680c2cf..1dfd6ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Oct 12 18:21:18 CEST 2006 Daniel Veillard <daniel@veillard.com>
+
+ * parser.c: fixed the heuristic used when trying to detect mixed-content
+ elememts if the parser wants to treat ignorable whitespaces
+ in a non-standard way, should fix bug #300263
+
Thu Oct 12 14:52:38 CEST 2006 Daniel Veillard <daniel@veillard.com>
* parser.c: fix a first arg error in SAX callback pointed out by
diff --git a/parser.c b/parser.c
index afbab5f..ea95712 100644
--- a/parser.c
+++ b/parser.c
@@ -2362,7 +2362,8 @@
/*
* Check for xml:space value.
*/
- if ((ctxt->space == NULL) || (*(ctxt->space) == 1))
+ if ((ctxt->space == NULL) || (*(ctxt->space) == 1) ||
+ (*(ctxt->space) == -2))
return(0);
/*
@@ -3506,9 +3507,13 @@
if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace(ctxt->userData,
tmp, nbchar);
- } else if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData,
- tmp, nbchar);
+ } else {
+ if (ctxt->sax->characters != NULL)
+ ctxt->sax->characters(ctxt->userData,
+ tmp, nbchar);
+ if (*ctxt->space == -1)
+ *ctxt->space = -2;
+ }
} else if ((ctxt->sax != NULL) &&
(ctxt->sax->characters != NULL)) {
ctxt->sax->characters(ctxt->userData,
@@ -3555,9 +3560,13 @@
if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace(ctxt->userData,
tmp, nbchar);
- } else if (ctxt->sax->characters != NULL)
- ctxt->sax->characters(ctxt->userData,
- tmp, nbchar);
+ } else {
+ if (ctxt->sax->characters != NULL)
+ ctxt->sax->characters(ctxt->userData,
+ tmp, nbchar);
+ if (*ctxt->space == -1)
+ *ctxt->space = -2;
+ }
line = ctxt->input->line;
col = ctxt->input->col;
} else if (ctxt->sax != NULL) {
@@ -3640,6 +3649,10 @@
} else {
if (ctxt->sax->characters != NULL)
ctxt->sax->characters(ctxt->userData, buf, nbchar);
+ if ((ctxt->sax->characters !=
+ ctxt->sax->ignorableWhitespace) &&
+ (*ctxt->space == -1))
+ *ctxt->space = -2;
}
}
nbchar = 0;
@@ -3664,6 +3677,9 @@
} else {
if (ctxt->sax->characters != NULL)
ctxt->sax->characters(ctxt->userData, buf, nbchar);
+ if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) &&
+ (*ctxt->space == -1))
+ *ctxt->space = -2;
}
}
}
@@ -8499,6 +8515,8 @@
if (ctxt->spaceNr == 0)
spacePush(ctxt, -1);
+ else if (*ctxt->space == -2)
+ spacePush(ctxt, -1);
else
spacePush(ctxt, *ctxt->space);
@@ -9815,6 +9833,8 @@
}
if (ctxt->spaceNr == 0)
spacePush(ctxt, -1);
+ else if (*ctxt->space == -2)
+ spacePush(ctxt, -1);
else
spacePush(ctxt, *ctxt->space);
#ifdef LIBXML_SAX1_ENABLED