msxml3: Add support for omitXMLDeclaration() property.
This commit is contained in:
parent
1831e54916
commit
020bf5a18e
|
@ -44,7 +44,8 @@ static const char crlfA[] = "\r\n";
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MXWriter_Standalone = 0,
|
MXWriter_OmitXmlDecl = 0,
|
||||||
|
MXWriter_Standalone,
|
||||||
MXWriter_LastProp
|
MXWriter_LastProp
|
||||||
} MXWRITER_PROPS;
|
} MXWRITER_PROPS;
|
||||||
|
|
||||||
|
@ -347,15 +348,24 @@ static HRESULT WINAPI mxwriter_get_standalone(IMXWriter *iface, VARIANT_BOOL *va
|
||||||
static HRESULT WINAPI mxwriter_put_omitXMLDeclaration(IMXWriter *iface, VARIANT_BOOL value)
|
static HRESULT WINAPI mxwriter_put_omitXMLDeclaration(IMXWriter *iface, VARIANT_BOOL value)
|
||||||
{
|
{
|
||||||
mxwriter *This = impl_from_IMXWriter( iface );
|
mxwriter *This = impl_from_IMXWriter( iface );
|
||||||
FIXME("(%p)->(%d)\n", This, value);
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%d)\n", This, value);
|
||||||
|
This->props[MXWriter_OmitXmlDecl] = value;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mxwriter_get_omitXMLDeclaration(IMXWriter *iface, VARIANT_BOOL *value)
|
static HRESULT WINAPI mxwriter_get_omitXMLDeclaration(IMXWriter *iface, VARIANT_BOOL *value)
|
||||||
{
|
{
|
||||||
mxwriter *This = impl_from_IMXWriter( iface );
|
mxwriter *This = impl_from_IMXWriter( iface );
|
||||||
FIXME("(%p)->(%p)\n", This, value);
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%p)\n", This, value);
|
||||||
|
|
||||||
|
if (!value) return E_POINTER;
|
||||||
|
|
||||||
|
*value = This->props[MXWriter_OmitXmlDecl];
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mxwriter_put_version(IMXWriter *iface, BSTR version)
|
static HRESULT WINAPI mxwriter_put_version(IMXWriter *iface, BSTR version)
|
||||||
|
@ -463,6 +473,8 @@ static HRESULT WINAPI mxwriter_saxcontent_startDocument(ISAXContentHandler *ifac
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
if (This->props[MXWriter_OmitXmlDecl] == VARIANT_TRUE) return S_OK;
|
||||||
|
|
||||||
/* version */
|
/* version */
|
||||||
xmlOutputBufferWriteString(This->buffer, "<?xml version=\"");
|
xmlOutputBufferWriteString(This->buffer, "<?xml version=\"");
|
||||||
s = xmlchar_from_wchar(This->version);
|
s = xmlchar_from_wchar(This->version);
|
||||||
|
@ -627,6 +639,7 @@ HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj)
|
||||||
This->ISAXContentHandler_iface.lpVtbl = &mxwriter_saxcontent_vtbl;
|
This->ISAXContentHandler_iface.lpVtbl = &mxwriter_saxcontent_vtbl;
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
|
|
||||||
|
This->props[MXWriter_OmitXmlDecl] = VARIANT_FALSE;
|
||||||
This->props[MXWriter_Standalone] = VARIANT_FALSE;
|
This->props[MXWriter_Standalone] = VARIANT_FALSE;
|
||||||
This->encoding = SysAllocString(utf16W);
|
This->encoding = SysAllocString(utf16W);
|
||||||
This->version = SysAllocString(version10W);
|
This->version = SysAllocString(version10W);
|
||||||
|
|
|
@ -731,6 +731,14 @@ static void test_mxwriter_properties(void)
|
||||||
&IID_IMXWriter, (void**)&writer);
|
&IID_IMXWriter, (void**)&writer);
|
||||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMXWriter_get_omitXMLDeclaration(writer, NULL);
|
||||||
|
ok(hr == E_POINTER, "got %08x\n", hr);
|
||||||
|
|
||||||
|
b = VARIANT_TRUE;
|
||||||
|
hr = IMXWriter_get_omitXMLDeclaration(writer, &b);
|
||||||
|
ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
ok(b == VARIANT_FALSE, "got %d\n", b);
|
||||||
|
|
||||||
hr = IMXWriter_get_standalone(writer, NULL);
|
hr = IMXWriter_get_standalone(writer, NULL);
|
||||||
ok(hr == E_POINTER, "got %08x\n", hr);
|
ok(hr == E_POINTER, "got %08x\n", hr);
|
||||||
|
|
||||||
|
@ -918,6 +926,34 @@ static void test_mxwriter_startenddocument(void)
|
||||||
|
|
||||||
ISAXContentHandler_Release(content);
|
ISAXContentHandler_Release(content);
|
||||||
IMXWriter_Release(writer);
|
IMXWriter_Release(writer);
|
||||||
|
|
||||||
|
/* now with omitted declaration */
|
||||||
|
hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IMXWriter, (void**)&writer);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&content);
|
||||||
|
ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE);
|
||||||
|
ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = ISAXContentHandler_startDocument(content);
|
||||||
|
ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
|
||||||
|
hr = ISAXContentHandler_endDocument(content);
|
||||||
|
todo_wine ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
|
||||||
|
V_VT(&dest) = VT_EMPTY;
|
||||||
|
hr = IMXWriter_get_output(writer, &dest);
|
||||||
|
ok(hr == S_OK, "got %08x\n", hr);
|
||||||
|
ok(V_VT(&dest) == VT_BSTR, "got %d\n", V_VT(&dest));
|
||||||
|
ok(!lstrcmpW(_bstr_(""), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
|
||||||
|
VariantClear(&dest);
|
||||||
|
|
||||||
|
ISAXContentHandler_Release(content);
|
||||||
|
IMXWriter_Release(writer);
|
||||||
|
|
||||||
free_bstrs();
|
free_bstrs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue