Commit 9eee37f5 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Add a stub implementation of WsGetXmlAttribute.

parent ce71c50f
......@@ -565,6 +565,16 @@ HRESULT WINAPI WsGetReaderProperty( WS_XML_READER *handle, WS_XML_READER_PROPERT
return get_reader_prop( reader, id, buf, size );
}
/**************************************************************************
* WsGetXmlAttribute [webservices.@]
*/
HRESULT WINAPI WsGetXmlAttribute( WS_XML_READER *handle, const WS_XML_STRING *attr,
WS_HEAP *heap, WCHAR **str, ULONG *len, WS_ERROR *error )
{
FIXME( "%p %p %p %p %p %p: stub\n", handle, debugstr_xmlstr(attr), heap, str, len, error );
return E_NOTIMPL;
}
static WS_XML_STRING *alloc_xml_string( const char *data, ULONG len )
{
WS_XML_STRING *ret;
......
......@@ -58,6 +58,9 @@ static const char data7[] =
static const char data8[] =
"<node1><node2>test</node2></node1>";
static const char data9[] =
"<text xml:attr=\"value\">test</text>";
static void test_WsCreateError(void)
{
HRESULT hr;
......@@ -1286,6 +1289,62 @@ static void test_WsReadType(void)
WsFreeHeap( heap );
}
static void test_WsGetXmlAttribute(void)
{
static const WCHAR valueW[] = {'v','a','l','u','e',0};
HRESULT hr;
WS_XML_READER *reader;
WS_XML_STRING xmlstr;
WS_HEAP *heap;
WCHAR *str;
ULONG count;
int found;
hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsCreateReader( NULL, 0, &reader, NULL ) ;
ok( hr == S_OK, "got %08x\n", hr );
hr = set_input( reader, data9, sizeof(data9) - 1 );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsFillReader( reader, sizeof(data9) - 1, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
found = -1;
hr = WsReadToStartElement( reader, NULL, NULL, &found, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( found == TRUE, "got %d\n", found );
xmlstr.bytes = (BYTE *)"attr";
xmlstr.length = sizeof("attr") - 1;
xmlstr.dictionary = NULL;
xmlstr.id = 0;
str = NULL;
count = 0;
hr = WsGetXmlAttribute( reader, &xmlstr, heap, &str, &count, NULL );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
todo_wine ok( str != NULL, "str not set\n" );
todo_wine ok( count == 5, "got %u\n", count );
/* string is not null-terminated */
if (str) ok( !memcmp( str, valueW, count * sizeof(WCHAR) ), "wrong data\n" );
xmlstr.bytes = (BYTE *)"none";
xmlstr.length = sizeof("none") - 1;
xmlstr.dictionary = NULL;
xmlstr.id = 0;
str = (WCHAR *)0xdeadbeef;
count = 0xdeadbeef;
hr = WsGetXmlAttribute( reader, &xmlstr, heap, &str, &count, NULL );
todo_wine ok( hr == S_FALSE, "got %08x\n", hr );
todo_wine ok( str == NULL, "str not set\n" );
todo_wine ok( !count, "got %u\n", count );
WsFreeReader( reader );
WsFreeHeap( heap );
}
START_TEST(reader)
{
test_WsCreateError();
......@@ -1298,4 +1357,5 @@ START_TEST(reader)
test_WsReadEndElement();
test_WsReadNode();
test_WsReadType();
test_WsGetXmlAttribute();
}
......@@ -89,7 +89,7 @@
@ stub WsGetServiceProxyProperty
@ stub WsGetWriterPosition
@ stdcall WsGetWriterProperty(ptr long ptr long ptr)
@ stub WsGetXmlAttribute
@ stdcall WsGetXmlAttribute(ptr ptr ptr ptr ptr ptr)
@ stub WsInitializeMessage
@ stub WsMarkHeaderAsUnderstood
@ stub WsMatchPolicyAlternative
......
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