msxml3: Stub support for external entity resolver.

This commit is contained in:
Nikolay Sivov 2012-11-16 16:46:36 -05:00 committed by Alexandre Julliard
parent a644bad2af
commit 7a00f31ecf
2 changed files with 32 additions and 26 deletions

View File

@ -168,6 +168,7 @@ enum saxhandler_type
SAXContentHandler = 0, SAXContentHandler = 0,
SAXDeclHandler, SAXDeclHandler,
SAXDTDHandler, SAXDTDHandler,
SAXEntityResolver,
SAXErrorHandler, SAXErrorHandler,
SAXLexicalHandler, SAXLexicalHandler,
SAXHandler_Last SAXHandler_Last
@ -197,10 +198,17 @@ struct saxlexicalhandler_iface
IVBSAXLexicalHandler *vbhandler; IVBSAXLexicalHandler *vbhandler;
}; };
struct saxentityresolver_iface
{
ISAXEntityResolver *handler;
IVBSAXEntityResolver *vbhandler;
};
struct saxhandler_iface struct saxhandler_iface
{ {
union { union {
struct saxcontenthandler_iface content; struct saxcontenthandler_iface content;
struct saxentityresolver_iface entityresolver;
struct saxerrorhandler_iface error; struct saxerrorhandler_iface error;
struct saxlexicalhandler_iface lexical; struct saxlexicalhandler_iface lexical;
struct saxanyhandler_iface anyhandler; struct saxanyhandler_iface anyhandler;
@ -1843,6 +1851,12 @@ static void libxmlCDataBlock(void *ctx, const xmlChar *value, int len)
This->column += 4+end-cur; This->column += 4+end-cur;
} }
static xmlParserInputPtr libxmlresolveentity(void *ctx, const xmlChar *publicid, const xmlChar *systemid)
{
FIXME("entity resolving not implemented, %s, %s\n", publicid, systemid);
return xmlSAX2ResolveEntity(ctx, publicid, systemid);
}
/*** IVBSAXLocator interface ***/ /*** IVBSAXLocator interface ***/
/*** IUnknown methods ***/ /*** IUnknown methods ***/
static HRESULT WINAPI ivbsaxlocator_QueryInterface(IVBSAXLocator* iface, REFIID riid, void **ppvObject) static HRESULT WINAPI ivbsaxlocator_QueryInterface(IVBSAXLocator* iface, REFIID riid, void **ppvObject)
@ -2377,24 +2391,6 @@ static HRESULT internal_parseStream(saxreader *This, ISequentialStream *stream,
return hr; return hr;
} }
static HRESULT internal_getEntityResolver(
saxreader *This,
void *pEntityResolver,
BOOL vbInterface)
{
FIXME("(%p)->(%p) stub\n", This, pEntityResolver);
return E_NOTIMPL;
}
static HRESULT internal_putEntityResolver(
saxreader *This,
void *pEntityResolver,
BOOL vbInterface)
{
FIXME("(%p)->(%p) stub\n", This, pEntityResolver);
return E_NOTIMPL;
}
static HRESULT internal_parse( static HRESULT internal_parse(
saxreader* This, saxreader* This,
VARIANT varInput, VARIANT varInput,
@ -2877,18 +2873,18 @@ static HRESULT WINAPI saxxmlreader_putProperty(
static HRESULT WINAPI saxxmlreader_get_entityResolver( static HRESULT WINAPI saxxmlreader_get_entityResolver(
IVBSAXXMLReader* iface, IVBSAXXMLReader* iface,
IVBSAXEntityResolver **pEntityResolver) IVBSAXEntityResolver **resolver)
{ {
saxreader *This = impl_from_IVBSAXXMLReader( iface ); saxreader *This = impl_from_IVBSAXXMLReader( iface );
return internal_getEntityResolver(This, pEntityResolver, TRUE); return saxreader_get_handler(This, SAXEntityResolver, TRUE, (void**)resolver);
} }
static HRESULT WINAPI saxxmlreader_put_entityResolver( static HRESULT WINAPI saxxmlreader_put_entityResolver(
IVBSAXXMLReader* iface, IVBSAXXMLReader* iface,
IVBSAXEntityResolver *pEntityResolver) IVBSAXEntityResolver *resolver)
{ {
saxreader *This = impl_from_IVBSAXXMLReader( iface ); saxreader *This = impl_from_IVBSAXXMLReader( iface );
return internal_putEntityResolver(This, pEntityResolver, TRUE); return saxreader_put_handler(This, SAXEntityResolver, resolver, TRUE);
} }
static HRESULT WINAPI saxxmlreader_get_contentHandler( static HRESULT WINAPI saxxmlreader_get_contentHandler(
@ -3084,18 +3080,18 @@ static HRESULT WINAPI isaxxmlreader_putProperty(
static HRESULT WINAPI isaxxmlreader_getEntityResolver( static HRESULT WINAPI isaxxmlreader_getEntityResolver(
ISAXXMLReader* iface, ISAXXMLReader* iface,
ISAXEntityResolver **ppEntityResolver) ISAXEntityResolver **resolver)
{ {
saxreader *This = impl_from_ISAXXMLReader( iface ); saxreader *This = impl_from_ISAXXMLReader( iface );
return internal_getEntityResolver(This, ppEntityResolver, FALSE); return saxreader_get_handler(This, SAXEntityResolver, FALSE, (void**)resolver);
} }
static HRESULT WINAPI isaxxmlreader_putEntityResolver( static HRESULT WINAPI isaxxmlreader_putEntityResolver(
ISAXXMLReader* iface, ISAXXMLReader* iface,
ISAXEntityResolver *pEntityResolver) ISAXEntityResolver *resolver)
{ {
saxreader *This = impl_from_ISAXXMLReader( iface ); saxreader *This = impl_from_ISAXXMLReader( iface );
return internal_putEntityResolver(This, pEntityResolver, FALSE); return saxreader_put_handler(This, SAXEntityResolver, resolver, FALSE);
} }
static HRESULT WINAPI isaxxmlreader_getContentHandler( static HRESULT WINAPI isaxxmlreader_getContentHandler(
@ -3264,6 +3260,7 @@ HRESULT SAXXMLReader_create(MSXML_VERSION version, IUnknown *outer, LPVOID *ppOb
reader->sax.error = libxmlFatalError; reader->sax.error = libxmlFatalError;
reader->sax.fatalError = libxmlFatalError; reader->sax.fatalError = libxmlFatalError;
reader->sax.cdataBlock = libxmlCDataBlock; reader->sax.cdataBlock = libxmlCDataBlock;
reader->sax.resolveEntity = libxmlresolveentity;
*ppObj = &reader->IVBSAXXMLReader_iface; *ppObj = &reader->IVBSAXXMLReader_iface;

View File

@ -1903,6 +1903,7 @@ static void test_saxreader(void)
while (table->clsid) while (table->clsid)
{ {
struct call_entry *test_seq; struct call_entry *test_seq;
ISAXEntityResolver *resolver;
BSTR str; BSTR str;
if (!is_clsid_supported(table->clsid, reader_support_data)) if (!is_clsid_supported(table->clsid, reader_support_data))
@ -2220,6 +2221,14 @@ static void test_saxreader(void)
EXPECT_HR(hr, S_OK); EXPECT_HR(hr, S_OK);
ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "attribute value normalization", TRUE); ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "attribute value normalization", TRUE);
resolver = (void*)0xdeadbeef;
hr = ISAXXMLReader_getEntityResolver(reader, &resolver);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(resolver == NULL, "got %p\n", resolver);
hr = ISAXXMLReader_putEntityResolver(reader, NULL);
ok(hr == S_OK || broken(hr == E_FAIL), "got 0x%08x\n", hr);
ISAXXMLReader_Release(reader); ISAXXMLReader_Release(reader);
table++; table++;
} }