xmllite: Improve GetValue() for namespace definition nodes.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-12-09 16:38:30 +03:00 committed by Alexandre Julliard
parent 13afa65fb1
commit 20c575e81f
1 changed files with 24 additions and 0 deletions

View File

@ -3002,6 +3002,18 @@ static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface, LPCWSTR *prefix, UI
return S_OK;
}
static BOOL is_namespace_definition(xmlreader *reader)
{
const strval *local = &reader->strvalues[StringValue_LocalName];
const strval *prefix = &reader->strvalues[StringValue_Prefix];
if (reader_get_nodetype(reader) != XmlNodeType_Attribute)
return FALSE;
return ((strval_eq(reader, prefix, &strval_empty) && strval_eq(reader, local, &strval_xmlns)) ||
strval_eq(reader, prefix, &strval_xmlns));
}
static HRESULT WINAPI xmlreader_GetValue(IXmlReader* iface, const WCHAR **value, UINT *len)
{
xmlreader *reader = impl_from_IXmlReader(iface);
@ -3032,6 +3044,18 @@ static HRESULT WINAPI xmlreader_GetValue(IXmlReader* iface, const WCHAR **value,
val->str = ptr;
}
/* For namespace definition attributes return values from namespace list */
if (is_namespace_definition(reader)) {
const strval *local = &reader->strvalues[StringValue_LocalName];
struct ns *ns;
ns = reader_lookup_ns(reader, local);
if (!ns)
ns = reader_lookup_nsdef(reader);
val = &ns->uri;
}
*value = val->str;
if (len) *len = val->len;
return S_OK;