Commit db9d8ebb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Support ISequentialStream as a document load source.

parent b296b08a
...@@ -2037,8 +2037,6 @@ static HRESULT WINAPI domdoc_load( ...@@ -2037,8 +2037,6 @@ static HRESULT WINAPI domdoc_load(
domdoc *This = impl_from_IXMLDOMDocument3( iface ); domdoc *This = impl_from_IXMLDOMDocument3( iface );
LPWSTR filename = NULL; LPWSTR filename = NULL;
HRESULT hr = S_FALSE; HRESULT hr = S_FALSE;
IXMLDOMDocument3 *pNewDoc = NULL;
IStream *pStream = NULL;
xmlDocPtr xmldoc; xmlDocPtr xmldoc;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&source)); TRACE("(%p)->(%s)\n", This, debugstr_variant(&source));
...@@ -2104,13 +2102,18 @@ static HRESULT WINAPI domdoc_load( ...@@ -2104,13 +2102,18 @@ static HRESULT WINAPI domdoc_load(
} }
break; break;
case VT_UNKNOWN: case VT_UNKNOWN:
{
ISequentialStream *stream = NULL;
IXMLDOMDocument3 *newdoc = NULL;
if (!V_UNKNOWN(&source)) return E_INVALIDARG; 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(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 = xmlCopyDoc(get_doc(newDoc), 1);
xmldoc->_private = create_priv(); xmldoc->_private = create_priv();
...@@ -2122,40 +2125,25 @@ static HRESULT WINAPI domdoc_load( ...@@ -2122,40 +2125,25 @@ static HRESULT WINAPI domdoc_load(
return hr; 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"); hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IStream, (void**)&stream);
return S_OK; if (FAILED(hr))
} hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_ISequentialStream, (void**)&stream);
else
{ if (hr == S_OK)
ERR("xmldoc_IPersistStream_Load failed (%d)\n", hr);
}
}
else
{
ERR("QueryInterface IID_IPersistStream failed (%d)\n", hr);
}
}
else
{ {
/* ISequentialStream */ hr = domdoc_load_from_stream(This, stream);
FIXME("Unknown type not supported (0x%08x) (%p)(%p)\n", hr, pNewDoc, V_UNKNOWN(&source)->lpVtbl); 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; 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 ) if ( filename )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment