diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 070dff422c..12672a52a3 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -58,10 +58,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml); #define XML_SAVE_AS_XML 32 #define XML_SAVE_AS_HTML 64 -static const WCHAR SZ_PROPERTY_SELECTION_LANGUAGE[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0}; -static const WCHAR SZ_PROPERTY_PROHIBIT_DTD[] = {'P','r','o','h','i','b','i','t','D','T','D',0}; -static const WCHAR SZ_VALUE_XPATH[] = {'X','P','a','t','h',0}; -static const WCHAR SZ_VALUE_XSLPATTERN[] = {'X','S','L','P','a','t','t','e','r','n',0}; +static const WCHAR PropertySelectionLanguageW[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0}; +static const WCHAR PropertySelectionNamespacesW[] = {'S','e','l','e','c','t','i','o','n','N','a','m','e','s','p','a','c','e','s',0}; +static const WCHAR PropertyProhibitDTDW[] = {'P','r','o','h','i','b','i','t','D','T','D',0}; +static const WCHAR PropValueXPathW[] = {'X','P','a','t','h',0}; +static const WCHAR PropValueXSLPatternW[] = {'X','S','L','P','a','t','t','e','r','n',0}; typedef struct _domdoc { @@ -1736,9 +1737,9 @@ static HRESULT WINAPI domdoc_loadXML( { domdoc *This = impl_from_IXMLDOMDocument3( iface ); xmlDocPtr xmldoc = NULL; + HRESULT hr = S_FALSE, hr2; char *str; int len; - HRESULT hr = S_FALSE, hr2; TRACE("(%p)->(%s %p)\n", This, debugstr_w( bstrXML ), isSuccessful ); @@ -1758,6 +1759,7 @@ static HRESULT WINAPI domdoc_loadXML( { hr = This->error = S_OK; *isSuccessful = VARIANT_TRUE; + TRACE("parsed document %p\n", xmldoc); } } } @@ -2043,7 +2045,7 @@ static HRESULT WINAPI domdoc_setProperty( TRACE("(%p)->(%s)\n", This, debugstr_w(p)); - if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0) + if (lstrcmpiW(p, PropertySelectionLanguageW) == 0) { VARIANT varStr; HRESULT hr; @@ -2060,9 +2062,9 @@ static HRESULT WINAPI domdoc_setProperty( bstr = V_BSTR(&var); hr = S_OK; - if (lstrcmpiW(bstr, SZ_VALUE_XPATH) == 0) + if (lstrcmpiW(bstr, PropValueXPathW) == 0) This->bUseXPath = TRUE; - else if (lstrcmpiW(bstr, SZ_VALUE_XSLPATTERN) == 0) + else if (lstrcmpiW(bstr, PropValueXSLPatternW) == 0) This->bUseXPath = FALSE; else hr = E_FAIL; @@ -2070,12 +2072,18 @@ static HRESULT WINAPI domdoc_setProperty( VariantClear(&varStr); return hr; } - else if (lstrcmpiW(p, SZ_PROPERTY_PROHIBIT_DTD) == 0) + else if (lstrcmpiW(p, PropertyProhibitDTDW) == 0) { /* Ignore */ FIXME("Ignoring property ProhibitDTD, value %d\n", V_BOOL(&var)); return S_OK; } + else if (lstrcmpiW(p, PropertySelectionNamespacesW) == 0) + { + if (V_VT(&var) == VT_BSTR) + FIXME("Unsupported SelectionNamespaces: %s\n", wine_dbgstr_w(V_BSTR(&var))); + return E_FAIL; + } FIXME("Unknown property %s\n", wine_dbgstr_w(p)); return E_FAIL; @@ -2092,13 +2100,14 @@ static HRESULT WINAPI domdoc_getProperty( if (var == NULL) return E_INVALIDARG; - if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0) + + if (lstrcmpiW(p, PropertySelectionLanguageW) == 0) { V_VT(var) = VT_BSTR; if (This->bUseXPath) - V_BSTR(var) = SysAllocString(SZ_VALUE_XPATH); + V_BSTR(var) = SysAllocString(PropValueXPathW); else - V_BSTR(var) = SysAllocString(SZ_VALUE_XSLPATTERN); + V_BSTR(var) = SysAllocString(PropValueXSLPatternW); return S_OK; } diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 5dd0ec67c5..7104afb28e 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -2868,14 +2868,15 @@ static void test_XMLHTTP(void) static void test_IXMLDOMDocument2(void) { - HRESULT r; - VARIANT_BOOL b; - BSTR str; - IXMLDOMDocument *doc; + static const WCHAR emptyW[] = {0}; IXMLDOMDocument2 *doc2; + IXMLDOMDocument *doc; IDispatchEx *dispex; + VARIANT_BOOL b; VARIANT var; - int ref; + HRESULT r; + LONG ref; + BSTR str; r = CoCreateInstance( &CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc ); @@ -2928,6 +2929,17 @@ static void test_IXMLDOMDocument2(void) ole_check(IXMLDOMDocument2_setProperty(doc2, _bstr_("SelectionLanguage"), _variantbstr_("XPath"))); ole_check(IXMLDOMDocument2_setProperty(doc2, _bstr_("SelectionLanguage"), _variantbstr_("XSLPattern"))); + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = SysAllocString(emptyW); + r = IXMLDOMDocument2_setProperty(doc2, _bstr_("SelectionNamespaces"), var); + todo_wine ok(r == S_OK, "got 0x%08x\n", r); + VariantClear(&var); + + V_VT(&var) = VT_I2; + V_I2(&var) = 0; + r = IXMLDOMDocument2_setProperty(doc2, _bstr_("SelectionNamespaces"), var); + ok(r == E_FAIL, "got 0x%08x\n", r); + /* contrary to what MSDN claims you can switch back from XPath to XSLPattern */ ole_check(IXMLDOMDocument2_getProperty(doc2, _bstr_("SelectionLanguage"), &var)); expect_eq(V_VT(&var), VT_BSTR, int, "%x");