msxml3: nextSibling not supported for Attribute, Document and Document Fragment Nodes.

This commit is contained in:
Alistair Leslie-Hughes 2008-01-08 09:59:01 +11:00 committed by Alexandre Julliard
parent 492947aa02
commit 4e908f65fb
2 changed files with 34 additions and 1 deletions

View File

@ -350,7 +350,23 @@ static HRESULT WINAPI xmlnode_get_nextSibling(
IXMLDOMNode** nextSibling) IXMLDOMNode** nextSibling)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface ); xmlnode *This = impl_from_IXMLDOMNode( iface );
return get_node( This, "next", This->node->next, nextSibling );
TRACE("%p\n", This );
if (!nextSibling)
return E_INVALIDARG;
switch( This->node->type )
{
/* Attribute, Document and Document Fragment Nodes do not support nextSibling */
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_ATTRIBUTE_NODE:
*nextSibling = NULL;
return S_FALSE;
default:
return get_node( This, "next", This->node->next, nextSibling );
}
} }
static HRESULT WINAPI xmlnode_get_attributes( static HRESULT WINAPI xmlnode_get_attributes(

View File

@ -1767,11 +1767,19 @@ static void test_xmlTypes(void)
IXMLDOMAttribute *pAttrubute; IXMLDOMAttribute *pAttrubute;
IXMLDOMNamedNodeMap *pAttribs; IXMLDOMNamedNodeMap *pAttribs;
BSTR str; BSTR str;
IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; /* Used for testing Siblings */
hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc ); hr = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (LPVOID*)&doc );
if( hr != S_OK ) if( hr != S_OK )
return; return;
hr = IXMLDOMDocument_get_nextSibling(doc, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
hr = IXMLDOMDocument_get_nextSibling(doc, &pNextChild);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok(pNextChild == NULL, "pDocChild not NULL\n");
hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot); hr = IXMLDOMDocument_createElement(doc, _bstr_("Testing"), &pRoot);
ok(hr == S_OK, "ret %08x\n", hr ); ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK) if(hr == S_OK)
@ -1825,6 +1833,15 @@ static void test_xmlTypes(void)
if(hr == S_OK) if(hr == S_OK)
{ {
IXMLDOMNode *pNewChild = (IXMLDOMNode *)0x1; IXMLDOMNode *pNewChild = (IXMLDOMNode *)0x1;
hr = IXMLDOMAttribute_get_nextSibling(pAttrubute, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
pNextChild = (IXMLDOMNode *)0x1;
hr = IXMLDOMAttribute_get_nextSibling(pAttrubute, &pNextChild);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok(pNextChild == NULL, "pNextChild not NULL\n");
hr = IXMLDOMElement_appendChild(pElement, (IXMLDOMNode*)pAttrubute, &pNewChild); hr = IXMLDOMElement_appendChild(pElement, (IXMLDOMNode*)pAttrubute, &pNewChild);
ok(hr == E_FAIL, "ret %08x\n", hr ); ok(hr == E_FAIL, "ret %08x\n", hr );
ok(pNewChild == NULL, "pNewChild not NULL\n"); ok(pNewChild == NULL, "pNewChild not NULL\n");