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:
parent
13afa65fb1
commit
20c575e81f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue