From 973f62f0e3d5afe2443a9631f0a0515ac5dddcf3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 1 Mar 2012 21:06:39 +0300 Subject: [PATCH] msxml3: Return default namespace uri for 'xml'-prefixed attributes. --- dlls/msxml3/saxreader.c | 8 +++++- dlls/msxml3/tests/saxreader.c | 53 +++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c index d80c256d1dc..b1508cae728 100644 --- a/dlls/msxml3/saxreader.c +++ b/dlls/msxml3/saxreader.c @@ -1135,8 +1135,14 @@ static HRESULT SAXAttributes_populate(saxlocator *locator, for(index=0; index" + " Some text data "; + static content_handler_test *expectCall; static ISAXLocator *locator; int msxml_version; @@ -266,8 +280,10 @@ static void test_saxstr(unsigned line, const WCHAR *szStr, int nStr, const char len = strlen(szTest); ok_(__FILE__,line) (len == nStr, "nStr = %d, expected %d (%s)\n", nStr, len, szTest); - if(len != nStr) + if(len != nStr) { + ok_(__FILE__,line)(0, "got string %s, expected %s\n", wine_dbgstr_wn(szStr, nStr), szTest); return; + } MultiByteToWideChar(CP_ACP, 0, szTest, -1, buf, sizeof(buf)/sizeof(WCHAR)); ok_(__FILE__,line) (!memcmp(szStr, buf, len*sizeof(WCHAR)), "unexpected szStr %s, expected %s\n", @@ -379,8 +395,13 @@ static HRESULT WINAPI contentHandler_endDocument( if(!test_expect_call(CH_ENDDOCUMENT)) return E_FAIL; - test_locator(__LINE__, msxml_version>=6 ? expectCall->line_v6 : expectCall->line, - msxml_version>=6 ? expectCall->column_v6 : expectCall->column); + if(expectCall == xmlspaceattr_test+5 && msxml_version>=6) { + todo_wine + test_locator(__LINE__, expectCall->line_v6, expectCall->column_v6); + } + else + test_locator(__LINE__, msxml_version>=6 ? expectCall->line_v6 : expectCall->line, + msxml_version>=6 ? expectCall->column_v6 : expectCall->column); return (expectCall++)->ret; } @@ -534,6 +555,24 @@ static HRESULT WINAPI contentHandler_startElement( test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "http://www.w3.org/2000/xmlns/"); test_saxstr(__LINE__, pLocalName, nLocalName, ""); test_saxstr(__LINE__, pQName, nQName, "xmlns"); + } else if(expectCall == xmlspaceattr_test+2) { + const WCHAR *value; + int valuelen; + + hres = ISAXAttributes_getLength(pAttr, &len); + EXPECT_HR(hres, S_OK); + ok(len == 1, "Incorrect number of attributes: %d\n", len); + + hres = ISAXAttributes_getName(pAttr, 0, &pNamespaceUri, &nNamespaceUri, + &pLocalName, &nLocalName, &pQName, &nQName); + EXPECT_HR(hres, S_OK); + test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "http://www.w3.org/XML/1998/namespace"); + test_saxstr(__LINE__, pLocalName, nLocalName, "space"); + test_saxstr(__LINE__, pQName, nQName, "xml:space"); + + hres = ISAXAttributes_getValue(pAttr, 0, &value, &valuelen); + EXPECT_HR(hres, S_OK); + test_saxstr(__LINE__, value, valuelen, "preserve"); } return (expectCall++)->ret; @@ -1426,8 +1465,16 @@ static void test_saxreader(int version) test_expect_call(CH_ENDTEST); IXMLDOMDocument_Release(domDocument); + expectCall = xmlspaceattr_test; + V_VT(&var) = VT_BSTR; + V_BSTR(&var) = _bstr_(xmlspace_attr); + hr = ISAXXMLReader_parse(reader, var); + EXPECT_HR(hr, S_OK); + test_expect_call(CH_ENDTEST); + ISAXXMLReader_Release(reader); SysFreeString(bstrData); + free_bstrs(); } struct saxreader_props_test_t