Commit acf6b4ee authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

webservices: Write empty prefix if "prefix" is NULL and "ns" is empty.

parent 53bf72e2
......@@ -538,6 +538,28 @@ static void test_WsWriteStartAttribute(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<p:str len=\"\" xmlns:p=\"ns\"/>", __LINE__ );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteStartElement( writer, &prefix, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteStartAttribute( writer, NULL, &localname2, &empty, FALSE, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndAttribute( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteStartAttribute( writer, NULL, &localname, &ns, FALSE, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndAttribute( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndElement( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<p:str len=\"\" p:str=\"\" xmlns:p=\"ns\"/>", __LINE__ );
WsFreeWriter( writer );
}
......
......@@ -521,12 +521,11 @@ static HRESULT write_attribute( struct writer *writer, WS_XML_ATTRIBUTE *attr )
{
WS_XML_UTF8_TEXT *text = (WS_XML_UTF8_TEXT *)attr->value;
unsigned char quote = attr->singleQuote ? '\'' : '"';
const WS_XML_STRING *prefix;
const WS_XML_STRING *prefix = NULL;
ULONG size;
HRESULT hr;
if (attr->prefix) prefix = attr->prefix;
else prefix = writer->current->hdr.prefix;
/* ' prefix:attr="value"' */
......@@ -930,7 +929,7 @@ static HRESULT write_add_attribute( struct writer *writer, const WS_XML_STRING *
if (!(attr = heap_alloc_zero( sizeof(*attr) ))) return E_OUTOFMEMORY;
if (!prefix) prefix = elem->prefix;
if (!prefix && ns->length > 0) prefix = elem->prefix;
attr->singleQuote = !!single;
if (prefix && !(attr->prefix = alloc_xml_string( prefix->bytes, prefix->length )))
......
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