Commit c40d4997 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msxml3: Implement IXMLDOMDocumentFragment Interface.

parent 90eb70bc
...@@ -12,6 +12,7 @@ C_SRCS = \ ...@@ -12,6 +12,7 @@ C_SRCS = \
attribute.c \ attribute.c \
cdata.c \ cdata.c \
comment.c \ comment.c \
docfrag.c \
domdoc.c \ domdoc.c \
domimpl.c \ domimpl.c \
element.c \ element.c \
......
...@@ -885,8 +885,26 @@ static HRESULT WINAPI domdoc_createDocumentFragment( ...@@ -885,8 +885,26 @@ static HRESULT WINAPI domdoc_createDocumentFragment(
IXMLDOMDocument2 *iface, IXMLDOMDocument2 *iface,
IXMLDOMDocumentFragment** docFrag ) IXMLDOMDocumentFragment** docFrag )
{ {
FIXME("\n"); domdoc *This = impl_from_IXMLDOMDocument2( iface );
return E_NOTIMPL; xmlNodePtr xmlnode;
TRACE("%p\n", iface);
if(!docFrag)
return E_INVALIDARG;
*docFrag = NULL;
xmlnode = xmlNewDocFragment(get_doc( This ) );
if(!xmlnode)
return E_FAIL;
xmlnode->doc = get_doc( This );
*docFrag = (IXMLDOMDocumentFragment*)create_doc_fragment(xmlnode);
return S_OK;
} }
......
...@@ -45,6 +45,7 @@ extern IUnknown *create_cdata( xmlNodePtr text ); ...@@ -45,6 +45,7 @@ extern IUnknown *create_cdata( xmlNodePtr text );
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ); extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node ); extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node );
extern IUnknown *create_doc_Implementation(); extern IUnknown *create_doc_Implementation();
extern IUnknown *create_doc_fragment( xmlNodePtr fragment );
extern HRESULT queryresult_create( xmlNodePtr, LPWSTR, IXMLDOMNodeList ** ); extern HRESULT queryresult_create( xmlNodePtr, LPWSTR, IXMLDOMNodeList ** );
......
...@@ -154,6 +154,7 @@ static WCHAR szCDataXML[] = {'<','!','[','C','D','A','T','A','[','[','1',']','*' ...@@ -154,6 +154,7 @@ static WCHAR szCDataXML[] = {'<','!','[','C','D','A','T','A','[','[','1',']','*'
'g','e','e',' ','t','h','a','t','s',' ','n','o','t',' ','r','i','g','h','t', 'g','e','e',' ','t','h','a','t','s',' ','n','o','t',' ','r','i','g','h','t',
'!',']',']','>',0}; '!',']',']','>',0};
static WCHAR szCDataNodeText[] = {'#','c','d','a','t','a','-','s','e','c','t','i','o','n',0 }; static WCHAR szCDataNodeText[] = {'#','c','d','a','t','a','-','s','e','c','t','i','o','n',0 };
static WCHAR szDocFragmentText[] = {'#','d','o','c','u','m','e','n','t','-','f','r','a','g','m','e','n','t',0 };
#define expect_bstr_eq_and_free(bstr, expect) { \ #define expect_bstr_eq_and_free(bstr, expect) { \
BSTR bstrExp = alloc_str_from_narrow(expect); \ BSTR bstrExp = alloc_str_from_narrow(expect); \
...@@ -1873,6 +1874,7 @@ static void test_xmlTypes(void) ...@@ -1873,6 +1874,7 @@ static void test_xmlTypes(void)
IXMLDOMNamedNodeMap *pAttribs; IXMLDOMNamedNodeMap *pAttribs;
IXMLDOMCDATASection *pCDataSec; IXMLDOMCDATASection *pCDataSec;
IXMLDOMImplementation *pIXMLDOMImplementation = NULL; IXMLDOMImplementation *pIXMLDOMImplementation = NULL;
IXMLDOMDocumentFragment *pDocFrag = NULL;
BSTR str; BSTR str;
IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; /* Used for testing Siblings */ IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; /* Used for testing Siblings */
VARIANT v; VARIANT v;
...@@ -2194,6 +2196,70 @@ static void test_xmlTypes(void) ...@@ -2194,6 +2196,70 @@ static void test_xmlTypes(void)
IXMLDOMCDATASection_Release(pCDataSec); IXMLDOMCDATASection_Release(pCDataSec);
} }
/* Document Fragments */
hr = IXMLDOMDocument_createDocumentFragment(doc, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
hr = IXMLDOMDocument_createDocumentFragment(doc, &pDocFrag);
ok(hr == S_OK, "ret %08x\n", hr );
if(hr == S_OK)
{
IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1;
hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pDocFrag, NULL);
ok(hr == S_OK, "ret %08x\n", hr );
/* get Attribute Tests */
hr = IXMLDOMDocumentFragment_get_attributes(pDocFrag, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
pAttribs = (IXMLDOMNamedNodeMap*)0x1;
hr = IXMLDOMDocumentFragment_get_attributes(pDocFrag, &pAttribs);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok(pAttribs == NULL, "pAttribs != NULL\n");
hr = IXMLDOMDocumentFragment_get_nodeName(pDocFrag, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, szDocFragmentText ), "incorrect docfragment node Name\n");
SysFreeString(str);
/* test next Sibling*/
hr = IXMLDOMDocumentFragment_get_nextSibling(pDocFrag, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
pNextChild = (IXMLDOMNode *)0x1;
hr = IXMLDOMDocumentFragment_get_nextSibling(pDocFrag, &pNextChild);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok(pNextChild == NULL, "pNextChild not NULL\n");
/* test Previous Sibling*/
hr = IXMLDOMDocumentFragment_get_previousSibling(pDocFrag, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
pNextChild = (IXMLDOMNode *)0x1;
hr = IXMLDOMDocumentFragment_get_previousSibling(pDocFrag, &pNextChild);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok(pNextChild == NULL, "pNextChild not NULL\n");
/* test get_dataType */
hr = IXMLDOMDocumentFragment_get_dataType(pDocFrag, NULL);
ok(hr == E_INVALIDARG, "ret %08x\n", hr );
hr = IXMLDOMDocumentFragment_get_dataType(pDocFrag, &v);
ok(hr == S_FALSE, "ret %08x\n", hr );
ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n");
VariantClear(&v);
/* test nodeTypeString */
hr = IXMLDOMDocumentFragment_get_nodeTypeString(pDocFrag, &str);
ok(hr == S_OK, "ret %08x\n", hr );
ok( !lstrcmpW( str, _bstr_("documentfragment") ), "incorrect nodeTypeString string\n");
SysFreeString(str);
IXMLDOMDocumentFragment_Release(pCDataSec);
}
IXMLDOMElement_Release( pRoot ); IXMLDOMElement_Release( pRoot );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment