msxml3: Implement getValueFromQName() for MXAttributes.

This commit is contained in:
Nikolay Sivov 2012-03-15 09:58:34 +03:00 committed by Alexandre Julliard
parent 10a584a688
commit 72187762a3
2 changed files with 49 additions and 4 deletions

View File

@ -1873,12 +1873,23 @@ static HRESULT WINAPI SAXAttributes_getValueFromName(ISAXAttributes *iface, cons
return E_NOTIMPL;
}
static HRESULT WINAPI SAXAttributes_getValueFromQName(ISAXAttributes *iface, const WCHAR * pQName,
int nQName, const WCHAR ** pValue, int * nValue)
static HRESULT WINAPI SAXAttributes_getValueFromQName(ISAXAttributes *iface, const WCHAR *qname,
int qname_len, const WCHAR **value, int *value_len)
{
mxattributes *This = impl_from_ISAXAttributes( iface );
FIXME("(%p)->(%s:%d %p %p): stub\n", This, debugstr_wn(pQName, nQName), nQName, pValue, nValue);
return E_NOTIMPL;
HRESULT hr;
int index;
TRACE("(%p)->(%s:%d %p %p)\n", This, debugstr_wn(qname, qname_len), qname_len, value, value_len);
if (!qname || !value || !value_len)
return (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3) ? E_POINTER : E_INVALIDARG;
hr = ISAXAttributes_getIndexFromQName(iface, qname, qname_len, &index);
if (hr == S_OK)
hr = ISAXAttributes_getValue(iface, index, value, value_len);
return hr;
}
static const ISAXAttributesVtbl SAXAttributesVtbl = {

View File

@ -3437,6 +3437,40 @@ static void test_mxattr_addAttribute(void)
hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname)-1, &index);
EXPECT_HR(hr, E_INVALIDARG);
ok(index == -1, "%d: got wrong index %d\n", i, index);
if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes40) ||
IsEqualGUID(table->clsid, &CLSID_SAXAttributes60))
{
hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
EXPECT_HR(hr, E_INVALIDARG);
}
else
{
hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL);
EXPECT_HR(hr, E_POINTER);
/* versions 4 and 6 crash */
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), NULL, &len);
EXPECT_HR(hr, E_POINTER);
}
hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), &value, &len);
EXPECT_HR(hr, S_OK);
}
len = -1;