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

This commit is contained in:
Nikolay Sivov 2011-10-05 16:04:04 -05:00 committed by Alexandre Julliard
parent cec8e0d73a
commit 54326116da
2 changed files with 19 additions and 8 deletions

View File

@ -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;

View File

@ -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();
}