Commit cce65b70 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

msxml3: Improve parse error handling a bit.

parent 7ee50b69
...@@ -168,6 +168,7 @@ typedef struct _domdoc ...@@ -168,6 +168,7 @@ typedef struct _domdoc
VARIANT_BOOL async; VARIANT_BOOL async;
IUnknown *node_unk; IUnknown *node_unk;
IXMLDOMNode *node; IXMLDOMNode *node;
HRESULT error;
} domdoc; } domdoc;
LONG xmldoc_add_ref(xmlDocPtr doc) LONG xmldoc_add_ref(xmlDocPtr doc)
...@@ -978,8 +979,13 @@ static HRESULT WINAPI domdoc_load( ...@@ -978,8 +979,13 @@ static HRESULT WINAPI domdoc_load(
return S_FALSE; return S_FALSE;
xmldoc = doread( filename ); xmldoc = doread( filename );
if ( !xmldoc ) return S_FALSE; if ( !xmldoc )
{
This->error = E_FAIL;
return S_FALSE;
}
This->error = S_OK;
xmldoc->_private = 0; xmldoc->_private = 0;
attach_xmlnode(This->node, (xmlNodePtr) xmldoc); attach_xmlnode(This->node, (xmlNodePtr) xmldoc);
...@@ -1001,8 +1007,16 @@ static HRESULT WINAPI domdoc_get_parseError( ...@@ -1001,8 +1007,16 @@ static HRESULT WINAPI domdoc_get_parseError(
IXMLDOMDocument *iface, IXMLDOMDocument *iface,
IXMLDOMParseError** errorObj ) IXMLDOMParseError** errorObj )
{ {
BSTR error_string = NULL;
static const WCHAR err[] = {'e','r','r','o','r',0};
domdoc *This = impl_from_IXMLDOMDocument( iface );
FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj); FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj);
*errorObj = create_parseError(0, NULL, NULL, NULL, 0, 0, 0);
if(This->error)
error_string = SysAllocString(err);
*errorObj = create_parseError(This->error, NULL, error_string, NULL, 0, 0, 0);
if(!*errorObj) return E_OUTOFMEMORY; if(!*errorObj) return E_OUTOFMEMORY;
return S_OK; return S_OK;
} }
...@@ -1094,8 +1108,12 @@ static HRESULT WINAPI domdoc_loadXML( ...@@ -1094,8 +1108,12 @@ static HRESULT WINAPI domdoc_loadXML(
xmldoc = doparse( str, len ); xmldoc = doparse( str, len );
HeapFree( GetProcessHeap(), 0, str ); HeapFree( GetProcessHeap(), 0, str );
if ( !xmldoc ) if ( !xmldoc )
{
This->error = E_FAIL;
return S_FALSE; return S_FALSE;
}
This->error = S_OK;
xmldoc->_private = 0; xmldoc->_private = 0;
attach_xmlnode( This->node, (xmlNodePtr) xmldoc ); attach_xmlnode( This->node, (xmlNodePtr) xmldoc );
...@@ -1317,6 +1335,7 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -1317,6 +1335,7 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
doc->lpVtbl = &domdoc_vtbl; doc->lpVtbl = &domdoc_vtbl;
doc->ref = 1; doc->ref = 1;
doc->async = 0; doc->async = 0;
doc->error = S_OK;
doc->node_unk = create_basic_node( NULL, (IUnknown*)&doc->lpVtbl ); doc->node_unk = create_basic_node( NULL, (IUnknown*)&doc->lpVtbl );
if(!doc->node_unk) if(!doc->node_unk)
......
...@@ -173,8 +173,16 @@ static HRESULT WINAPI parseError_get_reason( ...@@ -173,8 +173,16 @@ static HRESULT WINAPI parseError_get_reason(
IXMLDOMParseError *iface, IXMLDOMParseError *iface,
BSTR *reason ) BSTR *reason )
{ {
FIXME("\n"); parse_error_t *This = impl_from_IXMLDOMParseError( iface );
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, reason);
if(!This->reason)
{
*reason = NULL;
return S_FALSE;
}
*reason = SysAllocString(This->reason);
return S_OK;
} }
static HRESULT WINAPI parseError_get_srcText( static HRESULT WINAPI parseError_get_srcText(
......
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