[2/2] msxml3: Support ignorable whitespaces output in writer

Nikolay Sivov nsivov at codeweavers.com
Mon Mar 26 07:09:03 CDT 2012


Support ignorable whitespaces output in writer
-------------- next part --------------
>From db1d03bb470e410d56e7ddf3fbf776e991bd8db9 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat, 17 Mar 2012 10:41:43 +0300
Subject: [PATCH 2/3] Support ignorable whitespaces output in writer

---
 dlls/msxml3/mxwriter.c        |   10 ++++++++--
 dlls/msxml3/tests/saxreader.c |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index 2534555..41979e6 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1131,8 +1131,14 @@ static HRESULT WINAPI SAXContentHandler_ignorableWhitespace(
     int nchars)
 {
     mxwriter *This = impl_from_ISAXContentHandler( iface );
-    FIXME("(%p)->(%s)\n", This, debugstr_wn(chars, nchars));
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_wn(chars, nchars));
+
+    if (!chars) return E_INVALIDARG;
+
+    write_output_buffer(This->buffer, chars, nchars);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI SAXContentHandler_processingInstruction(
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index c1a3260..72aed37 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -3182,6 +3182,45 @@ static void test_mxwriter_pi(void)
     ok(!lstrcmpW(_bstr_("<?target?>\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
     VariantClear(&dest);
 
+
+    ISAXContentHandler_Release(content);
+    IMXWriter_Release(writer);
+}
+
+static void test_mxwriter_ignorablespaces(void)
+{
+    static const WCHAR dataW[] = {'d','a','t','a',0};
+    ISAXContentHandler *content;
+    IMXWriter *writer;
+    VARIANT dest;
+    HRESULT hr;
+
+    hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IMXWriter, (void**)&writer);
+    EXPECT_HR(hr, S_OK);
+
+    hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
+    EXPECT_HR(hr, S_OK);
+
+    hr = ISAXContentHandler_ignorableWhitespace(content, NULL, 0);
+    EXPECT_HR(hr, E_INVALIDARG);
+
+    hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 0);
+    EXPECT_HR(hr, S_OK);
+
+    hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 4);
+    EXPECT_HR(hr, S_OK);
+
+    hr = ISAXContentHandler_ignorableWhitespace(content, dataW, 1);
+    EXPECT_HR(hr, S_OK);
+
+    V_VT(&dest) = VT_EMPTY;
+    hr = IMXWriter_get_output(writer, &dest);
+    EXPECT_HR(hr, S_OK);
+    ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
+    ok(!lstrcmpW(_bstr_("datad"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
+    VariantClear(&dest);
+
     ISAXContentHandler_Release(content);
     IMXWriter_Release(writer);
 }
@@ -3717,6 +3756,7 @@ START_TEST(saxreader)
         test_mxwriter_comment();
         test_mxwriter_cdata();
         test_mxwriter_pi();
+        test_mxwriter_ignorablespaces();
         test_mxwriter_dtd();
         test_mxwriter_properties();
         test_mxwriter_flush();
-- 
1.5.6.5




More information about the wine-patches mailing list