Commit 2bdaffd8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite: Partially implement value normalization for CDATA sections.

parent 448e939e
...@@ -1835,6 +1835,12 @@ static HRESULT reader_parse_cdata(xmlreader *reader) ...@@ -1835,6 +1835,12 @@ static HRESULT reader_parse_cdata(xmlreader *reader)
} }
else else
{ {
/* Value normalization is not fully implemented, rules are:
- single '\r' -> '\n';
- sequence '\r\n' -> '\n', in this case value length changes;
*/
if (*ptr == '\r') *ptr = '\n';
reader_skipn(reader, 1); reader_skipn(reader, 1);
ptr++; ptr++;
} }
......
...@@ -771,6 +771,7 @@ struct test_entry { ...@@ -771,6 +771,7 @@ struct test_entry {
const char *value; const char *value;
HRESULT hr; HRESULT hr;
HRESULT hr_broken; /* this is set to older version results */ HRESULT hr_broken; /* this is set to older version results */
int todo : 1;
}; };
static struct test_entry comment_tests[] = { static struct test_entry comment_tests[] = {
...@@ -1317,6 +1318,9 @@ static void test_readvaluechunk(void) ...@@ -1317,6 +1318,9 @@ static void test_readvaluechunk(void)
static struct test_entry cdata_tests[] = { static struct test_entry cdata_tests[] = {
{ "<a><![CDATA[ ]]data ]]></a>", "", " ]]data ", S_OK }, { "<a><![CDATA[ ]]data ]]></a>", "", " ]]data ", S_OK },
{ "<a><![CDATA[<![CDATA[ data ]]]]></a>", "", "<![CDATA[ data ]]", S_OK }, { "<a><![CDATA[<![CDATA[ data ]]]]></a>", "", "<![CDATA[ data ]]", S_OK },
{ "<a><![CDATA[\n \r\n \n\n ]]></a>", "", "\n \n \n\n ", S_OK, S_OK, 1 },
{ "<a><![CDATA[\r \r\r\n \n\n ]]></a>", "", "\n \n\n \n\n ", S_OK, S_OK, 1 },
{ "<a><![CDATA[\r\r \n\r \r \n\n ]]></a>", "", "\n\n \n\n \n \n\n ", S_OK },
{ NULL } { NULL }
}; };
...@@ -1383,9 +1387,20 @@ static void test_read_cdata(void) ...@@ -1383,9 +1387,20 @@ static void test_read_cdata(void)
str = NULL; str = NULL;
hr = IXmlReader_GetValue(reader, &str, &len); hr = IXmlReader_GetValue(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len == strlen(test->value), "got %u\n", len);
str_exp = a2w(test->value); str_exp = a2w(test->value);
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str)); if (test->todo)
{
todo_wine {
ok(len == strlen(test->value), "got %u\n", len);
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
}
}
else
{
ok(len == strlen(test->value), "got %u\n", len);
ok(!lstrcmpW(str, str_exp), "got %s\n", wine_dbgstr_w(str));
}
free_str(str_exp); free_str(str_exp);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment