[PATCH 3/4] msxml3/saxreader: Allow setting default value for schema-validation feature

Nikolay Sivov nsivov at codeweavers.com
Mon Feb 26 16:16:40 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/msxml3/saxreader.c       | 13 ++++++++++---
 dlls/msxml3/tests/saxreader.c | 22 +++++++++++++++++++---
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index 2a30475e08..df721f9c62 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -104,6 +104,10 @@ static const WCHAR ExhaustiveErrorsW[] = {
     'e','x','h','a','u','s','t','i','v','e','-','e','r','r','o','r','s',0
 };
 
+static const WCHAR SchemaValidationW[] = {
+    's','c','h','e','m','a','-','v','a','l','i','d','a','t','i','o','n',0
+};
+
 struct saxreader_feature_pair
 {
     saxreader_feature feature;
@@ -117,7 +121,8 @@ static const struct saxreader_feature_pair saxreader_feature_map[] = {
     { LexicalHandlerParEntities, FeatureLexicalHandlerParEntitiesW },
     { NamespacePrefixes, FeatureNamespacePrefixesW },
     { Namespaces, FeatureNamespacesW },
-    { ProhibitDTD, FeatureProhibitDTDW }
+    { ProhibitDTD, FeatureProhibitDTDW },
+    { SchemaValidation, SchemaValidationW },
 };
 
 static saxreader_feature get_saxreader_feature(const WCHAR *name)
@@ -3222,12 +3227,13 @@ static HRESULT WINAPI isaxxmlreader_getFeature(
 
     feature = get_saxreader_feature(feature_name);
 
-    if (This->version < MSXML4 && feature == ExhaustiveErrors)
+    if (This->version < MSXML4 && (feature == ExhaustiveErrors || feature == SchemaValidation))
         return E_INVALIDARG;
 
     if (feature == Namespaces ||
             feature == NamespacePrefixes ||
-            feature == ExhaustiveErrors)
+            feature == ExhaustiveErrors ||
+            feature == SchemaValidation)
         return get_feature_value(This, feature, value);
 
     FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value);
@@ -3248,6 +3254,7 @@ static HRESULT WINAPI isaxxmlreader_putFeature(
 
     /* accepted cases */
     if ((feature == ExhaustiveErrors && value == VARIANT_FALSE) ||
+        (feature == SchemaValidation && value == VARIANT_FALSE) ||
          feature == Namespaces ||
          feature == NamespacePrefixes)
     {
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 29492fa1d8..3ed332edb6 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -2789,19 +2789,35 @@ static void test_saxreader_features(void)
             continue;
         }
 
-        value = VARIANT_TRUE;
-        hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value);
         if (IsEqualGUID(entry->guid, &CLSID_SAXXMLReader40) ||
                 IsEqualGUID(entry->guid, &CLSID_SAXXMLReader60))
         {
+            value = VARIANT_TRUE;
+            hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value);
             ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr);
             ok(value == VARIANT_FALSE, "Unexpected default feature value.\n");
+            hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE);
+            ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr);
 
+            value = VARIANT_TRUE;
+            hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value);
+            ok(hr == S_OK, "Failed to get feature value, hr %#x.\n", hr);
+            ok(value == VARIANT_FALSE, "Unexpected default feature value.\n");
             hr = ISAXXMLReader_putFeature(reader, _bstr_("exhaustive-errors"), VARIANT_FALSE);
             ok(hr == S_OK, "Failed to put feature value, hr %#x.\n", hr);
         }
         else
-            ok(hr == E_INVALIDARG, "Unexpected return value %#x.\n", hr);
+        {
+            value = 123;
+            hr = ISAXXMLReader_getFeature(reader, _bstr_("exhaustive-errors"), &value);
+            ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr);
+            ok(value == 123, "Unexpected value %d.\n", value);
+
+            value = 123;
+            hr = ISAXXMLReader_getFeature(reader, _bstr_("schema-validation"), &value);
+            ok(hr == E_INVALIDARG, "Failed to get feature value, hr %#x.\n", hr);
+            ok(value == 123, "Unexpected value %d.\n", value);
+        }
 
         name = feature_names;
         while (*name)
-- 
2.16.1




More information about the wine-devel mailing list