msxml3: Build qualified name using libxml2 helper.

This commit is contained in:
Nikolay Sivov 2010-10-29 01:14:08 +04:00 committed by Alexandre Julliard
parent 8f9804ed0b
commit 2329d2afdd
1 changed files with 5 additions and 11 deletions

View File

@ -182,23 +182,17 @@ static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
{
DWORD dLen, dLast;
xmlChar *qname;
BSTR bstr;
if(!name) return NULL;
if(!prefix || *prefix=='\0')
if(!prefix || !*prefix)
return bstr_from_xmlChar(name);
dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, NULL, 0)
+ MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, NULL, 0);
bstr = SysAllocStringLen(NULL, dLen-1);
if(!bstr)
return NULL;
dLast = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, bstr, dLen);
bstr[dLast-1] = ':';
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &bstr[dLast], dLen-dLast);
qname = xmlBuildQName(name, prefix, NULL, 0);
bstr = bstr_from_xmlChar(qname);
xmlFree(qname);
return bstr;
}