Commit d20e4877 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Initial implementation of attributeDecl() in writer.

parent 7c9a1b52
......@@ -1481,10 +1481,40 @@ static HRESULT WINAPI SAXDeclHandler_attributeDecl(ISAXDeclHandler *iface,
const WCHAR *value, int n_value)
{
mxwriter *This = impl_from_ISAXDeclHandler( iface );
FIXME("(%p)->(%s:%d %s:%d %s:%d %s:%d %s:%d): stub\n", This, debugstr_wn(element, n_element), n_element,
static const WCHAR attlistW[] = {'<','!','A','T','T','L','I','S','T',' '};
static const WCHAR closeelementW[] = {'>','\r','\n'};
TRACE("(%p)->(%s:%d %s:%d %s:%d %s:%d %s:%d)\n", This, debugstr_wn(element, n_element), n_element,
debugstr_wn(attr, n_attr), n_attr, debugstr_wn(type, n_type), n_type, debugstr_wn(Default, n_default), n_default,
debugstr_wn(value, n_value), n_value);
return E_NOTIMPL;
write_output_buffer(This->buffer, attlistW, sizeof(attlistW)/sizeof(WCHAR));
if (n_element) {
write_output_buffer(This->buffer, element, n_element);
write_output_buffer(This->buffer, spaceW, sizeof(spaceW)/sizeof(WCHAR));
}
if (n_attr) {
write_output_buffer(This->buffer, attr, n_attr);
write_output_buffer(This->buffer, spaceW, sizeof(spaceW)/sizeof(WCHAR));
}
if (n_type) {
write_output_buffer(This->buffer, type, n_type);
write_output_buffer(This->buffer, spaceW, sizeof(spaceW)/sizeof(WCHAR));
}
if (n_default) {
write_output_buffer(This->buffer, Default, n_default);
write_output_buffer(This->buffer, spaceW, sizeof(spaceW)/sizeof(WCHAR));
}
if (n_value)
write_output_buffer_quoted(This->buffer, value, n_value);
write_output_buffer(This->buffer, closeelementW, sizeof(closeelementW)/sizeof(WCHAR));
return S_OK;
}
static HRESULT WINAPI SAXDeclHandler_internalEntityDecl(ISAXDeclHandler *iface,
......
......@@ -4450,6 +4450,44 @@ static void test_mxwriter_dtd(void)
V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
/* attribute declaration */
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK);
hr = ISAXDeclHandler_attributeDecl(decl, _bstr_("element"), strlen("element"),
_bstr_("attribute"), strlen("attribute"), _bstr_("CDATA"), strlen("CDATA"),
_bstr_("#REQUIRED"), strlen("#REQUIRED"), _bstr_("value"), strlen("value"));
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_("<!ATTLIST element attribute CDATA #REQUIRED \"value\">\r\n"),
V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = ISAXDeclHandler_attributeDecl(decl, _bstr_("element"), strlen("element"),
_bstr_("attribute2"), strlen("attribute2"), _bstr_("CDATA"), strlen("CDATA"),
_bstr_("#REQUIRED"), strlen("#REQUIRED"), _bstr_("value2"), strlen("value2"));
EXPECT_HR(hr, S_OK);
hr = ISAXDeclHandler_attributeDecl(decl, _bstr_("element2"), strlen("element2"),
_bstr_("attribute3"), strlen("attribute3"), _bstr_("CDATA"), strlen("CDATA"),
_bstr_("#REQUIRED"), strlen("#REQUIRED"), _bstr_("value3"), strlen("value3"));
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_("<!ATTLIST element attribute CDATA #REQUIRED \"value\">\r\n"
"<!ATTLIST element attribute2 CDATA #REQUIRED \"value2\">\r\n"
"<!ATTLIST element2 attribute3 CDATA #REQUIRED \"value3\">\r\n"),
V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
ISAXContentHandler_Release(content);
ISAXLexicalHandler_Release(lexical);
ISAXDeclHandler_Release(decl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment