1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

Fixed some wrongly space collapsing code due to misreading of the spec, Daniel.

This commit is contained in:
Daniel Veillard 1999-11-18 14:02:05 +00:00
parent 7f8585025f
commit 07136650c1
8 changed files with 28 additions and 23 deletions

View File

@ -1,4 +1,10 @@
Wed Nov 17 18:28:06 CET 1999 Thu Nov 18 14:57:18 CET 1999
* parser.c: Fixed some wrongly space collapsing code due to
a misreading of the spec.
* result/*: fixed the output accordingly
Wed Nov 17 18:28:06 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* encoding.c: bug fix and typos * encoding.c: bug fix and typos
* xmlIO.[ch] parser.c: first bits toward real progressive parsing * xmlIO.[ch] parser.c: first bits toward real progressive parsing

View File

@ -2509,6 +2509,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
* #x20 is appended for a "#xD#xA" sequence that is part of an external * #x20 is appended for a "#xD#xA" sequence that is part of an external
* parsed entity or the literal entity value of an internal parsed entity * parsed entity or the literal entity value of an internal parsed entity
* - other characters are processed by appending them to the normalized value * - other characters are processed by appending them to the normalized value
* If the declared value is not CDATA, then the XML processor must further
* process the normalized attribute value by discarding any leading and
* trailing space (#x20) characters, and by replacing sequences of space
* (#x20) characters by a single space (#x20) character.
* All attributes for which no declaration has been read should be treated
* by a non-validating parser as if declared CDATA.
* *
* Returns the AttValue parsed or NULL. The value has to be freed by the caller. * Returns the AttValue parsed or NULL. The value has to be freed by the caller.
*/ */
@ -2523,7 +2529,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
xmlChar *current = NULL; xmlChar *current = NULL;
xmlEntityPtr ent; xmlEntityPtr ent;
xmlChar cur; xmlChar cur;
int blank = 0;
SHRINK; SHRINK;
@ -2564,7 +2569,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
if ((cur == '&') && (NXT(1) == '#')) { if ((cur == '&') && (NXT(1) == '#')) {
int val = xmlParseCharRef(ctxt); int val = xmlParseCharRef(ctxt);
*out++ = val; *out++ = val;
blank = 0;
} else if (cur == '&') { } else if (cur == '&') {
ent = xmlParseEntityRef(ctxt); ent = xmlParseEntityRef(ctxt);
if ((ent != NULL) && if ((ent != NULL) &&
@ -2594,11 +2598,9 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
*out++ = *cur++; *out++ = *cur++;
*out++ = ';'; *out++ = ';';
} }
blank = 0;
} else { } else {
/* invalid for UTF-8 , use COPY(out); !!!!!! */ /* invalid for UTF-8 , use COPY(out); !!!!!! */
if ((cur == 0x20) || (cur == 0xD) || (cur == 0xA) || (cur == 0x9)) { if ((cur == 0x20) || (cur == 0xD) || (cur == 0xA) || (cur == 0x9)) {
if (!blank) {
*out++ = 0x20; *out++ = 0x20;
if (out - buffer > buffer_size - 10) { if (out - buffer > buffer_size - 10) {
int index = out - buffer; int index = out - buffer;
@ -2606,8 +2608,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
growBuffer(buffer); growBuffer(buffer);
out = &buffer[index]; out = &buffer[index];
} }
}
blank = 1;
} else { } else {
*out++ = cur; *out++ = cur;
if (out - buffer > buffer_size - 10) { if (out - buffer > buffer_size - 10) {
@ -2616,7 +2616,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
growBuffer(buffer); growBuffer(buffer);
out = &buffer[index]; out = &buffer[index];
} }
blank = 0;
} }
NEXT; NEXT;
} }