msxml3: Support ISequentialStream as a document load source.

This commit is contained in:
Nikolay Sivov 2012-11-26 23:29:06 -05:00 committed by Alexandre Julliard
parent b296b08a5c
commit db9d8ebb08
1 changed files with 23 additions and 35 deletions

View File

@ -2037,8 +2037,6 @@ static HRESULT WINAPI domdoc_load(
domdoc *This = impl_from_IXMLDOMDocument3( iface );
LPWSTR filename = NULL;
HRESULT hr = S_FALSE;
IXMLDOMDocument3 *pNewDoc = NULL;
IStream *pStream = NULL;
xmlDocPtr xmldoc;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&source));
@ -2104,13 +2102,18 @@ static HRESULT WINAPI domdoc_load(
}
break;
case VT_UNKNOWN:
{
ISequentialStream *stream = NULL;
IXMLDOMDocument3 *newdoc = NULL;
if (!V_UNKNOWN(&source)) return E_INVALIDARG;
hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IXMLDOMDocument3, (void**)&pNewDoc);
hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IXMLDOMDocument3, (void**)&newdoc);
if(hr == S_OK)
{
if(pNewDoc)
if(newdoc)
{
domdoc *newDoc = impl_from_IXMLDOMDocument3( pNewDoc );
domdoc *newDoc = impl_from_IXMLDOMDocument3( newdoc );
xmldoc = xmlCopyDoc(get_doc(newDoc), 1);
xmldoc->_private = create_priv();
@ -2122,40 +2125,25 @@ static HRESULT WINAPI domdoc_load(
return hr;
}
}
hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IStream, (void**)&pStream);
if(hr == S_OK)
{
IPersistStream *pDocStream;
hr = IXMLDOMDocument3_QueryInterface(iface, &IID_IPersistStream, (void**)&pDocStream);
if(hr == S_OK)
{
hr = IPersistStream_Load(pDocStream, pStream);
IStream_Release(pStream);
if(hr == S_OK)
{
*isSuccessful = VARIANT_TRUE;
TRACE("Using IStream to load Document\n");
return S_OK;
}
else
{
ERR("xmldoc_IPersistStream_Load failed (%d)\n", hr);
}
}
else
{
ERR("QueryInterface IID_IPersistStream failed (%d)\n", hr);
}
}
else
hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IStream, (void**)&stream);
if (FAILED(hr))
hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_ISequentialStream, (void**)&stream);
if (hr == S_OK)
{
/* ISequentialStream */
FIXME("Unknown type not supported (0x%08x) (%p)(%p)\n", hr, pNewDoc, V_UNKNOWN(&source)->lpVtbl);
hr = domdoc_load_from_stream(This, stream);
if (hr == S_OK)
*isSuccessful = VARIANT_TRUE;
ISequentialStream_Release(stream);
return hr;
}
FIXME("unsupported IUnknown type (0x%08x) (%p)\n", hr, V_UNKNOWN(&source)->lpVtbl);
break;
default:
FIXME("VT type not supported (%d)\n", V_VT(&source));
}
default:
FIXME("VT type not supported (%d)\n", V_VT(&source));
}
if ( filename )