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

msxml3: Basic support for startElement()/endElement().

parent 34d86a2d
......@@ -541,9 +541,22 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement(
ISAXAttributes *attr)
{
mxwriter *This = impl_from_ISAXContentHandler( iface );
FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
xmlChar *s;
TRACE("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName), attr);
return E_NOTIMPL;
if (!namespaceUri || !local_name || !QName) return E_INVALIDARG;
if (attr) FIXME("attributes not handled\n");
xmlOutputBufferWriteString(This->buffer, "<");
s = xmlchar_from_wchar(QName);
xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s);
xmlOutputBufferWriteString(This->buffer, ">");
return S_OK;
}
static HRESULT WINAPI mxwriter_saxcontent_endElement(
......@@ -556,9 +569,20 @@ static HRESULT WINAPI mxwriter_saxcontent_endElement(
int nQName)
{
mxwriter *This = impl_from_ISAXContentHandler( iface );
FIXME("(%p)->(%s %s %s)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
xmlChar *s;
TRACE("(%p)->(%s %s %s)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName));
return E_NOTIMPL;
if (!namespaceUri || !local_name || !QName) return E_INVALIDARG;
xmlOutputBufferWriteString(This->buffer, "</");
s = xmlchar_from_wchar(QName);
xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s);
xmlOutputBufferWriteString(This->buffer, ">");
return S_OK;
}
static HRESULT WINAPI mxwriter_saxcontent_characters(
......
......@@ -980,56 +980,66 @@ static void test_mxwriter_startendelement(void)
/* qualified name without defined namespace */
hr = ISAXContentHandler_startElement(content, NULL, 0, NULL, 0, _bstr_("a:b"), 3, NULL);
todo_wine ok(hr == E_INVALIDARG, "got %08x\n", hr);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = ISAXContentHandler_startElement(content, NULL, 0, _bstr_("b"), 1, _bstr_("a:b"), 3, NULL);
todo_wine ok(hr == E_INVALIDARG, "got %08x\n", hr);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
/* only local name is an error too */
hr = ISAXContentHandler_startElement(content, NULL, 0, _bstr_("b"), 1, NULL, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "got %08x\n", hr);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
/* only local name is an error too */
hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_("b"), 1, NULL, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "got %08x\n", hr);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
/* all string pointers should be not null */
hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_("b"), 1, _bstr_(""), 0, NULL);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
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));
todo_wine ok(!lstrcmpW(_bstr_("<>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
ok(!lstrcmpW(_bstr_("<>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = ISAXContentHandler_startElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("b"), 1, NULL);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
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));
todo_wine ok(!lstrcmpW(_bstr_("<><b>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
ok(!lstrcmpW(_bstr_("<><b>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = ISAXContentHandler_endElement(content, NULL, 0, NULL, 0, _bstr_("a:b"), 3);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, NULL, 0, _bstr_("b"), 1, _bstr_("a:b"), 3);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
/* only local name is an error too */
hr = ISAXContentHandler_endElement(content, NULL, 0, _bstr_("b"), 1, NULL, 0);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("b"), 1);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
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));
todo_wine ok(!lstrcmpW(_bstr_("<><b></b>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
ok(!lstrcmpW(_bstr_("<><b></b>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
/* some with namespace URI */
hr = ISAXContentHandler_startElement(content, _bstr_(winehqA), sizeof(winehqA), _bstr_(""), 0, _bstr_("nspace:c"), 8, NULL);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
ok(hr == S_OK, "got %08x\n", hr);
hr = ISAXContentHandler_endElement(content, _bstr_(winehqA), sizeof(winehqA), _bstr_(""), 0, _bstr_("nspace:c"), 8);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
ok(hr == S_OK, "got %08x\n", hr);
V_VT(&dest) = VT_EMPTY;
hr = IMXWriter_get_output(writer, &dest);
......@@ -1038,6 +1048,17 @@ static void test_mxwriter_startendelement(void)
todo_wine ok(!lstrcmpW(_bstr_("<><b></b><nspace:c/>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
/* try to end element that wasn't open */
hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("a"), 1);
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));
todo_wine ok(!lstrcmpW(_bstr_("<><b></b><nspace:c/></a>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
hr = ISAXContentHandler_endDocument(content);
todo_wine ok(hr == S_OK, "got %08x\n", hr);
......
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