xmllite/reader: Fix prefix returned after moving back to element.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-03-07 06:50:57 +03:00 committed by Alexandre Julliard
parent 70028b7d0a
commit 3fe5f25b17
2 changed files with 13 additions and 0 deletions

View File

@ -2890,12 +2890,14 @@ static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
/* FIXME: support other node types with 'attributes' like DTD */
if (This->is_empty_element) {
reader_set_strvalue(This, StringValue_Prefix, &This->empty_element.prefix);
reader_set_strvalue(This, StringValue_LocalName, &This->empty_element.localname);
reader_set_strvalue(This, StringValue_QualifiedName, &This->empty_element.qname);
}
else {
struct element *element = LIST_ENTRY(list_head(&This->elements), struct element, entry);
if (element) {
reader_set_strvalue(This, StringValue_Prefix, &element->prefix);
reader_set_strvalue(This, StringValue_LocalName, &element->localname);
reader_set_strvalue(This, StringValue_QualifiedName, &element->qname);
}

View File

@ -2034,6 +2034,17 @@ static void test_prefix(void)
wine_dbgstr_w(expected));
free_str(expected);
/* back to the element, check prefix */
hr = IXmlReader_MoveToElement(reader);
ok(hr == S_OK, "MoveToElement() failed, %#x.\n", hr);
expected = a2w(prefix_tests[i].prefix1);
hr = IXmlReader_GetPrefix(reader, &prefix, NULL);
ok(hr == S_OK, "GetPrefix() failed, %#x.\n", hr);
ok(!lstrcmpW(prefix, expected), "Unexpected prefix %s, expected %s.\n", wine_dbgstr_w(prefix),
wine_dbgstr_w(expected));
free_str(expected);
IStream_Release(stream);
}