Fix handling of   in tokenized attribute values.

This commit is contained in:
James Clark 1998-02-08 08:44:11 +00:00
parent 7bbe2e366d
commit 430fdf8c57

View File

@ -1158,11 +1158,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
errorPtr = ptr; errorPtr = ptr;
return XML_ERROR_INVALID_TOKEN; return XML_ERROR_INVALID_TOKEN;
case XML_TOK_CHAR_REF: case XML_TOK_CHAR_REF:
if (XmlCharRefNumber(enc, ptr) < 0) { {
errorPtr = ptr;
return XML_ERROR_BAD_CHAR_REF;
}
else {
char buf[XML_MAX_BYTES_PER_CHAR]; char buf[XML_MAX_BYTES_PER_CHAR];
int i; int i;
int n = XmlCharRefNumber(enc, ptr); int n = XmlCharRefNumber(enc, ptr);
@ -1170,6 +1166,10 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
errorPtr = ptr; errorPtr = ptr;
return XML_ERROR_BAD_CHAR_REF; return XML_ERROR_BAD_CHAR_REF;
} }
if (!isCdata
&& n == ' '
&& (poolLength(pool) == 0 || poolLastByte(pool) == ' '))
break;
n = XmlEncode(utf8, n, buf); n = XmlEncode(utf8, n, buf);
if (!n) { if (!n) {
errorPtr = ptr; errorPtr = ptr;