From b9e9e041e8f0b5d15a834a91557d9a5ac83261c0 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 14 Jan 2008 13:25:13 +1100 Subject: [PATCH] msxml3: Implemented IXMLDOMCDATASection COM Object. --- dlls/msxml3/Makefile.in | 1 + dlls/msxml3/cdata.c | 594 ++++++++++++++++++++++++++++++++++++ dlls/msxml3/domdoc.c | 25 +- dlls/msxml3/msxml_private.h | 1 + dlls/msxml3/tests/domdoc.c | 60 ++++ 5 files changed, 679 insertions(+), 2 deletions(-) create mode 100644 dlls/msxml3/cdata.c diff --git a/dlls/msxml3/Makefile.in b/dlls/msxml3/Makefile.in index 63c10d8fa17..20a7b4071f8 100644 --- a/dlls/msxml3/Makefile.in +++ b/dlls/msxml3/Makefile.in @@ -10,6 +10,7 @@ EXTRAINCL = @XML2INCL@ @XSLTINCL@ C_SRCS = \ attribute.c \ + cdata.c \ comment.c \ domdoc.c \ element.c \ diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c new file mode 100644 index 00000000000..b46d8514900 --- /dev/null +++ b/dlls/msxml3/cdata.c @@ -0,0 +1,594 @@ +/* + * DOM CDATA node implementation + * + * Copyright 2007 Alistair Leslie-Hughes + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "config.h" + +#include +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "msxml2.h" + +#include "msxml_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msxml); + +#ifdef HAVE_LIBXML2 + +typedef struct _domcdata +{ + const struct IXMLDOMCDATASectionVtbl *lpVtbl; + LONG ref; + IUnknown *element_unk; + IXMLDOMCDATASection *element; +} domcdata; + +static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface ) +{ + return (domcdata *)((char*)iface - FIELD_OFFSET(domcdata, lpVtbl)); +} + +static HRESULT WINAPI domcdata_QueryInterface( + IXMLDOMCDATASection *iface, + REFIID riid, + void** ppvObject ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + + if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else if ( IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || + IsEqualGUID( riid, &IID_IXMLDOMElement ) ) + { + return IUnknown_QueryInterface(This->element_unk, riid, ppvObject); + } + else + { + FIXME("Unsupported inteferace %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IXMLDOMCDATASection_AddRef( iface ); + + return S_OK; +} + +static ULONG WINAPI domcdata_AddRef( + IXMLDOMCDATASection *iface ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return InterlockedIncrement( &This->ref ); +} + +static ULONG WINAPI domcdata_Release( + IXMLDOMCDATASection *iface ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + ULONG ref; + + ref = InterlockedDecrement( &This->ref ); + if ( ref == 0 ) + { + IUnknown_Release( This->element_unk ); + HeapFree( GetProcessHeap(), 0, This ); + } + + return ref; +} + +static HRESULT WINAPI domcdata_GetTypeInfoCount( + IXMLDOMCDATASection *iface, + UINT* pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_GetTypeInfo( + IXMLDOMCDATASection *iface, + UINT iTInfo, LCID lcid, + ITypeInfo** ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_GetIDsOfNames( + IXMLDOMCDATASection *iface, + REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_Invoke( + IXMLDOMCDATASection *iface, + DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, + EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_get_nodeName( + IXMLDOMCDATASection *iface, + BSTR* p ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nodeName( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_nodeValue( + IXMLDOMCDATASection *iface, + VARIANT* var1 ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nodeValue( This->element, var1 ); +} + +static HRESULT WINAPI domcdata_put_nodeValue( + IXMLDOMCDATASection *iface, + VARIANT var1 ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_put_nodeValue( This->element, var1 ); +} + +static HRESULT WINAPI domcdata_get_nodeType( + IXMLDOMCDATASection *iface, + DOMNodeType* domNodeType ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nodeType( This->element, domNodeType ); +} + +static HRESULT WINAPI domcdata_get_parentNode( + IXMLDOMCDATASection *iface, + IXMLDOMNode** parent ) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_parentNode( This->element, parent ); +} + +static HRESULT WINAPI domcdata_get_childNodes( + IXMLDOMCDATASection *iface, + IXMLDOMNodeList** outList) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_childNodes( This->element, outList ); +} + +static HRESULT WINAPI domcdata_get_firstChild( + IXMLDOMCDATASection *iface, + IXMLDOMNode** domNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_firstChild( This->element, domNode ); +} + +static HRESULT WINAPI domcdata_get_lastChild( + IXMLDOMCDATASection *iface, + IXMLDOMNode** domNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_lastChild( This->element, domNode ); +} + +static HRESULT WINAPI domcdata_get_previousSibling( + IXMLDOMCDATASection *iface, + IXMLDOMNode** domNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_previousSibling( This->element, domNode ); +} + +static HRESULT WINAPI domcdata_get_nextSibling( + IXMLDOMCDATASection *iface, + IXMLDOMNode** domNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nextSibling( This->element, domNode ); +} + +static HRESULT WINAPI domcdata_get_attributes( + IXMLDOMCDATASection *iface, + IXMLDOMNamedNodeMap** attributeMap) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_attributes( This->element, attributeMap ); +} + +static HRESULT WINAPI domcdata_insertBefore( + IXMLDOMCDATASection *iface, + IXMLDOMNode* newNode, VARIANT var1, + IXMLDOMNode** outOldNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode ); +} + +static HRESULT WINAPI domcdata_replaceChild( + IXMLDOMCDATASection *iface, + IXMLDOMNode* newNode, + IXMLDOMNode* oldNode, + IXMLDOMNode** outOldNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode ); +} + +static HRESULT WINAPI domcdata_removeChild( + IXMLDOMCDATASection *iface, + IXMLDOMNode* domNode, IXMLDOMNode** oldNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_removeChild( This->element, domNode, oldNode ); +} + +static HRESULT WINAPI domcdata_appendChild( + IXMLDOMCDATASection *iface, + IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_appendChild( This->element, newNode, outNewNode ); +} + +static HRESULT WINAPI domcdata_hasChildNodes( + IXMLDOMCDATASection *iface, + VARIANT_BOOL* pbool) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_hasChildNodes( This->element, pbool ); +} + +static HRESULT WINAPI domcdata_get_ownerDocument( + IXMLDOMCDATASection *iface, + IXMLDOMDocument** domDocument) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_ownerDocument( This->element, domDocument ); +} + +static HRESULT WINAPI domcdata_cloneNode( + IXMLDOMCDATASection *iface, + VARIANT_BOOL pbool, IXMLDOMNode** outNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_cloneNode( This->element, pbool, outNode ); +} + +static HRESULT WINAPI domcdata_get_nodeTypeString( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nodeTypeString( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_text( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_text( This->element, p ); +} + +static HRESULT WINAPI domcdata_put_text( + IXMLDOMCDATASection *iface, + BSTR p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_put_text( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_specified( + IXMLDOMCDATASection *iface, + VARIANT_BOOL* pbool) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_specified( This->element, pbool ); +} + +static HRESULT WINAPI domcdata_get_definition( + IXMLDOMCDATASection *iface, + IXMLDOMNode** domNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_definition( This->element, domNode ); +} + +static HRESULT WINAPI domcdata_get_nodeTypedValue( + IXMLDOMCDATASection *iface, + VARIANT* var1) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_nodeTypedValue( This->element, var1 ); +} + +static HRESULT WINAPI domcdata_put_nodeTypedValue( + IXMLDOMCDATASection *iface, + VARIANT var1) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_put_nodeTypedValue( This->element, var1 ); +} + +static HRESULT WINAPI domcdata_get_dataType( + IXMLDOMCDATASection *iface, + VARIANT* var1) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_dataType( This->element, var1 ); +} + +static HRESULT WINAPI domcdata_put_dataType( + IXMLDOMCDATASection *iface, + BSTR p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_put_dataType( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_xml( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_xml( This->element, p ); +} + +static HRESULT WINAPI domcdata_transformNode( + IXMLDOMCDATASection *iface, + IXMLDOMNode* domNode, BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_transformNode( This->element, domNode, p ); +} + +static HRESULT WINAPI domcdata_selectNodes( + IXMLDOMCDATASection *iface, + BSTR p, IXMLDOMNodeList** outList) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_selectNodes( This->element, p, outList ); +} + +static HRESULT WINAPI domcdata_selectSingleNode( + IXMLDOMCDATASection *iface, + BSTR p, IXMLDOMNode** outNode) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_selectSingleNode( This->element, p, outNode ); +} + +static HRESULT WINAPI domcdata_get_parsed( + IXMLDOMCDATASection *iface, + VARIANT_BOOL* pbool) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_parsed( This->element, pbool ); +} + +static HRESULT WINAPI domcdata_get_namespaceURI( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_namespaceURI( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_prefix( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_prefix( This->element, p ); +} + +static HRESULT WINAPI domcdata_get_baseName( + IXMLDOMCDATASection *iface, + BSTR* p) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_get_baseName( This->element, p ); +} + +static HRESULT WINAPI domcdata_transformNodeToObject( + IXMLDOMCDATASection *iface, + IXMLDOMNode* domNode, VARIANT var1) +{ + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 ); +} + +static HRESULT WINAPI domcdata_get_data( + IXMLDOMCDATASection *iface, + BSTR *p) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_put_data( + IXMLDOMCDATASection *iface, + BSTR data) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_get_length( + IXMLDOMCDATASection *iface, + long *len) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_substringData( + IXMLDOMCDATASection *iface, + long offset, long count, BSTR *p) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_appendData( + IXMLDOMCDATASection *iface, + BSTR p) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_insertData( + IXMLDOMCDATASection *iface, + long offset, BSTR p) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_deleteData( + IXMLDOMCDATASection *iface, + long offset, long count) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_replaceData( + IXMLDOMCDATASection *iface, + long offset, long count, BSTR p) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI domcdata_splitText( + IXMLDOMCDATASection *iface, + long offset, IXMLDOMText **txtNode) +{ + FIXME("\n"); + return E_NOTIMPL; +} + + +static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl = +{ + domcdata_QueryInterface, + domcdata_AddRef, + domcdata_Release, + domcdata_GetTypeInfoCount, + domcdata_GetTypeInfo, + domcdata_GetIDsOfNames, + domcdata_Invoke, + domcdata_get_nodeName, + domcdata_get_nodeValue, + domcdata_put_nodeValue, + domcdata_get_nodeType, + domcdata_get_parentNode, + domcdata_get_childNodes, + domcdata_get_firstChild, + domcdata_get_lastChild, + domcdata_get_previousSibling, + domcdata_get_nextSibling, + domcdata_get_attributes, + domcdata_insertBefore, + domcdata_replaceChild, + domcdata_removeChild, + domcdata_appendChild, + domcdata_hasChildNodes, + domcdata_get_ownerDocument, + domcdata_cloneNode, + domcdata_get_nodeTypeString, + domcdata_get_text, + domcdata_put_text, + domcdata_get_specified, + domcdata_get_definition, + domcdata_get_nodeTypedValue, + domcdata_put_nodeTypedValue, + domcdata_get_dataType, + domcdata_put_dataType, + domcdata_get_xml, + domcdata_transformNode, + domcdata_selectNodes, + domcdata_selectSingleNode, + domcdata_get_parsed, + domcdata_get_namespaceURI, + domcdata_get_prefix, + domcdata_get_baseName, + domcdata_transformNodeToObject, + domcdata_get_data, + domcdata_put_data, + domcdata_get_length, + domcdata_substringData, + domcdata_appendData, + domcdata_insertData, + domcdata_deleteData, + domcdata_replaceData, + domcdata_splitText +}; + +IUnknown* create_cdata( xmlNodePtr text ) +{ + domcdata *This; + HRESULT hr; + + This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); + if ( !This ) + return NULL; + + This->lpVtbl = &domcdata_vtbl; + This->ref = 1; + + This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl ); + if(!This->element_unk) + { + HeapFree(GetProcessHeap(), 0, This); + return NULL; + } + + hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element); + if(FAILED(hr)) + { + IUnknown_Release(This->element_unk); + HeapFree( GetProcessHeap(), 0, This ); + return NULL; + } + /* The ref on This->element is actually looped back into this object, so release it */ + IXMLDOMNode_Release(This->element); + + return (IUnknown*) &This->lpVtbl; +} + +#endif diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 856fcb0284a..15772e5ba34 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -947,8 +947,29 @@ static HRESULT WINAPI domdoc_createCDATASection( BSTR data, IXMLDOMCDATASection** cdata ) { - FIXME("\n"); - return E_NOTIMPL; + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + xmlNodePtr xmlnode; + xmlChar *xml_content; + + TRACE("%p->(%s %p)\n", iface, debugstr_w(data), comment); + + if(!cdata) + return E_INVALIDARG; + + *cdata = NULL; + + xml_content = xmlChar_from_wchar((WCHAR*)data); + xmlnode = xmlNewCDataBlock(get_doc( This ), xml_content, strlen( (char*)xml_content) ); + HeapFree(GetProcessHeap(), 0, xml_content); + + if(!xmlnode) + return E_FAIL; + + xmlnode->doc = get_doc( This ); + + *cdata = (IXMLDOMCDATASection*)create_cdata(xmlnode); + + return S_OK; } diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index fc6ffb8be37..70b7a60f76a 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -41,6 +41,7 @@ extern IUnknown *create_attribute( xmlNodePtr attribute ); extern IUnknown *create_text( xmlNodePtr text ); extern IUnknown *create_pi( xmlNodePtr pi ); extern IUnknown *create_comment( xmlNodePtr comment ); +extern IUnknown *create_cdata( xmlNodePtr text ); extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ); extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node ); diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 5535bed1eb5..dcd2168957a 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -146,6 +146,13 @@ static WCHAR szElementXML2[] = {'<','E','l','e','T','e','s','t',' ','A','t','t', static WCHAR szAttribute[] = {'A','t','t','r',0 }; static WCHAR szAttributeXML[] = {'A','t','t','r','=','"','"',0 }; +static WCHAR szCData[] = {'[','1',']','*','2','=','3',';',' ','&','g','e','e',' ','t','h','a','t','s', + ' ','n','o','t',' ','r','i','g','h','t','!', 0}; +static WCHAR szCDataXML[] = {'<','!','[','C','D','A','T','A','[','[','1',']','*','2','=','3',';',' ','&', + 'g','e','e',' ','t','h','a','t','s',' ','n','o','t',' ','r','i','g','h','t', + '!',']',']','>',0}; +static WCHAR szCDataNodeText[] = {'#','c','d','a','t','a','-','s','e','c','t','i','o','n',0 }; + #define expect_bstr_eq_and_free(bstr, expect) { \ BSTR bstrExp = alloc_str_from_narrow(expect); \ ok(lstrcmpW(bstr, bstrExp) == 0, "String differs\n"); \ @@ -1839,6 +1846,7 @@ static void test_xmlTypes(void) IXMLDOMElement *pElement; IXMLDOMAttribute *pAttrubute; IXMLDOMNamedNodeMap *pAttribs; + IXMLDOMCDATASection *pCDataSec; BSTR str; IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; /* Used for testing Siblings */ VARIANT v; @@ -2018,6 +2026,58 @@ static void test_xmlTypes(void) IXMLDOMElement_Release(pElement); } + /* CData Section */ + hr = IXMLDOMDocument_createCDATASection(doc, szCData, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr ); + + hr = IXMLDOMDocument_createCDATASection(doc, szCData, &pCDataSec); + ok(hr == S_OK, "ret %08x\n", hr ); + if(hr == S_OK) + { + IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; + + hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pCDataSec, NULL); + ok(hr == S_OK, "ret %08x\n", hr ); + + /* get Attribute Tests */ + hr = IXMLDOMCDATASection_get_attributes(pCDataSec, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr ); + + pAttribs = (IXMLDOMNamedNodeMap*)0x1; + hr = IXMLDOMCDATASection_get_attributes(pCDataSec, &pAttribs); + ok(hr == S_FALSE, "ret %08x\n", hr ); + ok(pAttribs == NULL, "pAttribs != NULL\n"); + + hr = IXMLDOMCDATASection_get_nodeName(pCDataSec, &str); + ok(hr == S_OK, "ret %08x\n", hr ); + ok( !lstrcmpW( str, szCDataNodeText ), "incorrect cdata node Name\n"); + SysFreeString(str); + + hr = IXMLDOMCDATASection_get_xml(pCDataSec, &str); + ok(hr == S_OK, "ret %08x\n", hr ); + ok( !lstrcmpW( str, szCDataXML ), "incorrect cdata xml\n"); + SysFreeString(str); + + /* test lastChild */ + pNextChild = (IXMLDOMNode*)0x1; + hr = IXMLDOMCDATASection_get_lastChild(pCDataSec, &pNextChild); + ok(hr == S_FALSE, "ret %08x\n", hr ); + ok(pNextChild == NULL, "pNextChild not NULL\n"); + + /* test get_dataType */ + hr = IXMLDOMCDATASection_get_dataType(pCDataSec, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr ); + + hr = IXMLDOMCDATASection_get_dataType(pCDataSec, &v); + ok(hr == S_FALSE, "ret %08x\n", hr ); + ok( V_VT(&v) == VT_NULL, "incorrect dataType type\n"); + VariantClear(&v); + + IXMLDOMCDATASection_Release(pCDataSec); + } + + + IXMLDOMElement_Release( pRoot ); } }