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,
|
ExternalParameterEntities = 1 << 3,
|
||||||
ForcedResync = 1 << 4,
|
ForcedResync = 1 << 4,
|
||||||
NamespacePrefixes = 1 << 5,
|
NamespacePrefixes = 1 << 5,
|
||||||
Namespace = 1 << 6,
|
Namespaces = 1 << 6,
|
||||||
ParameterEntities = 1 << 7,
|
ParameterEntities = 1 << 7,
|
||||||
PreserveSystemIndentifiers = 1 << 8,
|
PreserveSystemIndentifiers = 1 << 8,
|
||||||
ProhibitDTD = 1 << 9,
|
ProhibitDTD = 1 << 9,
|
||||||
|
@ -221,6 +221,11 @@ static const WCHAR FeatureProhibitDTDW[] = {
|
||||||
'p','r','o','h','i','b','i','t','-','d','t','d',0
|
'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)
|
static inline HRESULT set_feature_value(saxreader *reader, enum ReaderFeatures feature, VARIANT_BOOL value)
|
||||||
{
|
{
|
||||||
if (value == VARIANT_TRUE)
|
if (value == VARIANT_TRUE)
|
||||||
|
@ -231,6 +236,12 @@ static inline HRESULT set_feature_value(saxreader *reader, enum ReaderFeatures f
|
||||||
return S_OK;
|
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)
|
static inline BOOL has_content_handler(const saxlocator *locator)
|
||||||
{
|
{
|
||||||
return (locator->vbInterface && locator->saxreader->vbcontentHandler) ||
|
return (locator->vbInterface && locator->saxreader->vbcontentHandler) ||
|
||||||
|
@ -2616,12 +2627,15 @@ static HRESULT WINAPI saxxmlreader_Invoke(
|
||||||
/*** IVBSAXXMLReader methods ***/
|
/*** IVBSAXXMLReader methods ***/
|
||||||
static HRESULT WINAPI saxxmlreader_getFeature(
|
static HRESULT WINAPI saxxmlreader_getFeature(
|
||||||
IVBSAXXMLReader* iface,
|
IVBSAXXMLReader* iface,
|
||||||
const WCHAR *pFeature,
|
const WCHAR *feature,
|
||||||
VARIANT_BOOL *pValue)
|
VARIANT_BOOL *value)
|
||||||
{
|
{
|
||||||
saxreader *This = impl_from_IVBSAXXMLReader( iface );
|
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;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2652,6 +2666,9 @@ static HRESULT WINAPI saxxmlreader_putFeature(
|
||||||
return set_feature_value(This, ProhibitDTD, value);
|
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);
|
FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature), value);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -3043,7 +3060,7 @@ HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
||||||
reader->pool.pool = NULL;
|
reader->pool.pool = NULL;
|
||||||
reader->pool.index = 0;
|
reader->pool.index = 0;
|
||||||
reader->pool.len = 0;
|
reader->pool.len = 0;
|
||||||
reader->features = 0;
|
reader->features = Namespaces;
|
||||||
|
|
||||||
memset(&reader->sax, 0, sizeof(xmlSAXHandler));
|
memset(&reader->sax, 0, sizeof(xmlSAXHandler));
|
||||||
reader->sax.initialized = XML_SAX2_MAGIC;
|
reader->sax.initialized = XML_SAX2_MAGIC;
|
||||||
|
|
|
@ -1267,6 +1267,50 @@ static void test_saxreader_properties(void)
|
||||||
free_bstrs();
|
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 */
|
/* UTF-8 data with UTF-8 BOM and UTF-16 in prolog */
|
||||||
static const CHAR UTF8BOMTest[] =
|
static const CHAR UTF8BOMTest[] =
|
||||||
"\xEF\xBB\xBF<?xml version = \"1.0\" encoding = \"UTF-16\"?>\n"
|
"\xEF\xBB\xBF<?xml version = \"1.0\" encoding = \"UTF-16\"?>\n"
|
||||||
|
@ -2317,6 +2361,7 @@ START_TEST(saxreader)
|
||||||
|
|
||||||
test_saxreader();
|
test_saxreader();
|
||||||
test_saxreader_properties();
|
test_saxreader_properties();
|
||||||
|
test_saxreader_features();
|
||||||
test_encoding();
|
test_encoding();
|
||||||
|
|
||||||
/* MXXMLWriter tests */
|
/* MXXMLWriter tests */
|
||||||
|
|
Loading…
Reference in New Issue