msxml3: Reimplement IXMLDOMDocument::createElement() over ::createNode().
This commit is contained in:
parent
469b0ff6b5
commit
ca01a44164
|
@ -1038,28 +1038,17 @@ static HRESULT WINAPI domdoc_createElement(
|
|||
BSTR tagname,
|
||||
IXMLDOMElement** element )
|
||||
{
|
||||
xmlNodePtr xmlnode;
|
||||
domdoc *This = impl_from_IXMLDOMDocument2( iface );
|
||||
xmlChar *xml_name;
|
||||
IUnknown *elem_unk;
|
||||
HRESULT hr;
|
||||
VARIANT type;
|
||||
|
||||
TRACE("%p->(%s,%p)\n", iface, debugstr_w(tagname), element);
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_w(tagname), element);
|
||||
|
||||
if (!element) return E_INVALIDARG;
|
||||
if (!element || !tagname) return E_INVALIDARG;
|
||||
|
||||
xml_name = xmlChar_from_wchar(tagname);
|
||||
xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL);
|
||||
xmldoc_add_orphan(xmlnode->doc, xmlnode);
|
||||
V_VT(&type) = VT_I1;
|
||||
V_I1(&type) = NODE_ELEMENT;
|
||||
|
||||
TRACE("created xmlptr %p\n", xmlnode);
|
||||
elem_unk = create_element(xmlnode);
|
||||
heap_free(xml_name);
|
||||
|
||||
hr = IUnknown_QueryInterface(elem_unk, &IID_IXMLDOMElement, (void **)element);
|
||||
IUnknown_Release(elem_unk);
|
||||
TRACE("returning %p\n", *element);
|
||||
return hr;
|
||||
return IXMLDOMDocument_createNode(iface, type, tagname, NULL, (IXMLDOMNode**)element);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1347,6 +1336,9 @@ static HRESULT WINAPI domdoc_createNode(
|
|||
|
||||
TRACE("node_type %d\n", node_type);
|
||||
|
||||
if ((!name || SysStringLen(name) == 0) && (node_type == NODE_ELEMENT))
|
||||
return E_FAIL;
|
||||
|
||||
xml_name = xmlChar_from_wchar(name);
|
||||
|
||||
switch(node_type)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* MSXML Class Factory
|
||||
* Common definitions
|
||||
*
|
||||
* Copyright 2005 Mike McCormack
|
||||
*
|
||||
|
|
|
@ -1695,6 +1695,21 @@ static void test_create(void)
|
|||
ok( r == E_INVALIDARG, "returns %08x\n", r );
|
||||
ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
|
||||
|
||||
V_VT(&var) = VT_I1;
|
||||
V_I1(&var) = NODE_ELEMENT;
|
||||
str = SysAllocString( szlc );
|
||||
node = (IXMLDOMNode*)0x1;
|
||||
r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
|
||||
ok( r == E_FAIL, "returns %08x\n", r );
|
||||
ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
|
||||
|
||||
V_VT(&var) = VT_I1;
|
||||
V_I1(&var) = NODE_ELEMENT;
|
||||
node = (IXMLDOMNode*)0x1;
|
||||
r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
|
||||
ok( r == E_FAIL, "returns %08x\n", r );
|
||||
ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
|
||||
|
||||
V_VT(&var) = VT_I1;
|
||||
V_I1(&var) = NODE_ELEMENT;
|
||||
str = SysAllocString( szlc );
|
||||
|
@ -2885,7 +2900,15 @@ static void test_xmlTypes(void)
|
|||
IXMLDOMImplementation_Release(pIXMLDOMImplementation);
|
||||
}
|
||||
|
||||
pRoot = (IXMLDOMElement*)0x1;
|
||||
hr = IXMLDOMDocument_createElement(doc, NULL, &pRoot);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
|
||||
ok(pRoot == (void*)0x1, "Expect same ptr, got %p\n", pRoot);
|
||||
|
||||
pRoot = (IXMLDOMElement*)0x1;
|
||||
hr = IXMLDOMDocument_createElement(doc, _bstr_(""), &pRoot);
|
||||
ok(hr == E_FAIL, "ret %08x\n", hr );
|
||||
ok(pRoot == (void*)0x1, "Expect same ptr, got %p\n", pRoot);
|
||||
|
||||
hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot);
|
||||
ok(hr == S_OK, "ret %08x\n", hr );
|
||||
|
@ -3146,7 +3169,7 @@ static void test_xmlTypes(void)
|
|||
|
||||
/* Element */
|
||||
str = SysAllocString(szElement);
|
||||
hr = IXMLDOMDocument_createElement(doc, szElement, &pElement);
|
||||
hr = IXMLDOMDocument_createElement(doc, str, &pElement);
|
||||
SysFreeString(str);
|
||||
ok(hr == S_OK, "ret %08x\n", hr );
|
||||
if(hr == S_OK)
|
||||
|
|
Loading…
Reference in New Issue