diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c index 368b731fb8..aa59ec3913 100644 --- a/dlls/msxml3/cdata.c +++ b/dlls/msxml3/cdata.c @@ -41,8 +41,8 @@ typedef struct _domcdata { const struct IXMLDOMCDATASectionVtbl *lpVtbl; LONG ref; - IUnknown *element_unk; - IXMLDOMCDATASection *element; + IUnknown *node_unk; + IXMLDOMNode *node; } domcdata; static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface ) @@ -65,10 +65,9 @@ static HRESULT WINAPI domcdata_QueryInterface( { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) || - IsEqualGUID( riid, &IID_IXMLDOMElement ) ) + else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->element_unk, riid, ppvObject); + return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); } else { @@ -97,7 +96,7 @@ static ULONG WINAPI domcdata_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->element_unk ); + IUnknown_Release( This->node_unk ); HeapFree( GetProcessHeap(), 0, This ); } @@ -186,7 +185,7 @@ static HRESULT WINAPI domcdata_get_nodeName( BSTR* p ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeName( This->element, p ); + return IXMLDOMNode_get_nodeName( This->node, p ); } static HRESULT WINAPI domcdata_get_nodeValue( @@ -194,7 +193,7 @@ static HRESULT WINAPI domcdata_get_nodeValue( VARIANT* var1 ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeValue( This->element, var1 ); + return IXMLDOMNode_get_nodeValue( This->node, var1 ); } static HRESULT WINAPI domcdata_put_nodeValue( @@ -202,7 +201,7 @@ static HRESULT WINAPI domcdata_put_nodeValue( VARIANT var1 ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_nodeValue( This->element, var1 ); + return IXMLDOMNode_put_nodeValue( This->node, var1 ); } static HRESULT WINAPI domcdata_get_nodeType( @@ -210,7 +209,7 @@ static HRESULT WINAPI domcdata_get_nodeType( DOMNodeType* domNodeType ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeType( This->element, domNodeType ); + return IXMLDOMNode_get_nodeType( This->node, domNodeType ); } static HRESULT WINAPI domcdata_get_parentNode( @@ -218,7 +217,7 @@ static HRESULT WINAPI domcdata_get_parentNode( IXMLDOMNode** parent ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_parentNode( This->element, parent ); + return IXMLDOMNode_get_parentNode( This->node, parent ); } static HRESULT WINAPI domcdata_get_childNodes( @@ -226,7 +225,7 @@ static HRESULT WINAPI domcdata_get_childNodes( IXMLDOMNodeList** outList) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_childNodes( This->element, outList ); + return IXMLDOMNode_get_childNodes( This->node, outList ); } static HRESULT WINAPI domcdata_get_firstChild( @@ -234,7 +233,7 @@ static HRESULT WINAPI domcdata_get_firstChild( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_firstChild( This->element, domNode ); + return IXMLDOMNode_get_firstChild( This->node, domNode ); } static HRESULT WINAPI domcdata_get_lastChild( @@ -242,7 +241,7 @@ static HRESULT WINAPI domcdata_get_lastChild( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_lastChild( This->element, domNode ); + return IXMLDOMNode_get_lastChild( This->node, domNode ); } static HRESULT WINAPI domcdata_get_previousSibling( @@ -250,7 +249,7 @@ static HRESULT WINAPI domcdata_get_previousSibling( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_previousSibling( This->element, domNode ); + return IXMLDOMNode_get_previousSibling( This->node, domNode ); } static HRESULT WINAPI domcdata_get_nextSibling( @@ -258,7 +257,7 @@ static HRESULT WINAPI domcdata_get_nextSibling( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nextSibling( This->element, domNode ); + return IXMLDOMNode_get_nextSibling( This->node, domNode ); } static HRESULT WINAPI domcdata_get_attributes( @@ -266,7 +265,7 @@ static HRESULT WINAPI domcdata_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_attributes( This->element, attributeMap ); + return IXMLDOMNode_get_attributes( This->node, attributeMap ); } static HRESULT WINAPI domcdata_insertBefore( @@ -275,7 +274,7 @@ static HRESULT WINAPI domcdata_insertBefore( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); } static HRESULT WINAPI domcdata_replaceChild( @@ -285,7 +284,7 @@ static HRESULT WINAPI domcdata_replaceChild( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); } static HRESULT WINAPI domcdata_removeChild( @@ -293,7 +292,7 @@ static HRESULT WINAPI domcdata_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_removeChild( This->element, domNode, oldNode ); + return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); } static HRESULT WINAPI domcdata_appendChild( @@ -301,7 +300,7 @@ static HRESULT WINAPI domcdata_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_appendChild( This->element, newNode, outNewNode ); + return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); } static HRESULT WINAPI domcdata_hasChildNodes( @@ -309,7 +308,7 @@ static HRESULT WINAPI domcdata_hasChildNodes( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_hasChildNodes( This->element, pbool ); + return IXMLDOMNode_hasChildNodes( This->node, pbool ); } static HRESULT WINAPI domcdata_get_ownerDocument( @@ -317,7 +316,7 @@ static HRESULT WINAPI domcdata_get_ownerDocument( IXMLDOMDocument** domDocument) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_ownerDocument( This->element, domDocument ); + return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); } static HRESULT WINAPI domcdata_cloneNode( @@ -325,7 +324,7 @@ static HRESULT WINAPI domcdata_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_cloneNode( This->element, pbool, outNode ); + return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); } static HRESULT WINAPI domcdata_get_nodeTypeString( @@ -333,7 +332,7 @@ static HRESULT WINAPI domcdata_get_nodeTypeString( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeTypeString( This->element, p ); + return IXMLDOMNode_get_nodeTypeString( This->node, p ); } static HRESULT WINAPI domcdata_get_text( @@ -341,7 +340,7 @@ static HRESULT WINAPI domcdata_get_text( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_text( This->element, p ); + return IXMLDOMNode_get_text( This->node, p ); } static HRESULT WINAPI domcdata_put_text( @@ -349,7 +348,7 @@ static HRESULT WINAPI domcdata_put_text( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_text( This->element, p ); + return IXMLDOMNode_put_text( This->node, p ); } static HRESULT WINAPI domcdata_get_specified( @@ -357,7 +356,7 @@ static HRESULT WINAPI domcdata_get_specified( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_specified( This->element, pbool ); + return IXMLDOMNode_get_specified( This->node, pbool ); } static HRESULT WINAPI domcdata_get_definition( @@ -365,7 +364,7 @@ static HRESULT WINAPI domcdata_get_definition( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_definition( This->element, domNode ); + return IXMLDOMNode_get_definition( This->node, domNode ); } static HRESULT WINAPI domcdata_get_nodeTypedValue( @@ -373,7 +372,7 @@ static HRESULT WINAPI domcdata_get_nodeTypedValue( VARIANT* var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->element, var1 ); + return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); } static HRESULT WINAPI domcdata_put_nodeTypedValue( @@ -381,7 +380,7 @@ static HRESULT WINAPI domcdata_put_nodeTypedValue( VARIANT var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->element, var1 ); + return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); } static HRESULT WINAPI domcdata_get_dataType( @@ -389,7 +388,7 @@ static HRESULT WINAPI domcdata_get_dataType( VARIANT* var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_dataType( This->element, var1 ); + return IXMLDOMNode_get_dataType( This->node, var1 ); } static HRESULT WINAPI domcdata_put_dataType( @@ -397,7 +396,7 @@ static HRESULT WINAPI domcdata_put_dataType( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_dataType( This->element, p ); + return IXMLDOMNode_put_dataType( This->node, p ); } static HRESULT WINAPI domcdata_get_xml( @@ -405,7 +404,7 @@ static HRESULT WINAPI domcdata_get_xml( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_xml( This->element, p ); + return IXMLDOMNode_get_xml( This->node, p ); } static HRESULT WINAPI domcdata_transformNode( @@ -413,7 +412,7 @@ static HRESULT WINAPI domcdata_transformNode( IXMLDOMNode* domNode, BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_transformNode( This->element, domNode, p ); + return IXMLDOMNode_transformNode( This->node, domNode, p ); } static HRESULT WINAPI domcdata_selectNodes( @@ -421,7 +420,7 @@ static HRESULT WINAPI domcdata_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_selectNodes( This->element, p, outList ); + return IXMLDOMNode_selectNodes( This->node, p, outList ); } static HRESULT WINAPI domcdata_selectSingleNode( @@ -429,7 +428,7 @@ static HRESULT WINAPI domcdata_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_selectSingleNode( This->element, p, outNode ); + return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); } static HRESULT WINAPI domcdata_get_parsed( @@ -437,7 +436,7 @@ static HRESULT WINAPI domcdata_get_parsed( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_parsed( This->element, pbool ); + return IXMLDOMNode_get_parsed( This->node, pbool ); } static HRESULT WINAPI domcdata_get_namespaceURI( @@ -445,7 +444,7 @@ static HRESULT WINAPI domcdata_get_namespaceURI( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_namespaceURI( This->element, p ); + return IXMLDOMNode_get_namespaceURI( This->node, p ); } static HRESULT WINAPI domcdata_get_prefix( @@ -453,7 +452,7 @@ static HRESULT WINAPI domcdata_get_prefix( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_prefix( This->element, p ); + return IXMLDOMNode_get_prefix( This->node, p ); } static HRESULT WINAPI domcdata_get_baseName( @@ -461,7 +460,7 @@ static HRESULT WINAPI domcdata_get_baseName( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_baseName( This->element, p ); + return IXMLDOMNode_get_baseName( This->node, p ); } static HRESULT WINAPI domcdata_transformNodeToObject( @@ -469,7 +468,7 @@ static HRESULT WINAPI domcdata_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); } static HRESULT WINAPI domcdata_get_data( @@ -483,7 +482,7 @@ static HRESULT WINAPI domcdata_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( This->element, &vRet ); + hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -505,7 +504,7 @@ static HRESULT WINAPI domcdata_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( This->element, val ); + hr = IXMLDOMNode_put_nodeValue( This->node, val ); return hr; } @@ -515,7 +514,7 @@ static HRESULT WINAPI domcdata_get_length( long *len) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element ); + xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->node ); xmlChar *pContent; long nLength = 0; @@ -541,7 +540,7 @@ static HRESULT WINAPI domcdata_substringData( long offset, long count, BSTR *p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element ); + xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->node ); xmlChar *pContent; long nLength = 0; HRESULT hr = S_FALSE; @@ -586,7 +585,7 @@ static HRESULT WINAPI domcdata_appendData( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element ); + xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->node ); xmlChar *pContent; HRESULT hr = S_FALSE; @@ -616,7 +615,7 @@ static HRESULT WINAPI domcdata_insertData( long offset, BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element ); + xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->node ); xmlChar *pXmlContent; BSTR sNewString; HRESULT hr = S_FALSE; @@ -774,22 +773,22 @@ IUnknown* create_cdata( xmlNodePtr text ) This->lpVtbl = &domcdata_vtbl; This->ref = 1; - This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl ); - if(!This->element_unk) + This->node_unk = create_basic_node( text, (IUnknown*)&This->lpVtbl ); + if(!This->node_unk) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element); + hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node); if(FAILED(hr)) { - IUnknown_Release(This->element_unk); + IUnknown_Release(This->node_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); + /* The ref on This->node is actually looped back into this object, so release it */ + IXMLDOMNode_Release(This->node); return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index df3fa0e288..e27c5064fd 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -2907,6 +2907,9 @@ static void test_xmlTypes(void) IXMLDOMNode *pNextChild = (IXMLDOMNode *)0x1; VARIANT var; + hr = IXMLDOMCDATASection_QueryInterface(pCDataSec, &IID_IXMLDOMElement, (LPVOID*)&pElement); + ok(hr == E_NOINTERFACE, "ret %08x\n", hr); + hr = IXMLDOMElement_appendChild(pRoot, (IXMLDOMNode*)pCDataSec, NULL); ok(hr == S_OK, "ret %08x\n", hr );