msxml3: Support setting namespaces feature to default value.
This commit is contained in:
parent
5f68f3710c
commit
3d3786c2fa
|
@ -56,7 +56,7 @@ enum ReaderFeatures
|
|||
ExternalParameterEntities = 1 << 3,
|
||||
ForcedResync = 1 << 4,
|
||||
NamespacePrefixes = 1 << 5,
|
||||
Namespace = 1 << 6,
|
||||
Namespaces = 1 << 6,
|
||||
ParameterEntities = 1 << 7,
|
||||
PreserveSystemIndentifiers = 1 << 8,
|
||||
ProhibitDTD = 1 << 9,
|
||||
|
@ -221,6 +221,11 @@ static const WCHAR FeatureProhibitDTDW[] = {
|
|||
'p','r','o','h','i','b','i','t','-','d','t','d',0
|
||||
};
|
||||
|
||||
static const WCHAR FeatureNamespacesW[] = {
|
||||
'h','t','t','p',':','/','/','x','m','l','.','o','r','g','/','s','a','x','/','f','e','a','t','u','r','e','s',
|
||||
'/','n','a','m','e','s','p','a','c','e','s',0
|
||||
};
|
||||
|
||||
static inline HRESULT set_feature_value(saxreader *reader, enum ReaderFeatures feature, VARIANT_BOOL value)
|
||||
{
|
||||
if (value == VARIANT_TRUE)
|
||||
|
@ -231,6 +236,12 @@ static inline HRESULT set_feature_value(saxreader *reader, enum ReaderFeatures f
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static inline HRESULT get_feature_value(const saxreader *reader, enum ReaderFeatures feature, VARIANT_BOOL *value)
|
||||
{
|
||||
*value = reader->features & feature ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline BOOL has_content_handler(const saxlocator *locator)
|
||||
{
|
||||
return (locator->vbInterface && locator->saxreader->vbcontentHandler) ||
|
||||
|
@ -2616,12 +2627,15 @@ static HRESULT WINAPI saxxmlreader_Invoke(
|
|||
/*** IVBSAXXMLReader methods ***/
|
||||
static HRESULT WINAPI saxxmlreader_getFeature(
|
||||
IVBSAXXMLReader* iface,
|
||||
const WCHAR *pFeature,
|
||||
VARIANT_BOOL *pValue)
|
||||
const WCHAR *feature,
|
||||
VARIANT_BOOL *value)
|
||||
{
|
||||
saxreader *This = impl_from_IVBSAXXMLReader( iface );
|
||||
|
||||
FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(pFeature), pValue);
|
||||
if (!strcmpW(FeatureNamespacesW, feature))
|
||||
return get_feature_value(This, Namespaces, value);
|
||||
|
||||
FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature), value);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
@ -2652,6 +2666,9 @@ static HRESULT WINAPI saxxmlreader_putFeature(
|
|||
return set_feature_value(This, ProhibitDTD, value);
|
||||
}
|
||||
|
||||
if (!strcmpW(FeatureNamespacesW, feature) && value == VARIANT_TRUE)
|
||||
return set_feature_value(This, Namespaces, value);
|
||||
|
||||
FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature), value);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -3043,7 +3060,7 @@ HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|||
reader->pool.pool = NULL;
|
||||
reader->pool.index = 0;
|
||||
reader->pool.len = 0;
|
||||
reader->features = 0;
|
||||
reader->features = Namespaces;
|
||||
|
||||
memset(&reader->sax, 0, sizeof(xmlSAXHandler));
|
||||
reader->sax.initialized = XML_SAX2_MAGIC;
|
||||
|
|
|
@ -1267,6 +1267,50 @@ static void test_saxreader_properties(void)
|
|||
free_bstrs();
|
||||
}
|
||||
|
||||
struct feature_ns_entry_t {
|
||||
const GUID *guid;
|
||||
const char *clsid;
|
||||
VARIANT_BOOL value;
|
||||
};
|
||||
|
||||
static const struct feature_ns_entry_t feature_ns_entry_data[] = {
|
||||
{ &CLSID_SAXXMLReader, "CLSID_SAXXMLReader", VARIANT_TRUE },
|
||||
{ &CLSID_SAXXMLReader30, "CLSID_SAXXMLReader30", VARIANT_TRUE },
|
||||
{ &CLSID_SAXXMLReader40, "CLSID_SAXXMLReader40", VARIANT_TRUE },
|
||||
{ &CLSID_SAXXMLReader60, "CLSID_SAXXMLReader60", VARIANT_TRUE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_saxreader_features(void)
|
||||
{
|
||||
const struct feature_ns_entry_t *entry = feature_ns_entry_data;
|
||||
ISAXXMLReader *reader;
|
||||
|
||||
while (entry->guid)
|
||||
{
|
||||
VARIANT_BOOL value;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(entry->guid, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (void**)&reader);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("can't create %s instance\n", entry->clsid);
|
||||
entry++;
|
||||
continue;
|
||||
}
|
||||
|
||||
value = 0xc;
|
||||
hr = ISAXXMLReader_getFeature(reader, _bstr_("http://xml.org/sax/features/namespaces"), &value);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
||||
ok(entry->value == value, "%s: got wrong default value %x, expected %x\n", entry->clsid, value, entry->value);
|
||||
|
||||
ISAXXMLReader_Release(reader);
|
||||
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
||||
/* UTF-8 data with UTF-8 BOM and UTF-16 in prolog */
|
||||
static const CHAR UTF8BOMTest[] =
|
||||
"\xEF\xBB\xBF<?xml version = \"1.0\" encoding = \"UTF-16\"?>\n"
|
||||
|
@ -2317,6 +2361,7 @@ START_TEST(saxreader)
|
|||
|
||||
test_saxreader();
|
||||
test_saxreader_properties();
|
||||
test_saxreader_features();
|
||||
test_encoding();
|
||||
|
||||
/* MXXMLWriter tests */
|
||||
|
|
Loading…
Reference in New Issue