msxml3: Added partial implementation of ISAXXMLReader_parse.
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index cda75b6..a50adca 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -60,6 +60,8 @@
const struct ISAXLocatorVtbl *lpSAXLocatorVtbl;
LONG ref;
saxreader *saxreader;
+ HRESULT ret;
+ xmlParserCtxtPtr pParserCtxt;
} saxlocator;
static inline saxreader *impl_from_IVBSAXXMLReader( IVBSAXXMLReader *iface )
@@ -194,6 +196,9 @@
locator->saxreader = reader;
ISAXXMLReader_AddRef((ISAXXMLReader*)&reader->lpSAXXMLReaderVtbl);
+ locator->pParserCtxt = NULL;
+ locator->ret = S_OK;
+
*ppsaxlocator = locator;
TRACE("returning %p\n", *ppsaxlocator);
@@ -773,9 +778,48 @@
VARIANT varInput)
{
saxreader *This = impl_from_ISAXXMLReader( iface );
+ saxlocator *locator;
+ xmlChar *data = NULL;
+ HRESULT hr;
- FIXME("(%p) stub\n", This);
- return E_NOTIMPL;
+ FIXME("(%p) semi-stub\n", This);
+
+ hr = SAXLocator_create(This, &locator);
+ if(FAILED(hr))
+ return E_FAIL;
+
+ hr = S_OK;
+ switch(V_VT(&varInput))
+ {
+ case VT_BSTR:
+ locator->pParserCtxt = xmlNewParserCtxt();
+ if(!locator->pParserCtxt)
+ {
+ hr = E_FAIL;
+ break;
+ }
+ data = xmlChar_from_wchar(V_BSTR(&varInput));
+ xmlSetupParserForBuffer(locator->pParserCtxt, data, NULL);
+
+ locator->pParserCtxt->sax = &locator->saxreader->sax;
+ locator->pParserCtxt->userData = locator;
+
+ if(xmlParseDocument(locator->pParserCtxt)) hr = E_FAIL;
+ else hr = locator->ret;
+ break;
+ default:
+ hr = E_NOTIMPL;
+ }
+
+ if(locator->pParserCtxt)
+ {
+ locator->pParserCtxt->sax = NULL;
+ xmlFreeParserCtxt(locator->pParserCtxt);
+ locator->pParserCtxt = NULL;
+ }
+ if(data) HeapFree(GetProcessHeap(), 0, data);
+ ISAXLocator_Release((ISAXLocator*)&locator->lpSAXLocatorVtbl);
+ return hr;
}
static HRESULT WINAPI isaxxmlreader_parseURL(
@@ -829,6 +873,9 @@
reader->contentHandler = NULL;
reader->errorHandler = NULL;
+ memset(&reader->sax, 0, sizeof(xmlSAXHandler));
+ reader->sax.initialized = XML_SAX2_MAGIC;
+
*ppObj = &reader->lpVtbl;
TRACE("returning iface %p\n", *ppObj);