msxml: Implement getAttribute.
This commit is contained in:
parent
7439c29d07
commit
d9fc6985fa
|
@ -454,10 +454,32 @@ static HRESULT WINAPI domelem_get_tagName(
|
|||
|
||||
static HRESULT WINAPI domelem_getAttribute(
|
||||
IXMLDOMElement *iface,
|
||||
BSTR p, VARIANT* var)
|
||||
BSTR name, VARIANT* value)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
domelem *This = impl_from_IXMLDOMElement( iface );
|
||||
xmlNodePtr element;
|
||||
xmlChar *xml_name, *xml_value;
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_w(name), value);
|
||||
|
||||
element = get_element( This );
|
||||
if ( !element )
|
||||
return E_FAIL;
|
||||
|
||||
VariantInit(value);
|
||||
xml_name = xmlChar_from_wchar( name );
|
||||
xml_value = xmlGetNsProp(element, xml_name, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, xml_name);
|
||||
if(xml_value)
|
||||
{
|
||||
V_VT(value) = VT_BSTR;
|
||||
V_BSTR(value) = bstr_from_xmlChar( xml_value );
|
||||
xmlFree(xml_value);
|
||||
hr = S_OK;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domelem_setAttribute(
|
||||
|
|
|
@ -71,6 +71,7 @@ static const WCHAR szOpen[] = { 'o','p','e','n',0 };
|
|||
static const WCHAR szdl[] = { 'd','l',0 };
|
||||
static const WCHAR szlc[] = { 'l','c',0 };
|
||||
static const WCHAR szbs[] = { 'b','s',0 };
|
||||
static const WCHAR szstr1[] = { 's','t','r','1',0 };
|
||||
|
||||
void test_domdoc( void )
|
||||
{
|
||||
|
@ -312,6 +313,25 @@ void test_domnode( void )
|
|||
ok( !lstrcmpW( str, szlc ), "incorrect nodeName\n");
|
||||
SysFreeString( str );
|
||||
|
||||
str = SysAllocString( szNonExistentFile );
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = 0x1234;
|
||||
r = IXMLDOMElement_getAttribute( element, str, &var );
|
||||
ok( r == E_FAIL, "getAttribute ret %08lx\n", r );
|
||||
ok( V_VT(&var) == VT_EMPTY, "vt = %x\n", V_VT(&var));
|
||||
VariantClear(&var);
|
||||
SysFreeString( str );
|
||||
|
||||
str = SysAllocString( szdl );
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = 0x1234;
|
||||
r = IXMLDOMElement_getAttribute( element, str, &var );
|
||||
ok( r == S_OK, "getAttribute ret %08lx\n", r );
|
||||
ok( V_VT(&var) == VT_BSTR, "vt = %x\n", V_VT(&var));
|
||||
ok( !lstrcmpW(V_BSTR(&var), szstr1), "wrong attr value\n");
|
||||
VariantClear( &var );
|
||||
SysFreeString( str );
|
||||
|
||||
r = IXMLDOMElement_get_attributes( element, &map );
|
||||
ok( r == S_OK, "get_attributes returned wrong code\n");
|
||||
ok( map != NULL, "should be attributes\n");
|
||||
|
|
Loading…
Reference in New Issue