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

xmllite/reader: Return qualified element names from the stack, instead of input buffer.

parent 3ae1043f
......@@ -2284,7 +2284,6 @@ static HRESULT reader_parse_endtag(xmlreader *reader)
reader->nodetype = XmlNodeType_EndElement;
reader->is_empty_element = FALSE;
reader_set_strvalue(reader, StringValue_Prefix, &prefix);
reader_set_strvalue(reader, StringValue_QualifiedName, &qname);
return S_OK;
}
......@@ -2913,10 +2912,35 @@ static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *name, UINT *len)
{
xmlreader *This = impl_from_IXmlReader(iface);
XmlNodeType nodetype;
UINT length;
TRACE("(%p)->(%p %p)\n", This, name, len);
*name = This->strvalues[StringValue_QualifiedName].str;
if (len) *len = This->strvalues[StringValue_QualifiedName].len;
if (!len)
len = &length;
switch ((nodetype = reader_get_nodetype(This)))
{
case XmlNodeType_Element:
case XmlNodeType_EndElement:
/* empty elements are not added to the stack */
if (!This->is_empty_element)
{
struct element *element;
element = LIST_ENTRY(list_head(&This->elements), struct element, entry);
*name = element->qname.str;
*len = element->qname.len;
break;
}
/* fallthrough */
default:
*name = This->strvalues[StringValue_QualifiedName].str;
*len = This->strvalues[StringValue_QualifiedName].len;
break;
}
return S_OK;
}
......
......@@ -2146,9 +2146,9 @@ static void test_namespaceuri(void)
type = ~0u;
while (IXmlReader_Read(reader, &type) == S_OK) {
const WCHAR *uri, *local;
const WCHAR *uri, *local, *qname;
UINT length, length2;
WCHAR *uriW;
UINT length;
ok(type == XmlNodeType_Element ||
type == XmlNodeType_Text ||
......@@ -2165,10 +2165,22 @@ static void test_namespaceuri(void)
ok(hr == S_OK, "S_OK, got %08x\n", hr);
ok(local != NULL, "Unexpected NULL local name pointer\n");
if (type == XmlNodeType_Element || type == XmlNodeType_EndElement)
qname = NULL;
length2 = 0;
hr = IXmlReader_GetQualifiedName(reader, &qname, &length2);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
ok(qname != NULL, "Unexpected NULL qualified name pointer\n");
if (type == XmlNodeType_Element ||
type == XmlNodeType_EndElement ||
type == XmlNodeType_ProcessingInstruction ||
type == XmlNodeType_XmlDeclaration)
{
ok(*local != 0, "Unexpected empty local name\n");
ok(length > 0, "Unexpected local name length\n");
ok(*qname != 0, "Unexpected empty qualified name\n");
ok(length2 > 0, "Unexpected qualified name length\n");
}
uri = NULL;
......
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