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

msxml3: Use provided qualified name length while writing end element tag.

parent cec8e0d7
......@@ -822,28 +822,28 @@ static HRESULT WINAPI mxwriter_saxcontent_endElement(
int nQName)
{
mxwriter *This = impl_from_ISAXContentHandler( iface );
xmlChar *s;
TRACE("(%p)->(%s %s %s)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName));
TRACE("(%p)->(%s:%d %s:%d %s:%d)\n", This, debugstr_wn(namespaceUri, nnamespaceUri), nnamespaceUri,
debugstr_wn(local_name, nlocal_name), nlocal_name, debugstr_wn(QName, nQName), nQName);
if ((!namespaceUri || !local_name || !QName) && This->class_version != MSXML6)
return E_INVALIDARG;
s = xmlchar_from_wchar(QName);
if (This->element && QName && !strcmpW(This->element, QName))
if (This->element && QName && !strncmpW(This->element, QName, nQName))
{
xmlOutputBufferWriteString(This->buffer, "/>");
}
else
{
xmlChar *s = xmlchar_from_wcharn(QName, nQName);
xmlOutputBufferWriteString(This->buffer, "</");
xmlOutputBufferWriteString(This->buffer, (char*)s);
xmlOutputBufferWriteString(This->buffer, ">");
heap_free(s);
}
heap_free(s);
set_element_name(This, NULL, 0);
return S_OK;
......
......@@ -2069,9 +2069,20 @@ static void test_mxwriter_startendelement(void)
ok(!lstrcmpW(_bstr_("<abc>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
ISAXContentHandler_endDocument(content);
IMXWriter_flush(writer);
hr = ISAXContentHandler_endElement(content, _bstr_(""), 0, _bstr_(""), 0, _bstr_("abdcdef"), 3);
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_("<abc></abd>"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
ISAXContentHandler_Release(content);
IMXWriter_Release(writer);
free_bstrs();
}
......
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