From 3aefe2262949e0d3469dfdb159f733d0cbef04f5 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 1 Mar 2010 11:10:15 +0000 Subject: [PATCH] [MSXML3] sync msxml3 to wine 1.1.39 svn path=/trunk/; revision=45736 --- reactos/dll/win32/msxml3/attribute.c | 7 +- reactos/dll/win32/msxml3/cdata.c | 170 ++++---- reactos/dll/win32/msxml3/comment.c | 182 ++++----- reactos/dll/win32/msxml3/docfrag.c | 2 +- reactos/dll/win32/msxml3/domdoc.c | 482 +++++++++++++---------- reactos/dll/win32/msxml3/domimpl.c | 4 +- reactos/dll/win32/msxml3/element.c | 19 +- reactos/dll/win32/msxml3/entityref.c | 2 +- reactos/dll/win32/msxml3/factory.c | 3 +- reactos/dll/win32/msxml3/httprequest.c | 2 +- reactos/dll/win32/msxml3/msxml_private.h | 4 +- reactos/dll/win32/msxml3/node.c | 143 ++++--- reactos/dll/win32/msxml3/nodelist.c | 11 +- reactos/dll/win32/msxml3/nodemap.c | 25 +- reactos/dll/win32/msxml3/parseerror.c | 17 +- reactos/dll/win32/msxml3/pi.c | 4 +- reactos/dll/win32/msxml3/queryresult.c | 11 +- reactos/dll/win32/msxml3/schema.c | 2 +- reactos/dll/win32/msxml3/text.c | 171 ++++---- reactos/include/psdk/msxml2.idl | 9 + 20 files changed, 660 insertions(+), 610 deletions(-) diff --git a/reactos/dll/win32/msxml3/attribute.c b/reactos/dll/win32/msxml3/attribute.c index 04b8c46cb4e..d78fa479f40 100644 --- a/reactos/dll/win32/msxml3/attribute.c +++ b/reactos/dll/win32/msxml3/attribute.c @@ -55,7 +55,7 @@ static HRESULT WINAPI domattr_QueryInterface( void** ppvObject ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMAttribute ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -213,7 +213,10 @@ static HRESULT WINAPI domattr_get_parentNode( IXMLDOMNode** parent ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(&This->node), parent ); + TRACE("(%p)->(%p)\n", This, parent); + if (!parent) return E_INVALIDARG; + *parent = NULL; + return S_FALSE; } static HRESULT WINAPI domattr_get_childNodes( diff --git a/reactos/dll/win32/msxml3/cdata.c b/reactos/dll/win32/msxml3/cdata.c index 7d02a946a0c..3fba66cdbc7 100644 --- a/reactos/dll/win32/msxml3/cdata.c +++ b/reactos/dll/win32/msxml3/cdata.c @@ -55,7 +55,7 @@ static HRESULT WINAPI domcdata_QueryInterface( void** ppvObject ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || @@ -480,7 +480,7 @@ static HRESULT WINAPI domcdata_get_data( BSTR *p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - HRESULT hr = E_FAIL; + HRESULT hr; VARIANT vRet; if(!p) @@ -500,17 +500,14 @@ static HRESULT WINAPI domcdata_put_data( BSTR data) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - HRESULT hr = E_FAIL; VARIANT val; - TRACE("%p %s\n", This, debugstr_w(data) ); + TRACE("(%p)->(%s)\n", This, debugstr_w(data) ); V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); - - return hr; + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); } static HRESULT WINAPI domcdata_get_length( @@ -518,23 +515,21 @@ static HRESULT WINAPI domcdata_get_length( LONG *len) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlChar *pContent; - LONG nLength = 0; + HRESULT hr; + BSTR data; - TRACE("%p\n", iface); + TRACE("(%p)->(%p)\n", This, len); if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMCDATASection_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); - xmlFree(pContent); + *len = SysStringLen(data); + SysFreeString(data); } - *len = nLength; - return S_OK; } @@ -543,11 +538,10 @@ static HRESULT WINAPI domcdata_substringData( LONG offset, LONG count, BSTR *p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlChar *pContent; - LONG nLength = 0; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; - TRACE("%p\n", iface); + TRACE("(%p)->(%d %d %p)\n", This, offset, count, p); if(!p) return E_INVALIDARG; @@ -557,26 +551,24 @@ static HRESULT WINAPI domcdata_substringData( return E_INVALIDARG; if(count == 0) - return hr; + return S_FALSE; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMCDATASection_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); + LONG len = SysStringLen(data); - if( offset < nLength) + if(offset < len) { - BSTR sContent = bstr_from_xmlChar(pContent); - if(offset + count > nLength) - *p = SysAllocString(&sContent[offset]); + if(offset + count > len) + *p = SysAllocString(&data[offset]); else - *p = SysAllocStringLen(&sContent[offset], count); - - SysFreeString(sContent); - hr = S_OK; + *p = SysAllocStringLen(&data[offset], count); } + else + hr = S_FALSE; - xmlFree(pContent); + SysFreeString(data); } return hr; @@ -587,26 +579,30 @@ static HRESULT WINAPI domcdata_appendData( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlChar *pContent; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p\n", iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(p)); /* Nothing to do if NULL or an Empty string passed in. */ - if(p == NULL || SysStringLen(p) == 0) - return S_OK; + if((p_len = SysStringLen(p)) == 0) return S_OK; - pContent = xmlChar_from_wchar( p ); - if(pContent) + hr = IXMLDOMCDATASection_get_data(iface, &data); + if(hr == S_OK) { - if(xmlTextConcat(This->node.node, pContent, SysStringLen(p) ) == 0) - hr = S_OK; - else - hr = E_FAIL; + LONG len = SysStringLen(data); + BSTR str = SysAllocStringLen(NULL, p_len + len); + + memcpy(str, data, len*sizeof(WCHAR)); + memcpy(&str[len], p, p_len*sizeof(WCHAR)); + str[len+p_len] = 0; + + hr = IXMLDOMCDATASection_put_data(iface, str); + + SysFreeString(str); + SysFreeString(data); } - else - hr = E_FAIL; - heap_free(pContent); return hr; } @@ -616,16 +612,14 @@ static HRESULT WINAPI domcdata_insertData( LONG offset, BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlChar *pXmlContent; - BSTR sNewString; - HRESULT hr = S_FALSE; - LONG nLength = 0, nLengthP = 0; - xmlChar *str = NULL; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p\n", This); + TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p)); /* If have a NULL or empty string, don't do anything. */ - if(SysStringLen(p) == 0) + if((p_len = SysStringLen(p)) == 0) return S_OK; if(offset < 0) @@ -633,48 +627,29 @@ static HRESULT WINAPI domcdata_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(This->node.node); - if(pXmlContent) + hr = IXMLDOMCDATASection_get_data(iface, &data); + if(hr == S_OK) { - BSTR sContent = bstr_from_xmlChar( pXmlContent ); - nLength = SysStringLen(sContent); - nLengthP = SysStringLen(p); + LONG len = SysStringLen(data); + BSTR str; - if(nLength < offset) + if(len < offset) { - SysFreeString(sContent); - xmlFree(pXmlContent); - + SysFreeString(data); return E_INVALIDARG; } - sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1); - if(sNewString) - { - if(offset > 0) - memcpy(sNewString, sContent, offset * sizeof(WCHAR)); + str = SysAllocStringLen(NULL, len + p_len); + /* start part, supplied string and end part */ + memcpy(str, data, offset*sizeof(WCHAR)); + memcpy(&str[offset], p, p_len*sizeof(WCHAR)); + memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR)); + str[len+p_len] = 0; - memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR)); + hr = IXMLDOMCDATASection_put_data(iface, str); - if(offset+nLengthP < nLength) - memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR)); - - sNewString[nLengthP + nLength] = 0; - - str = xmlChar_from_wchar(sNewString); - if(str) - { - xmlNodeSetContent(This->node.node, str); - hr = S_OK; - } - heap_free(str); - - SysFreeString(sNewString); - } - - SysFreeString(sContent); - - xmlFree(pXmlContent); + SysFreeString(str); + SysFreeString(data); } return hr; @@ -684,11 +659,12 @@ static HRESULT WINAPI domcdata_deleteData( IXMLDOMCDATASection *iface, LONG offset, LONG count) { + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); HRESULT hr; LONG len = -1; BSTR str; - TRACE("%p %d %d\n", iface, offset, count); + TRACE("(%p)->(%d %d)\n", This, offset, count); hr = IXMLDOMCDATASection_get_length(iface, &len); if(hr != S_OK) return hr; @@ -731,15 +707,25 @@ static HRESULT WINAPI domcdata_replaceData( IXMLDOMCDATASection *iface, LONG offset, LONG count, BSTR p) { - FIXME("\n"); - return E_NOTIMPL; + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + HRESULT hr; + + TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p)); + + hr = IXMLDOMCDATASection_deleteData(iface, offset, count); + + if (hr == S_OK) + hr = IXMLDOMCDATASection_insertData(iface, offset, p); + + return hr; } static HRESULT WINAPI domcdata_splitText( IXMLDOMCDATASection *iface, LONG offset, IXMLDOMText **txtNode) { - FIXME("\n"); + domcdata *This = impl_from_IXMLDOMCDATASection( iface ); + FIXME("(%p)->(%d %p)\n", This, offset, txtNode); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/comment.c b/reactos/dll/win32/msxml3/comment.c index 1e3b965e84a..e74de07e876 100644 --- a/reactos/dll/win32/msxml3/comment.c +++ b/reactos/dll/win32/msxml3/comment.c @@ -55,7 +55,7 @@ static HRESULT WINAPI domcomment_QueryInterface( void** ppvObject ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || @@ -474,9 +474,11 @@ static HRESULT WINAPI domcomment_get_data( BSTR *p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - HRESULT hr = E_FAIL; + HRESULT hr; VARIANT vRet; + TRACE("(%p)->(%p)\n", This, p); + if(!p) return E_INVALIDARG; @@ -494,17 +496,14 @@ static HRESULT WINAPI domcomment_put_data( BSTR data) { domcomment *This = impl_from_IXMLDOMComment( iface ); - HRESULT hr = E_FAIL; VARIANT val; - TRACE("%p %s\n", This, debugstr_w(data) ); + TRACE("(%p)->(%s)\n", This, debugstr_w(data) ); V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); - - return hr; + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); } static HRESULT WINAPI domcomment_get_length( @@ -512,24 +511,22 @@ static HRESULT WINAPI domcomment_get_length( LONG *len) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlChar *pContent; - LONG nLength = 0; + HRESULT hr; + BSTR data; - TRACE("%p\n", iface); + TRACE("(%p)->(%p)\n", This, len); if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMComment_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); - xmlFree(pContent); + *len = SysStringLen(data); + SysFreeString(data); } - *len = nLength; - - return S_OK; + return hr; } static HRESULT WINAPI domcomment_substringData( @@ -537,11 +534,10 @@ static HRESULT WINAPI domcomment_substringData( LONG offset, LONG count, BSTR *p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlChar *pContent; - LONG nLength = 0; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; - TRACE("%p %d %d %p\n", iface, offset, count, p); + TRACE("(%p)->(%d %d %p)\n", This, offset, count, p); if(!p) return E_INVALIDARG; @@ -553,24 +549,22 @@ static HRESULT WINAPI domcomment_substringData( if(count == 0) return S_FALSE; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMComment_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); + LONG len = SysStringLen(data); - if( offset < nLength) + if(offset < len) { - BSTR sContent = bstr_from_xmlChar(pContent); - if(offset + count > nLength) - *p = SysAllocString(&sContent[offset]); + if(offset + count > len) + *p = SysAllocString(&data[offset]); else - *p = SysAllocStringLen(&sContent[offset], count); - - SysFreeString(sContent); - hr = S_OK; + *p = SysAllocStringLen(&data[offset], count); } + else + hr = S_FALSE; - xmlFree(pContent); + SysFreeString(data); } return hr; @@ -581,40 +575,30 @@ static HRESULT WINAPI domcomment_appendData( BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlChar *pContent; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p\n", iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(p)); /* Nothing to do if NULL or an Empty string passed in. */ - if(p == NULL || SysStringLen(p) == 0) - return S_OK; + if((p_len = SysStringLen(p)) == 0) return S_OK; - pContent = xmlChar_from_wchar( p ); - if(pContent) + hr = IXMLDOMComment_get_data(iface, &data); + if(hr == S_OK) { - /* Older versions of libxml < 2.6.27 didn't correctly support - xmlTextConcat on Comment nodes. Fallback to setting the - contents directly if xmlTextConcat fails. - */ - if(xmlTextConcat(This->node.node, pContent, SysStringLen(p) ) == 0) - hr = S_OK; - else - { - xmlChar *pNew; - pNew = xmlStrcat(xmlNodeGetContent(This->node.node), pContent); - if(pNew) - { - xmlNodeSetContent(This->node.node, pNew); - hr = S_OK; - } - else - hr = E_FAIL; - } - HeapFree( GetProcessHeap(), 0, pContent ); + LONG len = SysStringLen(data); + BSTR str = SysAllocStringLen(NULL, p_len + len); + + memcpy(str, data, len*sizeof(WCHAR)); + memcpy(&str[len], p, p_len*sizeof(WCHAR)); + str[len+p_len] = 0; + + hr = IXMLDOMComment_put_data(iface, str); + + SysFreeString(str); + SysFreeString(data); } - else - hr = E_FAIL; return hr; } @@ -624,16 +608,14 @@ static HRESULT WINAPI domcomment_insertData( LONG offset, BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlChar *pXmlContent; - BSTR sNewString; - HRESULT hr = S_FALSE; - LONG nLength = 0, nLengthP = 0; - xmlChar *str = NULL; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p %d %p\n", iface, offset, p); + TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p)); /* If have a NULL or empty string, don't do anything. */ - if(SysStringLen(p) == 0) + if((p_len = SysStringLen(p)) == 0) return S_OK; if(offset < 0) @@ -641,48 +623,29 @@ static HRESULT WINAPI domcomment_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(This->node.node); - if(pXmlContent) + hr = IXMLDOMComment_get_data(iface, &data); + if(hr == S_OK) { - BSTR sContent = bstr_from_xmlChar( pXmlContent ); - nLength = SysStringLen(sContent); - nLengthP = SysStringLen(p); + LONG len = SysStringLen(data); + BSTR str; - if(nLength < offset) + if(len < offset) { - SysFreeString(sContent); - xmlFree(pXmlContent); - + SysFreeString(data); return E_INVALIDARG; } - sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1); - if(sNewString) - { - if(offset > 0) - memcpy(sNewString, sContent, offset * sizeof(WCHAR)); + str = SysAllocStringLen(NULL, len + p_len); + /* start part, supplied string and end part */ + memcpy(str, data, offset*sizeof(WCHAR)); + memcpy(&str[offset], p, p_len*sizeof(WCHAR)); + memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR)); + str[len+p_len] = 0; - memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR)); + hr = IXMLDOMComment_put_data(iface, str); - if(offset+nLengthP < nLength) - memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR)); - - sNewString[nLengthP + nLength] = 0; - - str = xmlChar_from_wchar(sNewString); - if(str) - { - xmlNodeSetContent(This->node.node, str); - hr = S_OK; - } - HeapFree( GetProcessHeap(), 0, str ); - - SysFreeString(sNewString); - } - - SysFreeString(sContent); - - xmlFree(pXmlContent); + SysFreeString(str); + SysFreeString(data); } return hr; @@ -696,7 +659,7 @@ static HRESULT WINAPI domcomment_deleteData( LONG len = -1; BSTR str; - TRACE("%p %d %d\n", iface, offset, count); + TRACE("(%p)->(%d %d)\n", iface, offset, count); hr = IXMLDOMComment_get_length(iface, &len); if(hr != S_OK) return hr; @@ -739,8 +702,17 @@ static HRESULT WINAPI domcomment_replaceData( IXMLDOMComment *iface, LONG offset, LONG count, BSTR p) { - FIXME("\n"); - return E_NOTIMPL; + domcomment *This = impl_from_IXMLDOMComment( iface ); + HRESULT hr; + + TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p)); + + hr = IXMLDOMComment_deleteData(iface, offset, count); + + if (hr == S_OK) + hr = IXMLDOMComment_insertData(iface, offset, p); + + return hr; } static const struct IXMLDOMCommentVtbl domcomment_vtbl = diff --git a/reactos/dll/win32/msxml3/docfrag.c b/reactos/dll/win32/msxml3/docfrag.c index b5f6e464799..fff3f62a419 100644 --- a/reactos/dll/win32/msxml3/docfrag.c +++ b/reactos/dll/win32/msxml3/docfrag.c @@ -55,7 +55,7 @@ static HRESULT WINAPI domfrag_QueryInterface( void** ppvObject ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentFragment ) || IsEqualGUID( riid, &IID_IDispatch ) || diff --git a/reactos/dll/win32/msxml3/domdoc.c b/reactos/dll/win32/msxml3/domdoc.c index 4914a7c0064..41c1f417642 100644 --- a/reactos/dll/win32/msxml3/domdoc.c +++ b/reactos/dll/win32/msxml3/domdoc.c @@ -47,6 +47,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); #ifdef HAVE_LIBXML2 +#include + +/* not defined in older versions */ +#define XML_SAVE_FORMAT 1 +#define XML_SAVE_NO_DECL 2 +#define XML_SAVE_NO_EMPTY 4 +#define XML_SAVE_NO_XHTML 8 +#define XML_SAVE_XHTML 16 +#define XML_SAVE_AS_XML 32 +#define XML_SAVE_AS_HTML 64 + static const WCHAR SZ_PROPERTY_SELECTION_LANGUAGE[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0}; static const WCHAR SZ_VALUE_XPATH[] = {'X','P','a','t','h',0}; static const WCHAR SZ_VALUE_XSLPATTERN[] = {'X','S','L','P','a','t','t','e','r','n',0}; @@ -290,7 +301,7 @@ static HRESULT WINAPI xmldoc_IPersistStream_IsDirty( { domdoc *This = impl_from_IPersistStream(iface); - FIXME("(%p->%p): stub!\n", iface, This); + FIXME("(%p): stub!\n", This); return S_FALSE; } @@ -306,7 +317,7 @@ static HRESULT WINAPI xmldoc_IPersistStream_Load( char *ptr; xmlDocPtr xmldoc = NULL; - TRACE("(%p, %p)\n", iface, pStm); + TRACE("(%p)->(%p)\n", This, pStm); if (!pStm) return E_INVALIDARG; @@ -355,7 +366,7 @@ static HRESULT WINAPI xmldoc_IPersistStream_Save( HRESULT hr; BSTR xmlString; - TRACE("(%p, %p, %d)\n", iface, pStm, fClearDirty); + TRACE("(%p)->(%p %d)\n", This, pStm, fClearDirty); hr = IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), &xmlString ); if(hr == S_OK) @@ -376,7 +387,8 @@ static HRESULT WINAPI xmldoc_IPersistStream_Save( static HRESULT WINAPI xmldoc_IPersistStream_GetSizeMax( IPersistStream *iface, ULARGE_INTEGER *pcbSize) { - TRACE("(%p, %p): stub!\n", iface, pcbSize); + domdoc *This = impl_from_IPersistStream(iface); + TRACE("(%p)->(%p): stub!\n", This, pcbSize); return E_NOTIMPL; } @@ -436,7 +448,7 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID rii { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid( riid ), ppvObject ); *ppvObject = NULL; @@ -459,6 +471,10 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID rii { *ppvObject = &(This->lpvtblIObjectWithSite); } + else if (IsEqualGUID(&IID_IObjectSafety, riid)) + { + *ppvObject = &(This->lpvtblIObjectSafety); + } else if( IsEqualGUID( riid, &IID_ISupportErrorInfo )) { *ppvObject = &This->lpvtblISupportErrorInfo; @@ -940,7 +956,8 @@ static HRESULT WINAPI domdoc_get_doctype( IXMLDOMDocument2 *iface, IXMLDOMDocumentType** documentType ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2(iface); + FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -949,6 +966,10 @@ static HRESULT WINAPI domdoc_get_implementation( IXMLDOMDocument2 *iface, IXMLDOMImplementation** impl ) { + domdoc *This = impl_from_IXMLDOMDocument2(iface); + + TRACE("(%p)->(%p)\n", This, impl); + if(!impl) return E_INVALIDARG; @@ -967,7 +988,7 @@ static HRESULT WINAPI domdoc_get_documentElement( IXMLDOMNode *element_node; HRESULT hr; - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, DOMElement); if(!DOMElement) return E_INVALIDARG; @@ -1027,52 +1048,55 @@ static HRESULT WINAPI domdoc_createElement( BSTR tagname, IXMLDOMElement** element ) { - xmlNodePtr xmlnode; domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlChar *xml_name; - IUnknown *elem_unk; + IXMLDOMNode *node; + VARIANT type; HRESULT hr; - TRACE("%p->(%s,%p)\n", iface, debugstr_w(tagname), element); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(tagname), element); - xml_name = xmlChar_from_wchar(tagname); - xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL); - xmldoc_add_orphan(xmlnode->doc, xmlnode); + if (!element || !tagname) return E_INVALIDARG; - TRACE("created xmlptr %p\n", xmlnode); - elem_unk = create_element(xmlnode); - heap_free(xml_name); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_ELEMENT; + + hr = IXMLDOMDocument_createNode(iface, type, tagname, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMElement, (void**)element); + IXMLDOMNode_Release(node); + } - hr = IUnknown_QueryInterface(elem_unk, &IID_IXMLDOMElement, (void **)element); - IUnknown_Release(elem_unk); - TRACE("returning %p\n", *element); return hr; } static HRESULT WINAPI domdoc_createDocumentFragment( IXMLDOMDocument2 *iface, - IXMLDOMDocumentFragment** docFrag ) + IXMLDOMDocumentFragment** frag ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlNodePtr xmlnode; + IXMLDOMNode *node; + VARIANT type; + HRESULT hr; - TRACE("%p\n", iface); + TRACE("(%p)->(%p)\n", This, frag); - if(!docFrag) - return E_INVALIDARG; + if (!frag) return E_INVALIDARG; - *docFrag = NULL; + *frag = NULL; - xmlnode = xmlNewDocFragment(get_doc( This ) ); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_DOCUMENT_FRAGMENT; - if(!xmlnode) - return E_FAIL; + hr = IXMLDOMDocument_createNode(iface, type, NULL, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMDocumentFragment, (void**)frag); + IXMLDOMNode_Release(node); + } - xmldoc_add_orphan(xmlnode->doc, xmlnode); - *docFrag = (IXMLDOMDocumentFragment*)create_doc_fragment(xmlnode); - - return S_OK; + return hr; } @@ -1082,29 +1106,28 @@ static HRESULT WINAPI domdoc_createTextNode( IXMLDOMText** text ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlNodePtr xmlnode; - xmlChar *xml_content; + IXMLDOMNode *node; + VARIANT type; + HRESULT hr; - TRACE("%p->(%s %p)\n", iface, debugstr_w(data), text); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), text); - if(!text) - return E_INVALIDARG; + if (!text) return E_INVALIDARG; *text = NULL; - xml_content = xmlChar_from_wchar(data); - xmlnode = xmlNewText(xml_content); - heap_free(xml_content); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_TEXT; - if(!xmlnode) - return E_FAIL; + hr = IXMLDOMDocument2_createNode(iface, type, NULL, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)text); + IXMLDOMNode_Release(node); + hr = IXMLDOMText_put_data(*text, data); + } - xmlnode->doc = get_doc( This ); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - - *text = (IXMLDOMText*)create_text(xmlnode); - - return S_OK; + return hr; } @@ -1114,29 +1137,28 @@ static HRESULT WINAPI domdoc_createComment( IXMLDOMComment** comment ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlNodePtr xmlnode; - xmlChar *xml_content; + VARIANT type; + HRESULT hr; + IXMLDOMNode *node; - TRACE("%p->(%s %p)\n", iface, debugstr_w(data), comment); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), comment); - if(!comment) - return E_INVALIDARG; + if (!comment) return E_INVALIDARG; *comment = NULL; - xml_content = xmlChar_from_wchar(data); - xmlnode = xmlNewComment(xml_content); - heap_free(xml_content); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_COMMENT; - if(!xmlnode) - return E_FAIL; + hr = IXMLDOMDocument2_createNode(iface, type, NULL, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)comment); + IXMLDOMNode_Release(node); + hr = IXMLDOMComment_put_data(*comment, data); + } - xmlnode->doc = get_doc( This ); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - - *comment = (IXMLDOMComment*)create_comment(xmlnode); - - return S_OK; + return hr; } @@ -1146,29 +1168,28 @@ static HRESULT WINAPI domdoc_createCDATASection( IXMLDOMCDATASection** cdata ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlNodePtr xmlnode; - xmlChar *xml_content; + IXMLDOMNode *node; + VARIANT type; + HRESULT hr; - TRACE("%p->(%s %p)\n", iface, debugstr_w(data), cdata); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), cdata); - if(!cdata) - return E_INVALIDARG; + if (!cdata) return E_INVALIDARG; *cdata = NULL; - xml_content = xmlChar_from_wchar(data); - xmlnode = xmlNewCDataBlock(get_doc( This ), xml_content, strlen( (char*)xml_content) ); - heap_free(xml_content); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_CDATA_SECTION; - if(!xmlnode) - return E_FAIL; + hr = IXMLDOMDocument2_createNode(iface, type, NULL, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)cdata); + IXMLDOMNode_Release(node); + hr = IXMLDOMCDATASection_put_data(*cdata, data); + } - xmlnode->doc = get_doc( This ); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - - *cdata = (IXMLDOMCDATASection*)create_cdata(xmlnode); - - return S_OK; + return hr; } @@ -1178,35 +1199,36 @@ static HRESULT WINAPI domdoc_createProcessingInstruction( BSTR data, IXMLDOMProcessingInstruction** pi ) { -#ifdef HAVE_XMLNEWDOCPI - xmlNodePtr xmlnode; domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlChar *xml_target, *xml_content; + IXMLDOMNode *node; + VARIANT type; + HRESULT hr; - TRACE("%p->(%s %s %p)\n", iface, debugstr_w(target), debugstr_w(data), pi); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), pi); - if(!pi) - return E_INVALIDARG; + if (!pi) return E_INVALIDARG; - if(!target || lstrlenW(target) == 0) - return E_FAIL; + *pi = NULL; - xml_target = xmlChar_from_wchar(target); - xml_content = xmlChar_from_wchar(data); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_PROCESSING_INSTRUCTION; - xmlnode = xmlNewDocPI(get_doc(This), xml_target, xml_content); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - TRACE("created xmlptr %p\n", xmlnode); - *pi = (IXMLDOMProcessingInstruction*)create_pi(xmlnode); + hr = IXMLDOMDocument2_createNode(iface, type, target, NULL, &node); + if (hr == S_OK) + { + VARIANT v_data; - heap_free(xml_content); - heap_free(xml_target); + /* this is to bypass check in ::put_data() that blocks "(%s %p)\n", iface, debugstr_w(name), attribute); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), attribute); - if(!attribute) - return E_INVALIDARG; + if (!attribute || !name) return E_INVALIDARG; - *attribute = NULL; + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_ATTRIBUTE; - xml_name = xmlChar_from_wchar(name); - xmlnode = (xmlNode *)xmlNewProp(NULL, xml_name, NULL); - heap_free(xml_name); + hr = IXMLDOMDocument_createNode(iface, type, name, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMAttribute, (void**)attribute); + IXMLDOMNode_Release(node); + } - if(!xmlnode) - return E_FAIL; - - xmlnode->doc = get_doc( This ); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - - *attribute = (IXMLDOMAttribute*)create_attribute(xmlnode); - - return S_OK; + return hr; } static HRESULT WINAPI domdoc_createEntityReference( IXMLDOMDocument2 *iface, BSTR name, - IXMLDOMEntityReference** entityRef ) + IXMLDOMEntityReference** entityref ) { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - xmlNodePtr xmlnode; - xmlChar *xml_name; + IXMLDOMNode *node; + VARIANT type; + HRESULT hr; - TRACE("%p\n", iface); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), entityref); - if(!entityRef) - return E_INVALIDARG; + if (!entityref) return E_INVALIDARG; - *entityRef = NULL; + *entityref = NULL; - xml_name = xmlChar_from_wchar(name); - xmlnode = xmlNewReference(get_doc( This ), xml_name ); - heap_free(xml_name); + V_VT(&type) = VT_I1; + V_I1(&type) = NODE_ENTITY_REFERENCE; - if(!xmlnode) - return E_FAIL; + hr = IXMLDOMDocument2_createNode(iface, type, name, NULL, &node); + if (hr == S_OK) + { + IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMEntityReference, (void**)entityref); + IXMLDOMNode_Release(node); + } - xmlnode->doc = get_doc( This ); - xmldoc_add_orphan(xmlnode->doc, xmlnode); - - *entityRef = (IXMLDOMEntityReference*)create_doc_entity_ref(xmlnode); - - return S_OK; + return hr; } @@ -1284,7 +1300,7 @@ static HRESULT WINAPI domdoc_getElementsByTagName( domdoc *This = impl_from_IXMLDOMDocument2( iface ); LPWSTR szPattern; HRESULT hr; - TRACE("(%p)->(%s, %p)\n", This, debugstr_w(tagName), resultList); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(tagName), resultList); if (tagName[0] == '*' && tagName[1] == 0) { @@ -1329,51 +1345,86 @@ static HRESULT WINAPI domdoc_createNode( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); DOMNodeType node_type; - xmlNodePtr xmlnode = NULL; + xmlNodePtr xmlnode; xmlChar *xml_name; HRESULT hr; - TRACE("(%p)->(type,%s,%s,%p)\n", This, debugstr_w(name), debugstr_w(namespaceURI), node); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(name), debugstr_w(namespaceURI), node); + + if(!node) return E_INVALIDARG; if(namespaceURI && namespaceURI[0]) FIXME("nodes with namespaces currently not supported.\n"); hr = get_node_type(Type, &node_type); - if(FAILED(hr)) - return hr; + if(FAILED(hr)) return hr; TRACE("node_type %d\n", node_type); + /* exit earlier for types that need name */ + switch(node_type) + { + case NODE_ELEMENT: + case NODE_ATTRIBUTE: + case NODE_ENTITY_REFERENCE: + case NODE_PROCESSING_INSTRUCTION: + if (!name || SysStringLen(name) == 0) return E_FAIL; + default: + break; + } + xml_name = xmlChar_from_wchar(name); switch(node_type) { case NODE_ELEMENT: xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL); - *node = create_node(xmlnode); - TRACE("created %p\n", xmlnode); break; case NODE_ATTRIBUTE: - xmlnode = (xmlNode *)xmlNewProp(NULL, xml_name, NULL); - if(xmlnode) - { - xmlnode->doc = get_doc( This ); - - *node = (IXMLDOMNode*)create_attribute(xmlnode); - } - - TRACE("created %p\n", xmlnode); + xmlnode = (xmlNodePtr)xmlNewDocProp(get_doc(This), xml_name, NULL); break; - + case NODE_TEXT: + xmlnode = (xmlNodePtr)xmlNewDocText(get_doc(This), NULL); + break; + case NODE_CDATA_SECTION: + xmlnode = xmlNewCDataBlock(get_doc(This), NULL, 0); + break; + case NODE_ENTITY_REFERENCE: + xmlnode = xmlNewReference(get_doc(This), xml_name); + break; + case NODE_PROCESSING_INSTRUCTION: +#ifdef HAVE_XMLNEWDOCPI + xmlnode = xmlNewDocPI(get_doc(This), xml_name, NULL); +#else + FIXME("xmlNewDocPI() not supported, use libxml2 2.6.15 or greater\n"); + xmlnode = NULL; +#endif + break; + case NODE_COMMENT: + xmlnode = xmlNewDocComment(get_doc(This), NULL); + break; + case NODE_DOCUMENT_FRAGMENT: + xmlnode = xmlNewDocFragment(get_doc(This)); + break; + /* unsupported types */ + case NODE_DOCUMENT: + case NODE_DOCUMENT_TYPE: + case NODE_ENTITY: + case NODE_NOTATION: + heap_free(xml_name); + return E_INVALIDARG; default: FIXME("unhandled node type %d\n", node_type); + xmlnode = NULL; break; } + *node = create_node(xmlnode); heap_free(xml_name); - if(xmlnode && *node) + if(*node) { + TRACE("created node (%d, %p, %p)\n", node_type, *node, xmlnode); xmldoc_add_orphan(xmlnode->doc, xmlnode); return S_OK; } @@ -1386,7 +1437,8 @@ static HRESULT WINAPI domdoc_nodeFromID( BSTR idString, IXMLDOMNode** node ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(idString), node); return E_NOTIMPL; } @@ -1432,7 +1484,7 @@ static HRESULT WINAPI domdoc_load( IStream *pStream = NULL; xmlDocPtr xmldoc; - TRACE("type %d\n", V_VT(&xmlSource) ); + TRACE("(%p)->type %d\n", This, V_VT(&xmlSource) ); *isSuccessful = VARIANT_FALSE; @@ -1528,7 +1580,8 @@ static HRESULT WINAPI domdoc_get_readyState( IXMLDOMDocument2 *iface, LONG *value ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2(iface); + FIXME("(%p)->(%p)\n", This, value); return E_NOTIMPL; } @@ -1556,7 +1609,8 @@ static HRESULT WINAPI domdoc_get_url( IXMLDOMDocument2 *iface, BSTR* urlString ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2(iface); + FIXME("(%p)->(%p)\n", This, urlString); return E_NOTIMPL; } @@ -1567,7 +1621,7 @@ static HRESULT WINAPI domdoc_get_async( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%p <- %d\n", isAsync, This->async); + TRACE("(%p)->(%p: %d)\n", This, isAsync, This->async); *isAsync = This->async; return S_OK; } @@ -1579,7 +1633,7 @@ static HRESULT WINAPI domdoc_put_async( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%d\n", isAsync); + TRACE("(%p)->(%d)\n", This, isAsync); This->async = isAsync; return S_OK; } @@ -1588,7 +1642,8 @@ static HRESULT WINAPI domdoc_put_async( static HRESULT WINAPI domdoc_abort( IXMLDOMDocument2 *iface ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2(iface); + FIXME("%p\n", This); return E_NOTIMPL; } @@ -1619,7 +1674,7 @@ static HRESULT WINAPI domdoc_loadXML( int len; HRESULT hr = S_FALSE, hr2; - TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful ); + TRACE("(%p)->(%s %p)\n", This, debugstr_w( bstrXML ), isSuccessful ); assert ( &This->node ); @@ -1651,6 +1706,24 @@ static HRESULT WINAPI domdoc_loadXML( return hr; } +static int XMLCALL domdoc_save_writecallback(void *ctx, const char *buffer, + int len) +{ + DWORD written = -1; + + if(!WriteFile(ctx, buffer, len, &written, NULL)) + { + WARN("write error\n"); + return -1; + } + else + return written; +} + +static int XMLCALL domdoc_save_closecallback(void *ctx) +{ + return CloseHandle(ctx) ? 0 : -1; +} static HRESULT WINAPI domdoc_save( IXMLDOMDocument2 *iface, @@ -1658,10 +1731,8 @@ static HRESULT WINAPI domdoc_save( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); HANDLE handle; - xmlChar *mem, *p; - int size; + xmlSaveCtxtPtr ctx; HRESULT ret = S_OK; - DWORD written; TRACE("(%p)->(var(vt %d, %s))\n", This, V_VT(&destination), V_VT(&destination) == VT_BSTR ? debugstr_w(V_BSTR(&destination)) : NULL); @@ -1707,31 +1778,19 @@ static HRESULT WINAPI domdoc_save( return S_FALSE; } - xmlDocDumpMemory(get_doc(This), &mem, &size); - - /* - * libxml2 always adds XML declaration on top of the file and one for each processing instruction node in DOM tree. - * MSXML adds XML declaration only for processing instruction nodes. - * We skip the first XML declaration generated by libxml2 to get exactly what we need. - */ - p = mem; - if(size > 2 && p[0] == '<' && p[1] == '?') { - while(p < mem+size && (p[0] != '?' || p[1] != '>')) - p++; - p += 2; - while(p < mem+size && isspace(*p)) - p++; - size -= p-mem; - } - - if(!WriteFile(handle, p, (DWORD)size, &written, NULL) || written != (DWORD)size) + /* disable top XML declaration */ + ctx = xmlSaveToIO(domdoc_save_writecallback, domdoc_save_closecallback, + handle, NULL, XML_SAVE_NO_DECL); + if (!ctx) { - WARN("write error\n"); - ret = S_FALSE; + CloseHandle(handle); + return S_FALSE; } - xmlFree(mem); - CloseHandle(handle); + if (xmlSaveDoc(ctx, get_doc(This)) == -1) ret = S_FALSE; + /* will close file through close callback */ + xmlSaveClose(ctx); + return ret; } @@ -1741,7 +1800,7 @@ static HRESULT WINAPI domdoc_get_validateOnParse( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%p <- %d\n", isValidating, This->validating); + TRACE("(%p)->(%p: %d)\n", This, isValidating, This->validating); *isValidating = This->validating; return S_OK; } @@ -1753,7 +1812,7 @@ static HRESULT WINAPI domdoc_put_validateOnParse( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%d\n", isValidating); + TRACE("(%p)->(%d)\n", This, isValidating); This->validating = isValidating; return S_OK; } @@ -1765,7 +1824,7 @@ static HRESULT WINAPI domdoc_get_resolveExternals( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%p <- %d\n", isResolving, This->resolving); + TRACE("(%p)->(%p: %d)\n", This, isResolving, This->resolving); *isResolving = This->resolving; return S_OK; } @@ -1777,7 +1836,7 @@ static HRESULT WINAPI domdoc_put_resolveExternals( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%d\n", isResolving); + TRACE("(%p)->(%d)\n", This, isResolving); This->resolving = isResolving; return S_OK; } @@ -1789,7 +1848,7 @@ static HRESULT WINAPI domdoc_get_preserveWhiteSpace( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%p <- %d\n", isPreserving, This->preserving); + TRACE("(%p)->(%p: %d)\n", This, isPreserving, This->preserving); *isPreserving = This->preserving; return S_OK; } @@ -1801,7 +1860,7 @@ static HRESULT WINAPI domdoc_put_preserveWhiteSpace( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); - TRACE("%d\n", isPreserving); + TRACE("(%p)->(%d)\n", This, isPreserving); This->preserving = isPreserving; return S_OK; } @@ -1811,7 +1870,8 @@ static HRESULT WINAPI domdoc_put_onReadyStateChange( IXMLDOMDocument2 *iface, VARIANT readyStateChangeSink ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + FIXME("%p\n", This); return E_NOTIMPL; } @@ -1820,7 +1880,8 @@ static HRESULT WINAPI domdoc_put_onDataAvailable( IXMLDOMDocument2 *iface, VARIANT onDataAvailableSink ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + FIXME("%p\n", This); return E_NOTIMPL; } @@ -1828,7 +1889,8 @@ static HRESULT WINAPI domdoc_put_onTransformNode( IXMLDOMDocument2 *iface, VARIANT onTransformNodeSink ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + FIXME("%p\n", This); return E_NOTIMPL; } @@ -1836,7 +1898,8 @@ static HRESULT WINAPI domdoc_get_namespaces( IXMLDOMDocument2* iface, IXMLDOMSchemaCollection** schemaCollection ) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + FIXME("(%p)->(%p)\n", This, schemaCollection); return E_NOTIMPL; } @@ -1903,7 +1966,8 @@ static HRESULT WINAPI domdoc_validate( IXMLDOMDocument2* iface, IXMLDOMParseError** err) { - FIXME("\n"); + domdoc *This = impl_from_IXMLDOMDocument2( iface ); + FIXME("(%p)->(%p)\n", This, err); return E_NOTIMPL; } @@ -1914,6 +1978,8 @@ static HRESULT WINAPI domdoc_setProperty( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); + TRACE("(%p)->(%s)\n", This, debugstr_w(p)); + if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0) { VARIANT varStr; @@ -1953,6 +2019,8 @@ static HRESULT WINAPI domdoc_getProperty( { domdoc *This = impl_from_IXMLDOMDocument2( iface ); + TRACE("(%p)->(%p)\n", This, debugstr_w(p)); + if (var == NULL) return E_INVALIDARG; if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0) @@ -2082,7 +2150,7 @@ xmldoc_GetSite( IObjectWithSite *iface, REFIID iid, void ** ppvSite ) { domdoc *This = impl_from_IObjectWithSite(iface); - TRACE("%p %s %p\n", This, debugstr_guid( iid ), ppvSite ); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid( iid ), ppvSite ); if ( !This->site ) return E_FAIL; @@ -2095,7 +2163,7 @@ xmldoc_SetSite( IObjectWithSite *iface, IUnknown *punk ) { domdoc *This = impl_from_IObjectWithSite(iface); - TRACE("%p %p\n", iface, punk); + TRACE("(%p)->(%p)\n", iface, punk); if(!punk) { @@ -2146,7 +2214,7 @@ static ULONG WINAPI xmldoc_Safety_Release(IObjectSafety *iface) return IXMLDocument_Release((IXMLDocument *)This); } -#define SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_SECURITY_MANAGER) +#define SAFETY_SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA) static HRESULT WINAPI xmldoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) @@ -2158,7 +2226,7 @@ static HRESULT WINAPI xmldoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *ifa if(!pdwSupportedOptions || !pdwEnabledOptions) return E_POINTER; - *pdwSupportedOptions = SUPPORTED_OPTIONS; + *pdwSupportedOptions = SAFETY_SUPPORTED_OPTIONS; *pdwEnabledOptions = This->safeopt; return S_OK; @@ -2168,13 +2236,9 @@ static HRESULT WINAPI xmldoc_Safety_SetInterfaceSafetyOptions(IObjectSafety *ifa DWORD dwOptionSetMask, DWORD dwEnabledOptions) { domdoc *This = impl_from_IObjectSafety(iface); - TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions); - if(dwOptionSetMask & ~SUPPORTED_OPTIONS) - return E_FAIL; - - This->safeopt = dwEnabledOptions & dwEnabledOptions; + This->safeopt = dwEnabledOptions & dwOptionSetMask & SAFETY_SUPPORTED_OPTIONS; return S_OK; } diff --git a/reactos/dll/win32/msxml3/domimpl.c b/reactos/dll/win32/msxml3/domimpl.c index 1a07676e33f..dd518a1bc3b 100644 --- a/reactos/dll/win32/msxml3/domimpl.c +++ b/reactos/dll/win32/msxml3/domimpl.c @@ -54,7 +54,7 @@ static HRESULT WINAPI dimimpl_QueryInterface( void** ppvObject ) { domimpl *This = impl_from_IXMLDOMImplementation( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMImplementation ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -181,7 +181,7 @@ static HRESULT WINAPI dimimpl_hasFeature(IXMLDOMImplementation* This, BSTR featu BOOL bValidFeature = FALSE; BOOL bValidVersion = FALSE; - TRACE("feature(%s) version (%s)\n", debugstr_w(feature), debugstr_w(version)); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(feature), debugstr_w(version), hasFeature); if(!feature || !hasFeature) return E_INVALIDARG; diff --git a/reactos/dll/win32/msxml3/element.c b/reactos/dll/win32/msxml3/element.c index f7bd3b03e08..01547709b7b 100644 --- a/reactos/dll/win32/msxml3/element.c +++ b/reactos/dll/win32/msxml3/element.c @@ -62,7 +62,7 @@ static HRESULT WINAPI domelem_QueryInterface( { domelem *This = impl_from_IXMLDOMElement( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -493,7 +493,7 @@ static HRESULT WINAPI domelem_get_tagName( DWORD offset = 0; LPWSTR str; - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, p ); element = get_element( This ); if ( !element ) @@ -526,7 +526,7 @@ static HRESULT WINAPI domelem_getAttribute( xmlChar *xml_name, *xml_value = NULL; HRESULT hr = S_FALSE; - TRACE("(%p)->(%s,%p)\n", This, debugstr_w(name), value); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value); if(!value || !name) return E_INVALIDARG; @@ -567,7 +567,7 @@ static HRESULT WINAPI domelem_setAttribute( HRESULT hr; VARIANT var; - TRACE("(%p)->(%s, var)\n", This, debugstr_w(name)); + TRACE("(%p)->(%s var)\n", This, debugstr_w(name)); element = get_element( This ); if ( !element ) @@ -660,7 +660,8 @@ static HRESULT WINAPI domelem_setAttributeNode( IXMLDOMAttribute* domAttribute, IXMLDOMAttribute** attributeNode) { - FIXME("\n"); + domelem *This = impl_from_IXMLDOMElement( iface ); + FIXME("(%p)->(%p %p)\n", This, domAttribute, attributeNode); return E_NOTIMPL; } @@ -669,7 +670,8 @@ static HRESULT WINAPI domelem_removeAttributeNode( IXMLDOMAttribute* domAttribute, IXMLDOMAttribute** attributeNode) { - FIXME("\n"); + domelem *This = impl_from_IXMLDOMElement( iface ); + FIXME("(%p)->(%p %p)\n", This, domAttribute, attributeNode); return E_NOTIMPL; } @@ -684,7 +686,7 @@ static HRESULT WINAPI domelem_getElementsByTagName( xmlNodePtr element; HRESULT hr; - TRACE("(%p)->(%s,%p)\n", This, debugstr_w(bstrName), resultList); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrName), resultList); if (bstrName[0] == '*' && bstrName[1] == 0) { @@ -714,7 +716,8 @@ static HRESULT WINAPI domelem_getElementsByTagName( static HRESULT WINAPI domelem_normalize( IXMLDOMElement *iface ) { - FIXME("\n"); + domelem *This = impl_from_IXMLDOMElement( iface ); + FIXME("%p\n", This); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/entityref.c b/reactos/dll/win32/msxml3/entityref.c index 1489dbd0c57..db461934538 100644 --- a/reactos/dll/win32/msxml3/entityref.c +++ b/reactos/dll/win32/msxml3/entityref.c @@ -55,7 +55,7 @@ static HRESULT WINAPI entityref_QueryInterface( void** ppvObject ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMEntityReference ) || IsEqualGUID( riid, &IID_IDispatch ) || diff --git a/reactos/dll/win32/msxml3/factory.c b/reactos/dll/win32/msxml3/factory.c index 45ba3680c0f..af94d5cbcf1 100644 --- a/reactos/dll/win32/msxml3/factory.c +++ b/reactos/dll/win32/msxml3/factory.c @@ -167,7 +167,8 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) cf = (IClassFactory*) &domdoccf.lpVtbl; } else if( IsEqualCLSID( rclsid, &CLSID_SAXXMLReader) || - IsEqualCLSID( rclsid, &CLSID_SAXXMLReader30 )) + IsEqualCLSID( rclsid, &CLSID_SAXXMLReader30 ) || + IsEqualCLSID( rclsid, &CLSID_SAXXMLReader40 )) { cf = (IClassFactory*) &saxreadcf.lpVtbl; } diff --git a/reactos/dll/win32/msxml3/httprequest.c b/reactos/dll/win32/msxml3/httprequest.c index a477753a71a..458548406a0 100644 --- a/reactos/dll/win32/msxml3/httprequest.c +++ b/reactos/dll/win32/msxml3/httprequest.c @@ -50,7 +50,7 @@ static inline httprequest *impl_from_IXMLHTTPRequest( IXMLHTTPRequest *iface ) static HRESULT WINAPI httprequest_QueryInterface(IXMLHTTPRequest *iface, REFIID riid, void **ppvObject) { httprequest *This = impl_from_IXMLHTTPRequest( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLHTTPRequest) || IsEqualGUID( riid, &IID_IDispatch) || diff --git a/reactos/dll/win32/msxml3/msxml_private.h b/reactos/dll/win32/msxml3/msxml_private.h index e46642d84b6..1df3e8b6cd5 100644 --- a/reactos/dll/win32/msxml3/msxml_private.h +++ b/reactos/dll/win32/msxml3/msxml_private.h @@ -1,5 +1,5 @@ /* - * MSXML Class Factory + * Common definitions * * Copyright 2005 Mike McCormack * @@ -174,6 +174,8 @@ static inline BSTR bstr_from_xmlChar(const xmlChar *str) if(ret) MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len); } + else + ret = SysAllocStringLen(NULL, 0); return ret; } diff --git a/reactos/dll/win32/msxml3/node.c b/reactos/dll/win32/msxml3/node.c index 6729512d69e..ac97681aac9 100644 --- a/reactos/dll/win32/msxml3/node.c +++ b/reactos/dll/win32/msxml3/node.c @@ -87,7 +87,7 @@ static HRESULT WINAPI xmlnode_QueryInterface( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if(This->pUnkOuter) return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject); @@ -230,7 +230,7 @@ static HRESULT WINAPI xmlnode_get_nodeName( xmlnode *This = impl_from_IXMLDOMNode( iface ); const xmlChar *str; - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, name ); if (!name) return E_INVALIDARG; @@ -250,16 +250,16 @@ static HRESULT WINAPI xmlnode_get_nodeName( str = (const xmlChar*) "#document-fragment"; break; case XML_TEXT_NODE: - str = (const xmlChar*) "#text"; - break; + str = (const xmlChar*) "#text"; + break; case XML_DOCUMENT_NODE: - str = (const xmlChar*) "#document"; - break; - case XML_ATTRIBUTE_NODE: - case XML_ELEMENT_NODE: - case XML_PI_NODE: + str = (const xmlChar*) "#document"; + break; + case XML_ATTRIBUTE_NODE: + case XML_ELEMENT_NODE: + case XML_PI_NODE: str = This->node->name; - break; + break; default: FIXME("nodeName not mapped correctly (%d)\n", This->node->type); str = This->node->name; @@ -280,7 +280,7 @@ static HRESULT WINAPI xmlnode_get_nodeValue( xmlnode *This = impl_from_IXMLDOMNode( iface ); HRESULT r = S_FALSE; - TRACE("%p %p\n", This, value); + TRACE("(%p)->(%p)\n", This, value); if(!value) return E_INVALIDARG; @@ -327,23 +327,11 @@ static HRESULT WINAPI xmlnode_put_nodeValue( { xmlnode *This = impl_from_IXMLDOMNode( iface ); HRESULT hr; - xmlChar *str = NULL; - VARIANT string_value; TRACE("%p type(%d)\n", This, This->node->type); - VariantInit(&string_value); - hr = VariantChangeType(&string_value, &value, 0, VT_BSTR); - if(FAILED(hr)) - { - VariantClear(&string_value); - WARN("Couldn't convert to VT_BSTR\n"); - return hr; - } - - hr = S_FALSE; /* Document, Document Fragment, Document Type, Element, - Entity, Entity Reference, Notation aren't supported. */ + Entity, Entity Reference, Notation aren't supported. */ switch ( This->node->type ) { case XML_ATTRIBUTE_NODE: @@ -351,20 +339,33 @@ static HRESULT WINAPI xmlnode_put_nodeValue( case XML_COMMENT_NODE: case XML_PI_NODE: case XML_TEXT_NODE: - { + { + VARIANT string_value; + xmlChar *str; + + VariantInit(&string_value); + hr = VariantChangeType(&string_value, &value, 0, VT_BSTR); + if(FAILED(hr)) + { + VariantClear(&string_value); + WARN("Couldn't convert to VT_BSTR\n"); + return hr; + } + str = xmlChar_from_wchar(V_BSTR(&string_value)); + VariantClear(&string_value); + xmlNodeSetContent(This->node, str); heap_free(str); hr = S_OK; break; - } + } default: /* Do nothing for unsupported types. */ + hr = E_FAIL; break; } - VariantClear(&string_value); - return hr; } @@ -374,7 +375,7 @@ static HRESULT WINAPI xmlnode_get_nodeType( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p %p\n", This, type); + TRACE("(%p)->(%p)\n", This, type); assert( (int)NODE_ELEMENT == (int)XML_ELEMENT_NODE ); assert( (int)NODE_NOTATION == (int)XML_NOTATION_NODE ); @@ -390,7 +391,7 @@ static HRESULT get_node( xmlNodePtr node, IXMLDOMNode **out ) { - TRACE("%p->%s %p\n", This, name, node ); + TRACE("(%p)->(%s %p %p)\n", This, name, node, out ); if ( !out ) return E_INVALIDARG; @@ -419,7 +420,7 @@ static HRESULT WINAPI xmlnode_get_childNodes( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p %p\n", This, childList ); + TRACE("(%p)->(%p)\n", This, childList ); if ( !childList ) return E_INVALIDARG; @@ -445,7 +446,7 @@ static HRESULT WINAPI xmlnode_get_lastChild( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, lastChild ); if (!lastChild) return E_INVALIDARG; @@ -470,7 +471,7 @@ static HRESULT WINAPI xmlnode_get_previousSibling( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, previousSibling ); if (!previousSibling) return E_INVALIDARG; @@ -494,7 +495,7 @@ static HRESULT WINAPI xmlnode_get_nextSibling( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, nextSibling ); if (!nextSibling) return E_INVALIDARG; @@ -517,7 +518,7 @@ static HRESULT WINAPI xmlnode_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, attributeMap); if (!attributeMap) return E_INVALIDARG; @@ -553,7 +554,7 @@ static HRESULT WINAPI xmlnode_insertBefore( IXMLDOMNode *before = NULL, *new; HRESULT hr; - TRACE("(%p)->(%p,var,%p)\n",This,newChild,outNewChild); + TRACE("(%p)->(%p var %p)\n",This,newChild,outNewChild); if (!newChild) return E_INVALIDARG; @@ -620,7 +621,7 @@ static HRESULT WINAPI xmlnode_replaceChild( IXMLDOMNode *realOldChild; HRESULT hr; - TRACE("%p->(%p,%p,%p)\n",This,newChild,oldChild,outOldChild); + TRACE("(%p)->(%p %p %p)\n", This, newChild, oldChild, outOldChild); /* Do not believe any documentation telling that newChild == NULL means removal. It does certainly *not* apply to msxml3! */ @@ -684,7 +685,7 @@ static HRESULT WINAPI xmlnode_removeChild( HRESULT hr; IXMLDOMNode *child; - TRACE("%p->(%p, %p)\n", This, childNode, oldChild); + TRACE("(%p)->(%p %p)\n", This, childNode, oldChild); if(!childNode) return E_INVALIDARG; @@ -726,7 +727,7 @@ static HRESULT WINAPI xmlnode_appendChild( VARIANT var; HRESULT hr; - TRACE("(%p)->(%p,%p)\n", This, newChild, outNewChild); + TRACE("(%p)->(%p %p)\n", This, newChild, outNewChild); hr = IXMLDOMNode_get_nodeType(newChild, &type); if(FAILED(hr) || type == NODE_ATTRIBUTE) { @@ -744,7 +745,7 @@ static HRESULT WINAPI xmlnode_hasChildNodes( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, hasChild); if (!hasChild) return E_INVALIDARG; @@ -764,7 +765,7 @@ static HRESULT WINAPI xmlnode_get_ownerDocument( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p (%p)\n", This, DOMDocument); + TRACE("(%p)->(%p)\n", This, DOMDocument); return DOMDocument_create_from_xmldoc(This->node->doc, (IXMLDOMDocument2**)DOMDocument); } @@ -778,7 +779,7 @@ static HRESULT WINAPI xmlnode_cloneNode( xmlNodePtr pClone = NULL; IXMLDOMNode *pNode = NULL; - TRACE("%p (%d)\n", This, deep); + TRACE("(%p)->(%d %p)\n", This, deep, cloneRoot); if(!cloneRoot) return E_INVALIDARG; @@ -814,7 +815,7 @@ static HRESULT WINAPI xmlnode_get_nodeTypeString( xmlnode *This = impl_from_IXMLDOMNode( iface ); const xmlChar *str; - TRACE("%p\n", This ); + TRACE("(%p)->(%p)\n", This, xmlnodeType ); if (!xmlnodeType) return E_INVALIDARG; @@ -878,7 +879,7 @@ static HRESULT WINAPI xmlnode_get_text( BSTR str = NULL; xmlChar *pContent; - TRACE("%p type %d\n", This, This->node->type); + TRACE("(%p, type %d)->(%p)\n", This, This->node->type, text); if ( !text ) return E_INVALIDARG; @@ -906,7 +907,7 @@ static HRESULT WINAPI xmlnode_put_text( xmlnode *This = impl_from_IXMLDOMNode( iface ); xmlChar *str, *str2; - TRACE("%p\n", This); + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); switch(This->node->type) { @@ -932,7 +933,8 @@ static HRESULT WINAPI xmlnode_get_specified( IXMLDOMNode *iface, VARIANT_BOOL* isSpecified) { - FIXME("\n"); + xmlnode *This = impl_from_IXMLDOMNode( iface ); + FIXME("(%p)->(%p)\n", This, isSpecified); return E_NOTIMPL; } @@ -940,12 +942,11 @@ static HRESULT WINAPI xmlnode_get_definition( IXMLDOMNode *iface, IXMLDOMNode** definitionNode) { - FIXME("\n"); + xmlnode *This = impl_from_IXMLDOMNode( iface ); + FIXME("(%p)->(%p)\n", This, definitionNode); return E_NOTIMPL; } -static HRESULT WINAPI xmlnode_get_dataType(IXMLDOMNode*, VARIANT*); - static inline BYTE hex_to_byte(xmlChar c) { if(c <= '9') return c-'0'; @@ -1136,7 +1137,7 @@ static HRESULT WINAPI xmlnode_get_nodeTypedValue( xmlChar *content; HRESULT hres = S_FALSE; - TRACE("iface %p\n", iface); + TRACE("(%p)->(%p)\n", This, typedValue); if(!typedValue) return E_INVALIDARG; @@ -1146,10 +1147,10 @@ static HRESULT WINAPI xmlnode_get_nodeTypedValue( if(This->node->type == XML_ELEMENT_NODE || This->node->type == XML_TEXT_NODE || This->node->type == XML_ENTITY_REF_NODE) - hres = xmlnode_get_dataType(iface, &type); + hres = IXMLDOMNode_get_dataType(iface, &type); if(hres != S_OK && This->node->type != XML_ELEMENT_NODE) - return xmlnode_get_nodeValue(iface, typedValue); + return IXMLDOMNode_get_nodeValue(iface, typedValue); content = xmlNodeGetContent(This->node); hres = VARIANT_from_xmlChar(content, typedValue, @@ -1164,7 +1165,8 @@ static HRESULT WINAPI xmlnode_put_nodeTypedValue( IXMLDOMNode *iface, VARIANT typedValue) { - FIXME("\n"); + xmlnode *This = impl_from_IXMLDOMNode( iface ); + FIXME("%p\n", This); return E_NOTIMPL; } @@ -1175,7 +1177,7 @@ static HRESULT WINAPI xmlnode_get_dataType( xmlnode *This = impl_from_IXMLDOMNode( iface ); xmlChar *pVal; - TRACE("iface %p\n", iface); + TRACE("(%p)->(%p)\n", This, dataTypeName); if(!dataTypeName) return E_INVALIDARG; @@ -1220,7 +1222,7 @@ static HRESULT WINAPI xmlnode_put_dataType( xmlnode *This = impl_from_IXMLDOMNode( iface ); HRESULT hr = E_FAIL; - TRACE("iface %p\n", iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(dataTypeName)); if(dataTypeName == NULL) return E_INVALIDARG; @@ -1382,7 +1384,7 @@ static HRESULT WINAPI xmlnode_get_xml( xmlBufferPtr pXmlBuf; int nSize; - TRACE("iface %p %d\n", iface, This->node->type); + TRACE("(%p %d)->(%p)\n", This, This->node->type, xmlString); if(!xmlString) return E_INVALIDARG; @@ -1440,7 +1442,7 @@ static HRESULT WINAPI xmlnode_transformNode( xmlDocPtr result = NULL; IXMLDOMNode *ssNew; - TRACE("%p %p %p\n", This, styleSheet, xmlString); + TRACE("(%p)->(%p %p)\n", This, styleSheet, xmlString); if (!libxslt_handle) return E_NOTIMPL; @@ -1517,7 +1519,7 @@ static HRESULT WINAPI xmlnode_selectNodes( { xmlnode *This = impl_from_IXMLDOMNode( iface ); - TRACE("%p %s %p\n", This, debugstr_w(queryString), resultList ); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(queryString), resultList ); return queryresult_create( This->node, queryString, resultList ); } @@ -1531,7 +1533,7 @@ static HRESULT WINAPI xmlnode_selectSingleNode( IXMLDOMNodeList *list; HRESULT r; - TRACE("%p %s %p\n", This, debugstr_w(queryString), resultNode ); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(queryString), resultNode ); *resultNode = NULL; r = IXMLDOMNode_selectNodes(iface, queryString, &list); @@ -1547,7 +1549,8 @@ static HRESULT WINAPI xmlnode_get_parsed( IXMLDOMNode *iface, VARIANT_BOOL* isParsed) { - FIXME("\n"); + xmlnode *This = impl_from_IXMLDOMNode( iface ); + FIXME("(%p)->(%p)\n", This, isParsed); return E_NOTIMPL; } @@ -1559,7 +1562,7 @@ static HRESULT WINAPI xmlnode_get_namespaceURI( HRESULT hr = S_FALSE; xmlNsPtr *pNSList; - TRACE("%p %p\n", This, namespaceURI ); + TRACE("(%p)->(%p)\n", This, namespaceURI ); if(!namespaceURI) return E_INVALIDARG; @@ -1586,7 +1589,7 @@ static HRESULT WINAPI xmlnode_get_prefix( HRESULT hr = S_FALSE; xmlNsPtr *pNSList; - TRACE("%p %p\n", This, prefixString ); + TRACE("(%p)->(%p)\n", This, prefixString ); if(!prefixString) return E_INVALIDARG; @@ -1613,7 +1616,7 @@ static HRESULT WINAPI xmlnode_get_baseName( BSTR str = NULL; HRESULT r = S_FALSE; - TRACE("%p %p\n", This, nameString ); + TRACE("(%p)->(%p)\n", This, nameString ); if ( !nameString ) return E_INVALIDARG; @@ -1622,10 +1625,12 @@ static HRESULT WINAPI xmlnode_get_baseName( { case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: + case XML_PI_NODE: str = bstr_from_xmlChar( This->node->name ); r = S_OK; break; case XML_TEXT_NODE: + case XML_COMMENT_NODE: break; default: ERR("Unhandled type %d\n", This->node->type ); @@ -1643,7 +1648,8 @@ static HRESULT WINAPI xmlnode_transformNodeToObject( IXMLDOMNode* stylesheet, VARIANT outputObject) { - FIXME("\n"); + xmlnode *This = impl_from_IXMLDOMNode( iface ); + FIXME("(%p)->(%p)\n", This, stylesheet); return E_NOTIMPL; } @@ -1738,12 +1744,21 @@ IXMLDOMNode *create_node( xmlNodePtr node ) case XML_CDATA_SECTION_NODE: pUnk = create_cdata( node ); break; + case XML_ENTITY_REF_NODE: + pUnk = create_doc_entity_ref( node ); + break; + case XML_PI_NODE: + pUnk = create_pi( node ); + break; case XML_COMMENT_NODE: pUnk = create_comment( node ); break; case XML_DOCUMENT_NODE: pUnk = create_domdoc( node ); break; + case XML_DOCUMENT_FRAG_NODE: + pUnk = create_doc_fragment( node ); + break; default: { xmlnode *new_node; diff --git a/reactos/dll/win32/msxml3/nodelist.c b/reactos/dll/win32/msxml3/nodelist.c index 011fff0bf61..f643c5e8cbb 100644 --- a/reactos/dll/win32/msxml3/nodelist.c +++ b/reactos/dll/win32/msxml3/nodelist.c @@ -64,7 +64,7 @@ static HRESULT WINAPI xmlnodelist_QueryInterface( REFIID riid, void** ppvObject ) { - TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); if(!ppvObject) return E_INVALIDARG; @@ -205,7 +205,7 @@ static HRESULT WINAPI xmlnodelist_get_item( xmlNodePtr curr; LONG nodeIndex = 0; - TRACE("%p %d\n", This, index); + TRACE("(%p)->(%d %p)\n", This, index, listItem); if(!listItem) return E_INVALIDARG; @@ -238,7 +238,7 @@ static HRESULT WINAPI xmlnodelist_get_length( xmlnodelist *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, listLength); if(!listLength) return E_INVALIDARG; @@ -260,7 +260,7 @@ static HRESULT WINAPI xmlnodelist_nextNode( { xmlnodelist *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p %p\n", This, nextItem ); + TRACE("(%p)->(%p)\n", This, nextItem ); if(!nextItem) return E_INVALIDARG; @@ -289,7 +289,8 @@ static HRESULT WINAPI xmlnodelist__newEnum( IXMLDOMNodeList* iface, IUnknown** ppUnk) { - FIXME("\n"); + xmlnodelist *This = impl_from_IXMLDOMNodeList( iface ); + FIXME("(%p)->(%p)\n", This, ppUnk); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/nodemap.c b/reactos/dll/win32/msxml3/nodemap.c index 91f7a323e5e..7d23ec80bd5 100644 --- a/reactos/dll/win32/msxml3/nodemap.c +++ b/reactos/dll/win32/msxml3/nodemap.c @@ -62,7 +62,7 @@ static HRESULT WINAPI xmlnodemap_QueryInterface( REFIID riid, void** ppvObject ) { xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); - TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); if( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -207,7 +207,7 @@ static HRESULT WINAPI xmlnodemap_getNamedItem( xmlAttrPtr attr; xmlNodePtr node; - TRACE("%p %s %p\n", This, debugstr_w(name), namedItem ); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), namedItem ); if ( !namedItem ) return E_INVALIDARG; @@ -242,7 +242,7 @@ static HRESULT WINAPI xmlnodemap_setNamedItem( IXMLDOMNode *pAttr = NULL; xmlNodePtr node; - TRACE("%p %p %p\n", This, newItem, namedItem ); + TRACE("(%p)->(%p %p)\n", This, newItem, namedItem ); if(!newItem) return E_INVALIDARG; @@ -292,7 +292,7 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem( xmlAttrPtr attr; xmlNodePtr node; - TRACE("%p %s %p\n", This, debugstr_w(name), namedItem ); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), namedItem ); if ( !name) return E_INVALIDARG; @@ -337,7 +337,7 @@ static HRESULT WINAPI xmlnodemap_get_item( xmlAttrPtr curr; LONG attrIndex; - TRACE("%p %d\n", This, index); + TRACE("(%p)->(%d %p)\n", This, index, listItem); *listItem = NULL; @@ -370,7 +370,7 @@ static HRESULT WINAPI xmlnodemap_get_length( xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, listLength); if( !listLength ) return E_INVALIDARG; @@ -402,7 +402,8 @@ static HRESULT WINAPI xmlnodemap_getQualifiedItem( BSTR namespaceURI, IXMLDOMNode** qualifiedItem) { - FIXME("\n"); + xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), qualifiedItem); return E_NOTIMPL; } @@ -412,7 +413,8 @@ static HRESULT WINAPI xmlnodemap_removeQualifiedItem( BSTR namespaceURI, IXMLDOMNode** qualifiedItem) { - FIXME("\n"); + xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(baseName), debugstr_w(namespaceURI), qualifiedItem); return E_NOTIMPL; } @@ -425,7 +427,7 @@ static HRESULT WINAPI xmlnodemap_nextNode( xmlAttrPtr curr; LONG attrIndex; - TRACE("%p %d\n", This, This->iterator); + TRACE("(%p)->(%p: %d)\n", This, nextItem, This->iterator); *nextItem = NULL; @@ -451,7 +453,7 @@ static HRESULT WINAPI xmlnodemap_reset( { xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); - TRACE("%p %d\n", This, This->iterator); + TRACE("(%p: %d)\n", This, This->iterator); This->iterator = 0; @@ -462,7 +464,8 @@ static HRESULT WINAPI xmlnodemap__newEnum( IXMLDOMNamedNodeMap *iface, IUnknown** ppUnk) { - FIXME("\n"); + xmlnodemap *This = impl_from_IXMLDOMNamedNodeMap( iface ); + FIXME("(%p)->(%p)\n", This, ppUnk); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/parseerror.c b/reactos/dll/win32/msxml3/parseerror.c index 40b17a0f3d9..4b0dc57f508 100644 --- a/reactos/dll/win32/msxml3/parseerror.c +++ b/reactos/dll/win32/msxml3/parseerror.c @@ -56,7 +56,7 @@ static HRESULT WINAPI parseError_QueryInterface( REFIID riid, void** ppvObject ) { - TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -208,7 +208,8 @@ static HRESULT WINAPI parseError_get_url( IXMLDOMParseError *iface, BSTR *url ) { - FIXME("\n"); + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + FIXME("(%p)->(%p)\n", This, url); return E_NOTIMPL; } @@ -232,7 +233,8 @@ static HRESULT WINAPI parseError_get_srcText( IXMLDOMParseError *iface, BSTR *srcText ) { - FIXME("\n"); + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + FIXME("(%p)->(%p)\n", This, srcText); return E_NOTIMPL; } @@ -240,7 +242,8 @@ static HRESULT WINAPI parseError_get_line( IXMLDOMParseError *iface, LONG *line ) { - FIXME("\n"); + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + FIXME("(%p)->(%p)\n", This, line); return E_NOTIMPL; } @@ -248,7 +251,8 @@ static HRESULT WINAPI parseError_get_linepos( IXMLDOMParseError *iface, LONG *linepos ) { - FIXME("\n"); + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + FIXME("(%p)->(%p)\n", This, linepos); return E_NOTIMPL; } @@ -256,7 +260,8 @@ static HRESULT WINAPI parseError_get_filepos( IXMLDOMParseError *iface, LONG *filepos ) { - FIXME("\n"); + parse_error_t *This = impl_from_IXMLDOMParseError( iface ); + FIXME("(%p)->(%p)\n", This, filepos); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/pi.c b/reactos/dll/win32/msxml3/pi.c index f32cebf8300..0baefe49031 100644 --- a/reactos/dll/win32/msxml3/pi.c +++ b/reactos/dll/win32/msxml3/pi.c @@ -55,7 +55,7 @@ static HRESULT WINAPI dom_pi_QueryInterface( void** ppvObject ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMProcessingInstruction ) || IsEqualGUID( riid, &IID_IDispatch ) || @@ -526,7 +526,7 @@ static HRESULT WINAPI dom_pi_put_data( BSTR sTarget; static const WCHAR szXML[] = {'x','m','l',0}; - TRACE("%p %s\n", This, debugstr_w(data) ); + TRACE("(%p)->(%s)\n", This, debugstr_w(data) ); /* Cannot set data to a PI node whose target is 'xml' */ hr = dom_pi_get_nodeName(iface, &sTarget); diff --git a/reactos/dll/win32/msxml3/queryresult.c b/reactos/dll/win32/msxml3/queryresult.c index ab545968c08..eab83a904b6 100644 --- a/reactos/dll/win32/msxml3/queryresult.c +++ b/reactos/dll/win32/msxml3/queryresult.c @@ -74,7 +74,7 @@ static HRESULT WINAPI queryresult_QueryInterface( { queryresult *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); if(!ppvObject) return E_INVALIDARG; @@ -217,7 +217,7 @@ static HRESULT WINAPI queryresult_get_item( { queryresult *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p %d\n", This, index); + TRACE("(%p)->(%d %p)\n", This, index, listItem); if(!listItem) return E_INVALIDARG; @@ -239,7 +239,7 @@ static HRESULT WINAPI queryresult_get_length( { queryresult *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p\n", This); + TRACE("(%p)->(%p)\n", This, listLength); if(!listLength) return E_INVALIDARG; @@ -254,7 +254,7 @@ static HRESULT WINAPI queryresult_nextNode( { queryresult *This = impl_from_IXMLDOMNodeList( iface ); - TRACE("%p %p\n", This, nextItem ); + TRACE("(%p)->(%p)\n", This, nextItem ); if(!nextItem) return E_INVALIDARG; @@ -283,7 +283,8 @@ static HRESULT WINAPI queryresult__newEnum( IXMLDOMNodeList* iface, IUnknown** ppUnk) { - FIXME("\n"); + queryresult *This = impl_from_IXMLDOMNodeList( iface ); + FIXME("(%p)->(%p)\n", This, ppUnk); return E_NOTIMPL; } diff --git a/reactos/dll/win32/msxml3/schema.c b/reactos/dll/win32/msxml3/schema.c index f0a616979a0..72d78547082 100644 --- a/reactos/dll/win32/msxml3/schema.c +++ b/reactos/dll/win32/msxml3/schema.c @@ -51,7 +51,7 @@ static HRESULT WINAPI schema_cache_QueryInterface( IXMLDOMSchemaCollection *ifac { schema_t *This = impl_from_IXMLDOMSchemaCollection( iface ); - TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid( riid ), ppvObject ); if ( IsEqualIID( riid, &IID_IUnknown ) || IsEqualIID( riid, &IID_IDispatch ) || diff --git a/reactos/dll/win32/msxml3/text.c b/reactos/dll/win32/msxml3/text.c index 70ca3efee33..fdcb06b4cb3 100644 --- a/reactos/dll/win32/msxml3/text.c +++ b/reactos/dll/win32/msxml3/text.c @@ -56,7 +56,7 @@ static HRESULT WINAPI domtext_QueryInterface( void** ppvObject ) { domtext *This = impl_from_IXMLDOMText( iface ); - TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMText ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || @@ -482,7 +482,7 @@ static HRESULT WINAPI domtext_get_data( BSTR *p) { domtext *This = impl_from_IXMLDOMText( iface ); - HRESULT hr = E_FAIL; + HRESULT hr; VARIANT vRet; if(!p) @@ -502,17 +502,14 @@ static HRESULT WINAPI domtext_put_data( BSTR data) { domtext *This = impl_from_IXMLDOMText( iface ); - HRESULT hr = E_FAIL; VARIANT val; - TRACE("%p %s\n", This, debugstr_w(data) ); + TRACE("(%p)->(%s)\n", This, debugstr_w(data) ); V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); - - return hr; + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); } static HRESULT WINAPI domtext_get_length( @@ -520,24 +517,22 @@ static HRESULT WINAPI domtext_get_length( LONG *len) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlChar *pContent; - LONG nLength = 0; + HRESULT hr; + BSTR data; - TRACE("%p\n", iface); + TRACE("(%p)->(%p)\n", This, len); if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMText_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); - xmlFree(pContent); + *len = SysStringLen(data); + SysFreeString(data); } - *len = nLength; - - return S_OK; + return hr; } static HRESULT WINAPI domtext_substringData( @@ -545,11 +540,10 @@ static HRESULT WINAPI domtext_substringData( LONG offset, LONG count, BSTR *p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlChar *pContent; - LONG nLength = 0; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; - TRACE("%p\n", iface); + TRACE("(%p)->(%d %d %p)\n", This, offset, count, p); if(!p) return E_INVALIDARG; @@ -559,26 +553,24 @@ static HRESULT WINAPI domtext_substringData( return E_INVALIDARG; if(count == 0) - return hr; + return S_FALSE; - pContent = xmlNodeGetContent(This->node.node); - if(pContent) + hr = IXMLDOMText_get_data(iface, &data); + if(hr == S_OK) { - nLength = xmlStrlen(pContent); + LONG len = SysStringLen(data); - if( offset < nLength) + if(offset < len) { - BSTR sContent = bstr_from_xmlChar(pContent); - if(offset + count > nLength) - *p = SysAllocString(&sContent[offset]); + if(offset + count > len) + *p = SysAllocString(&data[offset]); else - *p = SysAllocStringLen(&sContent[offset], count); - - SysFreeString(sContent); - hr = S_OK; + *p = SysAllocStringLen(&data[offset], count); } + else + hr = S_FALSE; - xmlFree(pContent); + SysFreeString(data); } return hr; @@ -589,26 +581,30 @@ static HRESULT WINAPI domtext_appendData( BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlChar *pContent; - HRESULT hr = S_FALSE; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p\n", iface); + TRACE("(%p)->(%s)\n", This, debugstr_w(p)); /* Nothing to do if NULL or an Empty string passed in. */ - if(p == NULL || SysStringLen(p) == 0) - return S_OK; + if((p_len = SysStringLen(p)) == 0) return S_OK; - pContent = xmlChar_from_wchar( p ); - if(pContent) + hr = IXMLDOMText_get_data(iface, &data); + if(hr == S_OK) { - if(xmlTextConcat(This->node.node, pContent, SysStringLen(p)) == 0) - hr = S_OK; - else - hr = E_FAIL; - heap_free( pContent ); + LONG len = SysStringLen(data); + BSTR str = SysAllocStringLen(NULL, p_len + len); + + memcpy(str, data, len*sizeof(WCHAR)); + memcpy(&str[len], p, p_len*sizeof(WCHAR)); + str[len+p_len] = 0; + + hr = IXMLDOMText_put_data(iface, str); + + SysFreeString(str); + SysFreeString(data); } - else - hr = E_FAIL; return hr; } @@ -618,16 +614,14 @@ static HRESULT WINAPI domtext_insertData( LONG offset, BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlChar *pXmlContent; - BSTR sNewString; - HRESULT hr = S_FALSE; - LONG nLength = 0, nLengthP = 0; - xmlChar *str = NULL; + HRESULT hr; + BSTR data; + LONG p_len; - TRACE("%p\n", This); + TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p)); /* If have a NULL or empty string, don't do anything. */ - if(SysStringLen(p) == 0) + if((p_len = SysStringLen(p)) == 0) return S_OK; if(offset < 0) @@ -635,48 +629,29 @@ static HRESULT WINAPI domtext_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(This->node.node); - if(pXmlContent) + hr = IXMLDOMText_get_data(iface, &data); + if(hr == S_OK) { - BSTR sContent = bstr_from_xmlChar( pXmlContent ); - nLength = SysStringLen(sContent); - nLengthP = SysStringLen(p); + LONG len = SysStringLen(data); + BSTR str; - if(nLength < offset) + if(len < offset) { - SysFreeString(sContent); - xmlFree(pXmlContent); - + SysFreeString(data); return E_INVALIDARG; } - sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1); - if(sNewString) - { - if(offset > 0) - memcpy(sNewString, sContent, offset * sizeof(WCHAR)); + str = SysAllocStringLen(NULL, len + p_len); + /* start part, supplied string and end part */ + memcpy(str, data, offset*sizeof(WCHAR)); + memcpy(&str[offset], p, p_len*sizeof(WCHAR)); + memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR)); + str[len+p_len] = 0; - memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR)); + hr = IXMLDOMText_put_data(iface, str); - if(offset+nLengthP < nLength) - memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR)); - - sNewString[nLengthP + nLength] = 0; - - str = xmlChar_from_wchar(sNewString); - if(str) - { - xmlNodeSetContent(This->node.node, str); - hr = S_OK; - } - heap_free(str); - - SysFreeString(sNewString); - } - - SysFreeString(sContent); - - xmlFree(pXmlContent); + SysFreeString(str); + SysFreeString(data); } return hr; @@ -690,7 +665,7 @@ static HRESULT WINAPI domtext_deleteData( LONG len = -1; BSTR str; - TRACE("%p %d %d\n", iface, offset, count); + TRACE("(%p)->(%d %d)\n", iface, offset, count); hr = IXMLDOMText_get_length(iface, &len); if(hr != S_OK) return hr; @@ -733,15 +708,25 @@ static HRESULT WINAPI domtext_replaceData( IXMLDOMText *iface, LONG offset, LONG count, BSTR p) { - FIXME("\n"); - return E_NOTIMPL; + domtext *This = impl_from_IXMLDOMText( iface ); + HRESULT hr; + + TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p)); + + hr = IXMLDOMText_deleteData(iface, offset, count); + + if (hr == S_OK) + hr = IXMLDOMText_insertData(iface, offset, p); + + return hr; } static HRESULT WINAPI domtext_splitText( IXMLDOMText *iface, LONG offset, IXMLDOMText **txtNode) { - FIXME("\n"); + domtext *This = impl_from_IXMLDOMText( iface ); + FIXME("(%p)->(%d %p)\n", This, offset, txtNode); return E_NOTIMPL; } diff --git a/reactos/include/psdk/msxml2.idl b/reactos/include/psdk/msxml2.idl index b6303c9f001..89914004955 100644 --- a/reactos/include/psdk/msxml2.idl +++ b/reactos/include/psdk/msxml2.idl @@ -1979,6 +1979,15 @@ coclass SAXXMLReader30 interface IMXReaderControl; }; +[ + uuid(7c6e29bc-8b8b-4c3d-859e-af6cd158be0f) +] +coclass SAXXMLReader40 +{ + [default] interface IVBSAXXMLReader; + interface ISAXXMLReader; +}; + [ uuid(fc220ad8-a72a-4ee8-926e-0b7ad152a020) ]