mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
msxml3: Implement IXMLDOMNamedNodeMap::getQualifiedItem().
This commit is contained in:
parent
c9b8f5d2ae
commit
0330332aef
@ -127,13 +127,8 @@ static HRESULT WINAPI xmlnodemap_GetTypeInfo(
|
||||
ITypeInfo** ppTInfo )
|
||||
{
|
||||
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
||||
hr = get_typeinfo(IXMLDOMNamedNodeMap_tid, ppTInfo);
|
||||
|
||||
return hr;
|
||||
return get_typeinfo(IXMLDOMNamedNodeMap_tid, ppTInfo);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlnodemap_GetIDsOfNames(
|
||||
@ -203,32 +198,8 @@ static HRESULT WINAPI xmlnodemap_getNamedItem(
|
||||
IXMLDOMNode** namedItem)
|
||||
{
|
||||
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
||||
xmlChar *element_name;
|
||||
xmlAttrPtr attr;
|
||||
xmlNodePtr node;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), namedItem );
|
||||
|
||||
if ( !namedItem )
|
||||
return E_INVALIDARG;
|
||||
|
||||
node = xmlNodePtr_from_domnode( This->node, 0 );
|
||||
if ( !node )
|
||||
return E_FAIL;
|
||||
|
||||
element_name = xmlChar_from_wchar( name );
|
||||
attr = xmlHasNsProp( node, element_name, NULL );
|
||||
heap_free( element_name );
|
||||
|
||||
if ( !attr )
|
||||
{
|
||||
*namedItem = NULL;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
*namedItem = create_node( (xmlNodePtr) attr );
|
||||
|
||||
return S_OK;
|
||||
return IXMLDOMNamedNodeMap_getQualifiedItem(iface, name, NULL, namedItem);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlnodemap_setNamedItem(
|
||||
@ -237,7 +208,6 @@ static HRESULT WINAPI xmlnodemap_setNamedItem(
|
||||
IXMLDOMNode** namedItem)
|
||||
{
|
||||
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
||||
xmlnode *ThisNew = NULL;
|
||||
xmlNodePtr nodeNew;
|
||||
IXMLDOMNode *pAttr = NULL;
|
||||
xmlNodePtr node;
|
||||
@ -254,10 +224,10 @@ static HRESULT WINAPI xmlnodemap_setNamedItem(
|
||||
return E_FAIL;
|
||||
|
||||
/* Must be an Attribute */
|
||||
IUnknown_QueryInterface(newItem, &IID_IXMLDOMNode, (LPVOID*)&pAttr);
|
||||
IUnknown_QueryInterface(newItem, &IID_IXMLDOMNode, (void**)&pAttr);
|
||||
if(pAttr)
|
||||
{
|
||||
ThisNew = impl_from_IXMLDOMNode( pAttr );
|
||||
xmlnode *ThisNew = impl_from_IXMLDOMNode( pAttr );
|
||||
|
||||
if(ThisNew->node->type != XML_ATTRIBUTE_NODE)
|
||||
{
|
||||
@ -387,7 +357,7 @@ static HRESULT WINAPI xmlnodemap_get_length(
|
||||
|
||||
curr = first;
|
||||
attrCount = 1;
|
||||
while (curr->next != NULL) {
|
||||
while (curr->next) {
|
||||
attrCount++;
|
||||
curr = curr->next;
|
||||
}
|
||||
@ -403,8 +373,47 @@ static HRESULT WINAPI xmlnodemap_getQualifiedItem(
|
||||
IXMLDOMNode** qualifiedItem)
|
||||
{
|
||||
xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface );
|
||||
FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), qualifiedItem);
|
||||
return E_NOTIMPL;
|
||||
xmlAttrPtr attr;
|
||||
xmlNodePtr node;
|
||||
xmlChar *href;
|
||||
xmlChar *name;
|
||||
|
||||
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), qualifiedItem);
|
||||
|
||||
if (!baseName || !qualifiedItem) return E_INVALIDARG;
|
||||
|
||||
node = xmlNodePtr_from_domnode(This->node, XML_ELEMENT_NODE);
|
||||
if ( !node )
|
||||
return E_FAIL;
|
||||
|
||||
if (namespaceURI && *namespaceURI)
|
||||
{
|
||||
href = xmlChar_from_wchar(namespaceURI);
|
||||
if (!href) return E_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
href = NULL;
|
||||
|
||||
name = xmlChar_from_wchar(baseName);
|
||||
if (!name)
|
||||
{
|
||||
heap_free(href);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
attr = xmlHasNsProp(node, name, href);
|
||||
if (!attr)
|
||||
{
|
||||
*qualifiedItem = NULL;
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
*qualifiedItem = create_node((xmlNodePtr)attr);
|
||||
|
||||
heap_free(name);
|
||||
heap_free(href);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI xmlnodemap_removeQualifiedItem(
|
||||
|
@ -1321,7 +1321,7 @@ static void test_domnode( void )
|
||||
|
||||
type = NODE_INVALID;
|
||||
r = IXMLDOMNode_get_nodeType( element, &type);
|
||||
ok( r == S_OK, "getNamedItem returned wrong code\n");
|
||||
ok( r == S_OK, "got %08x\n", r);
|
||||
ok( type == NODE_ELEMENT, "node not an element\n");
|
||||
|
||||
str = NULL;
|
||||
@ -5796,6 +5796,69 @@ static void test_splitText(void)
|
||||
free_bstrs();
|
||||
}
|
||||
|
||||
static void test_getQualifiedItem(void)
|
||||
{
|
||||
IXMLDOMDocument *doc;
|
||||
IXMLDOMElement *element;
|
||||
IXMLDOMNode *pr_node, *node;
|
||||
IXMLDOMNodeList *root_list;
|
||||
IXMLDOMNamedNodeMap *map;
|
||||
VARIANT_BOOL b;
|
||||
BSTR str;
|
||||
LONG len;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance( &CLSID_DOMDocument, NULL,
|
||||
CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (void**)&doc );
|
||||
ok( hr == S_OK, "ret 0x%08x\n", hr);
|
||||
if( hr != S_OK )
|
||||
return;
|
||||
|
||||
str = SysAllocString( szComplete4 );
|
||||
hr = IXMLDOMDocument_loadXML( doc, str, &b );
|
||||
ok( hr == S_OK, "loadXML failed\n");
|
||||
ok( b == VARIANT_TRUE, "failed to load XML string\n");
|
||||
SysFreeString( str );
|
||||
|
||||
hr = IXMLDOMDocument_get_documentElement(doc, &element);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IXMLDOMElement_get_childNodes(element, &root_list);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IXMLDOMNodeList_get_item(root_list, 1, &pr_node);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
IXMLDOMNodeList_Release(root_list);
|
||||
|
||||
hr = IXMLDOMNode_get_attributes(pr_node, &map);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
IXMLDOMNode_Release(pr_node);
|
||||
|
||||
hr = IXMLDOMNamedNodeMap_get_length(map, &len);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
ok( len == 3, "length %d\n", len);
|
||||
|
||||
hr = IXMLDOMNamedNodeMap_getQualifiedItem(map, NULL, NULL, NULL);
|
||||
ok( hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
node = (void*)0xdeadbeef;
|
||||
hr = IXMLDOMNamedNodeMap_getQualifiedItem(map, NULL, NULL, &node);
|
||||
ok( hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
ok( node == (void*)0xdeadbeef, "got %p\n", node);
|
||||
|
||||
hr = IXMLDOMNamedNodeMap_getQualifiedItem(map, _bstr_("id"), NULL, NULL);
|
||||
ok( hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
hr = IXMLDOMNamedNodeMap_getQualifiedItem(map, _bstr_("id"), NULL, &node);
|
||||
ok( hr == S_OK, "ret %08x\n", hr);
|
||||
IXMLDOMNode_Release(node);
|
||||
|
||||
IXMLDOMNamedNodeMap_Release( map );
|
||||
IXMLDOMElement_Release( element );
|
||||
IXMLDOMDocument_Release( doc );
|
||||
free_bstrs();
|
||||
}
|
||||
|
||||
START_TEST(domdoc)
|
||||
{
|
||||
IXMLDOMDocument *doc;
|
||||
@ -5846,6 +5909,7 @@ START_TEST(domdoc)
|
||||
test_put_nodeValue();
|
||||
test_document_IObjectSafety();
|
||||
test_splitText();
|
||||
test_getQualifiedItem();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user