msxml3: Use IXMLDOMNode_get_nodeType in xmlnode_appendChild.

This commit is contained in:
Piotr Caban 2008-07-08 20:53:58 +02:00 committed by Alexandre Julliard
parent cabbe8fa35
commit 26b95dc7fd
1 changed files with 6 additions and 17 deletions

View File

@ -661,29 +661,18 @@ static HRESULT WINAPI xmlnode_appendChild(
IXMLDOMNode** outNewChild) IXMLDOMNode** outNewChild)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface ); xmlnode *This = impl_from_IXMLDOMNode( iface );
IXMLDOMNode *pAttr = NULL; DOMNodeType type;
VARIANT var; VARIANT var;
HRESULT hr;
TRACE("(%p)->(%p,%p)\n", This, newChild, outNewChild); TRACE("(%p)->(%p,%p)\n", This, newChild, outNewChild);
/* Cannot Append an Attribute node. */ hr = IXMLDOMNode_get_nodeType(newChild, &type);
IUnknown_QueryInterface(newChild, &IID_IXMLDOMNode, (LPVOID*)&pAttr); if(FAILED(hr) || type == NODE_ATTRIBUTE) {
if(pAttr)
{
xmlnode *ThisNew = impl_from_IXMLDOMNode( pAttr );
if(ThisNew->node->type == XML_ATTRIBUTE_NODE)
{
if(outNewChild) *outNewChild = NULL; if(outNewChild) *outNewChild = NULL;
IUnknown_Release(pAttr);
return E_FAIL; return E_FAIL;
} }
IUnknown_Release(pAttr);
}
VariantInit(&var); VariantInit(&var);
return IXMLDOMNode_insertBefore(iface, newChild, var, outNewChild); return IXMLDOMNode_insertBefore(iface, newChild, var, outNewChild);
} }