90
typedef struct _schema_cache
92
const struct IXMLDOMSchemaCollection2Vtbl* lpVtbl;
93
IXMLDOMSchemaCollection2 IXMLDOMSchemaCollection2_iface;
93
96
MSXML_VERSION version;
94
97
xmlHashTablePtr cache;
99
VARIANT_BOOL validateOnLoad;
98
102
typedef struct _cache_entry
573
577
return DT_wstring_table[dt];
580
const char* debugstr_dt(XDR_DT dt)
582
return debugstr_a(dt != DT_INVALID ? (const char*)DT_string_table[dt] : NULL);
576
585
HRESULT dt_validate(XDR_DT dt, xmlChar const* content)
578
587
xmlDocPtr tmp_doc;
583
TRACE("(dt:%s, %s)\n", dt_to_str(dt), wine_dbgstr_a((char const*)content));
592
TRACE("(dt:%s, %s)\n", debugstr_dt(dt), wine_dbgstr_a((char const*)content));
585
594
if (!datatypes_schema)
680
689
xmlParserInputPtr input;
682
TRACE("(%s, %s, %p)\n", wine_dbgstr_a(URL), wine_dbgstr_a(ID), ctxt);
691
TRACE("(%s %s %p)\n", wine_dbgstr_a(URL), wine_dbgstr_a(ID), ctxt);
684
693
assert(MSXML_hInstance != NULL);
685
694
assert(datatypes_rsrc != NULL);
741
750
static LONG cache_entry_add_ref(cache_entry* entry)
743
752
LONG ref = InterlockedIncrement(&entry->ref);
744
TRACE("%p new ref %d\n", entry, ref);
753
TRACE("(%p)->(%d)\n", entry, ref);
748
757
static LONG cache_entry_release(cache_entry* entry)
750
759
LONG ref = InterlockedDecrement(&entry->ref);
751
TRACE("%p new ref %d\n", entry, ref);
760
TRACE("(%p)->(%d)\n", entry, ref);
774
783
static inline schema_cache* impl_from_IXMLDOMSchemaCollection2(IXMLDOMSchemaCollection2* iface)
776
return (schema_cache*)((char*)iface - FIELD_OFFSET(schema_cache, lpVtbl));
785
return CONTAINING_RECORD(iface, schema_cache, IXMLDOMSchemaCollection2_iface);
779
788
static inline SCHEMA_TYPE schema_type_from_xmlDocPtr(xmlDocPtr schema)
954
963
*ppvObject = iface;
965
else if (dispex_query_interface(&This->dispex, riid, ppvObject))
967
return *ppvObject ? S_OK : E_NOINTERFACE;
958
971
FIXME("interface %s not implemented\n", debugstr_guid(riid));
970
983
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
971
984
LONG ref = InterlockedIncrement(&This->ref);
972
TRACE("%p new ref %d\n", This, ref);
985
TRACE("(%p)->(%d)\n", This, ref);
983
996
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
984
997
LONG ref = InterlockedDecrement(&This->ref);
985
TRACE("%p new ref %d\n", This, ref);
998
TRACE("(%p)->(%d)\n", This, ref);
989
1002
xmlHashFree(This->cache, cache_free);
1003
release_dispex(&This->dispex);
990
1004
heap_free(This);
999
1013
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1001
TRACE("(%p)->(%p)\n", This, pctinfo);
1014
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
1008
1017
static HRESULT WINAPI schema_cache_GetTypeInfo(IXMLDOMSchemaCollection2* iface,
1009
1018
UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo)
1011
1020
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1014
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
1016
hr = get_typeinfo(IXMLDOMSchemaCollection_tid, ppTInfo);
1021
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
1022
iTInfo, lcid, ppTInfo);
1021
1025
static HRESULT WINAPI schema_cache_GetIDsOfNames(IXMLDOMSchemaCollection2* iface,
1023
1027
UINT cNames, LCID lcid, DISPID* rgDispId)
1025
1029
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1026
ITypeInfo* typeinfo;
1029
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
1032
if(!rgszNames || cNames == 0 || !rgDispId)
1033
return E_INVALIDARG;
1035
hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
1038
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
1039
ITypeInfo_Release(typeinfo);
1030
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
1031
riid, rgszNames, cNames, lcid, rgDispId);
1045
1034
static HRESULT WINAPI schema_cache_Invoke(IXMLDOMSchemaCollection2* iface,
1049
1038
UINT* puArgErr)
1051
1040
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1052
ITypeInfo* typeinfo;
1055
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
1056
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1058
hr = get_typeinfo(IXMLDOMSchemaCollection_tid, &typeinfo);
1061
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
1062
pVarResult, pExcepInfo, puArgErr);
1063
ITypeInfo_Release(typeinfo);
1041
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
1042
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1069
1045
static HRESULT WINAPI schema_cache_add(IXMLDOMSchemaCollection2* iface, BSTR uri, VARIANT var)
1165
1141
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1167
1143
cache_entry* entry;
1168
TRACE("(%p)->(%s, %p)\n", This, wine_dbgstr_w(uri), node);
1144
TRACE("(%p)->(%s %p)\n", This, wine_dbgstr_w(uri), node);
1171
1147
return E_POINTER;
1218
1194
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1219
1195
cache_index_data data = {index,len};
1220
TRACE("(%p)->(%i, %p)\n", This, index, len);
1196
TRACE("(%p)->(%i %p)\n", This, index, len);
1223
1199
return E_POINTER;
1261
1237
static HRESULT WINAPI schema_cache_get__newEnum(IXMLDOMSchemaCollection2* iface,
1262
1238
IUnknown** ppUnk)
1240
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1241
FIXME("(%p)->(%p): stub\n", This, ppUnk);
1267
1244
return E_NOTIMPL;
1270
1247
static HRESULT WINAPI schema_cache_validate(IXMLDOMSchemaCollection2* iface)
1249
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1250
FIXME("(%p): stub\n", This);
1273
1251
return E_NOTIMPL;
1276
1254
static HRESULT WINAPI schema_cache_put_validateOnLoad(IXMLDOMSchemaCollection2* iface,
1277
VARIANT_BOOL validateOnLoad)
1257
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1258
FIXME("(%p)->(%d): stub\n", This, value);
1260
This->validateOnLoad = value;
1261
/* it's ok to disable it, cause we don't validate on load anyway */
1262
if (value == VARIANT_FALSE) return S_OK;
1280
1264
return E_NOTIMPL;
1283
1267
static HRESULT WINAPI schema_cache_get_validateOnLoad(IXMLDOMSchemaCollection2* iface,
1284
VARIANT_BOOL* validateOnLoad)
1268
VARIANT_BOOL* value)
1270
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1271
TRACE("(%p)->(%p)\n", This, value);
1273
if (!value) return E_POINTER;
1274
*value = This->validateOnLoad;
1290
1279
static HRESULT WINAPI schema_cache_getSchema(IXMLDOMSchemaCollection2* iface,
1291
1280
BSTR namespaceURI, ISchema** schema)
1282
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1283
FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(namespaceURI), schema);
1295
1285
*schema = NULL;
1296
1286
return E_NOTIMPL;
1299
1289
static HRESULT WINAPI schema_cache_getDeclaration(IXMLDOMSchemaCollection2* iface,
1300
1290
IXMLDOMNode* node, ISchemaItem** item)
1292
schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface);
1293
FIXME("(%p)->(%p %p): stub\n", This, node, item);
1305
1296
return E_NOTIMPL;
1308
static const struct IXMLDOMSchemaCollection2Vtbl schema_cache_vtbl =
1299
static const struct IXMLDOMSchemaCollection2Vtbl XMLDOMSchemaCollection2Vtbl =
1310
1301
schema_cache_QueryInterface,
1311
1302
schema_cache_AddRef,
1417
HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* pUnkOuter, void** ppObj)
1408
static const tid_t schemacache_iface_tids[] = {
1409
IXMLDOMSchemaCollection2_tid,
1413
static dispex_static_data_t schemacache_dispex = {
1415
IXMLDOMSchemaCollection2_tid,
1417
schemacache_iface_tids
1420
HRESULT SchemaCache_create(MSXML_VERSION version, IUnknown* outer, void** obj)
1419
1422
schema_cache* This = heap_alloc(sizeof(schema_cache));
1421
1424
return E_OUTOFMEMORY;
1423
This->lpVtbl = &schema_cache_vtbl;
1426
TRACE("(%d %p %p)\n", version, outer, obj);
1428
This->IXMLDOMSchemaCollection2_iface.lpVtbl = &XMLDOMSchemaCollection2Vtbl;
1424
1429
This->cache = xmlHashCreate(DEFAULT_HASHTABLE_SIZE);
1426
1431
This->version = version;
1432
This->validateOnLoad = VARIANT_TRUE;
1433
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSchemaCollection2_iface, &schemacache_dispex);
1428
*ppObj = &This->lpVtbl;
1435
*obj = &This->IXMLDOMSchemaCollection2_iface;