Commit b115e967 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/reader: Improve returned position for whitespace text nodes.

parent 9685fec1
...@@ -2383,6 +2383,7 @@ static HRESULT reader_parse_cdata(xmlreader *reader) ...@@ -2383,6 +2383,7 @@ static HRESULT reader_parse_cdata(xmlreader *reader)
/* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) */ /* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) */
static HRESULT reader_parse_chardata(xmlreader *reader) static HRESULT reader_parse_chardata(xmlreader *reader)
{ {
struct reader_position position;
WCHAR *ptr; WCHAR *ptr;
UINT start; UINT start;
...@@ -2404,6 +2405,7 @@ static HRESULT reader_parse_chardata(xmlreader *reader) ...@@ -2404,6 +2405,7 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
reader_set_strvalue(reader, StringValue_Value, NULL); reader_set_strvalue(reader, StringValue_Value, NULL);
} }
position = reader->position;
while (*ptr) while (*ptr)
{ {
static const WCHAR ampW[] = {'&',0}; static const WCHAR ampW[] = {'&',0};
...@@ -2417,6 +2419,7 @@ static HRESULT reader_parse_chardata(xmlreader *reader) ...@@ -2417,6 +2419,7 @@ static HRESULT reader_parse_chardata(xmlreader *reader)
{ {
strval value; strval value;
reader->empty_element.position = position;
reader_init_strvalue(start, reader_get_cur(reader)-start, &value); reader_init_strvalue(start, reader_get_cur(reader)-start, &value);
reader_set_strvalue(reader, StringValue_Value, &value); reader_set_strvalue(reader, StringValue_Value, &value);
reader->resume[XmlReadResume_Body] = 0; reader->resume[XmlReadResume_Body] = 0;
...@@ -3314,6 +3317,7 @@ static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *line_numb ...@@ -3314,6 +3317,7 @@ static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *line_numb
case XmlNodeType_Attribute: case XmlNodeType_Attribute:
*line_number = This->attr->position.line_number; *line_number = This->attr->position.line_number;
break; break;
case XmlNodeType_Whitespace:
case XmlNodeType_XmlDeclaration: case XmlNodeType_XmlDeclaration:
*line_number = This->empty_element.position.line_number; *line_number = This->empty_element.position.line_number;
break; break;
...@@ -3349,6 +3353,7 @@ static HRESULT WINAPI xmlreader_GetLinePosition(IXmlReader* iface, UINT *line_po ...@@ -3349,6 +3353,7 @@ static HRESULT WINAPI xmlreader_GetLinePosition(IXmlReader* iface, UINT *line_po
case XmlNodeType_Attribute: case XmlNodeType_Attribute:
*line_position = This->attr->position.line_position; *line_position = This->attr->position.line_position;
break; break;
case XmlNodeType_Whitespace:
case XmlNodeType_XmlDeclaration: case XmlNodeType_XmlDeclaration:
*line_position = This->empty_element.position.line_position; *line_position = This->empty_element.position.line_position;
break; break;
......
...@@ -2531,7 +2531,6 @@ static void test_reader_position(void) ...@@ -2531,7 +2531,6 @@ static void test_reader_position(void)
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
ok(type == XmlNodeType_Whitespace, "got type %d\n", type); ok(type == XmlNodeType_Whitespace, "got type %d\n", type);
todo_wine
TEST_READER_POSITION2(reader, 1, 35, 2, 6); TEST_READER_POSITION2(reader, 1, 35, 2, 6);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
......
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