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

xmllite/reader: Return prefixes from namespace stack.

parent 348fcb18
......@@ -3087,13 +3087,51 @@ static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface, LPCWSTR *name, U
return S_OK;
}
static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface, LPCWSTR *prefix, UINT *len)
static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface, const WCHAR **ret, UINT *len)
{
xmlreader *This = impl_from_IXmlReader(iface);
XmlNodeType nodetype;
UINT length;
TRACE("(%p)->(%p %p)\n", This, ret, len);
if (!len)
len = &length;
*ret = emptyW;
*len = 0;
switch ((nodetype = reader_get_nodetype(This)))
{
case XmlNodeType_Element:
case XmlNodeType_EndElement:
case XmlNodeType_Attribute:
{
const strval *prefix = &This->strvalues[StringValue_Prefix];
struct ns *ns;
if (strval_eq(This, prefix, &strval_xml))
{
*ret = xmlW;
*len = 3;
}
else if (strval_eq(This, prefix, &strval_xmlns))
{
*ret = xmlnsW;
*len = 5;
}
else if ((ns = reader_lookup_ns(This, prefix)))
{
*ret = ns->prefix.str;
*len = ns->prefix.len;
}
break;
}
default:
;
}
TRACE("(%p)->(%p %p)\n", This, prefix, len);
*prefix = This->strvalues[StringValue_Prefix].str;
if (len) *len = This->strvalues[StringValue_Prefix].len;
return S_OK;
}
......
......@@ -2024,6 +2024,7 @@ static void test_prefix(void)
} prefix_tests[] =
{
{ "<b xmlns=\"defns\" xml:a=\"a ns\"/>", "", "", "xml" },
{ "<c:b xmlns:c=\"c ns\" xml:a=\"a ns\"/>", "c", "xmlns", "xml" },
};
IXmlReader *reader;
unsigned int i;
......
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