Commit ec0cae49 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Implement WsReadElement.

parent 524fa657
......@@ -3598,6 +3598,24 @@ HRESULT WINAPI WsReadType( WS_XML_READER *handle, WS_TYPE_MAPPING mapping, WS_TY
}
/**************************************************************************
* WsReadElement [webservices.@]
*/
HRESULT WINAPI WsReadElement( WS_XML_READER *handle, const WS_ELEMENT_DESCRIPTION *desc,
WS_READ_OPTION option, WS_HEAP *heap, void *value, ULONG size,
WS_ERROR *error )
{
struct reader *reader = (struct reader *)handle;
TRACE( "%p %p %u %p %p %u %p\n", handle, desc, option, heap, value, size, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!reader || !desc || !value) return E_INVALIDARG;
return read_type( reader, WS_ELEMENT_TYPE_MAPPING, desc->type, desc->elementLocalName,
desc->elementNs, desc->typeDescription, option, heap, value, size );
}
/**************************************************************************
* WsSetErrorProperty [webservices.@]
*/
HRESULT WINAPI WsSetErrorProperty( WS_ERROR *handle, WS_ERROR_PROPERTY_ID id, const void *value,
......
......@@ -3271,6 +3271,43 @@ static void test_double(void)
WsFreeHeap( heap );
}
static void test_WsReadElement(void)
{
WS_XML_STRING localname = {1, (BYTE *)"t"}, ns = {0, NULL};
HRESULT hr;
WS_XML_READER *reader;
WS_ELEMENT_DESCRIPTION desc;
UINT32 val;
hr = WsCreateReader( NULL, 0, &reader, NULL ) ;
ok( hr == S_OK, "got %08x\n", hr );
desc.elementLocalName = &localname;
desc.elementNs = &ns;
desc.type = WS_UINT32_TYPE;
desc.typeDescription = NULL;
prepare_struct_type_test( reader, "<t>1</t>" );
hr = WsReadElement( NULL, &desc, WS_READ_REQUIRED_VALUE, NULL, &val, sizeof(val), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
prepare_struct_type_test( reader, "<t>1</t>" );
hr = WsReadElement( reader, NULL, WS_READ_REQUIRED_VALUE, NULL, &val, sizeof(val), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
prepare_struct_type_test( reader, "<t>1</t>" );
hr = WsReadElement( reader, &desc, WS_READ_REQUIRED_VALUE, NULL, NULL, sizeof(val), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
prepare_struct_type_test( reader, "<t>1</t>" );
val = 0xdeadbeef;
hr = WsReadElement( reader, &desc, WS_READ_REQUIRED_VALUE, NULL, &val, sizeof(val), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( val == 1, "got %u\n", val );
WsFreeReader( reader );
}
START_TEST(reader)
{
test_WsCreateError();
......@@ -3300,4 +3337,5 @@ START_TEST(reader)
test_WsDateTimeToFileTime();
test_WsFileTimeToDateTime();
test_double();
test_WsReadElement();
}
......@@ -107,7 +107,7 @@
@ stub WsReadBytes
@ stub WsReadChars
@ stub WsReadCharsUtf8
@ stub WsReadElement
@ stdcall WsReadElement(ptr ptr long ptr ptr long ptr)
@ stdcall WsReadEndAttribute(ptr ptr)
@ stdcall WsReadEndElement(ptr ptr)
@ stub WsReadEndpointAddressExtension
......
......@@ -1069,6 +1069,8 @@ HRESULT WINAPI WsOpenServiceProxy(WS_SERVICE_PROXY*, const WS_ENDPOINT_ADDRESS*,
WS_ERROR*);
HRESULT WINAPI WsReadAttribute(WS_XML_READER*, const WS_ATTRIBUTE_DESCRIPTION*, WS_READ_OPTION,
WS_HEAP*, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsReadElement(WS_XML_READER*, const WS_ELEMENT_DESCRIPTION*, WS_READ_OPTION,
WS_HEAP*, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsReadEndAttribute(WS_XML_READER*, WS_ERROR*);
HRESULT WINAPI WsReadEndElement(WS_XML_READER*, WS_ERROR*);
HRESULT WINAPI WsReadNode(WS_XML_READER*, WS_ERROR*);
......@@ -1078,6 +1080,7 @@ HRESULT WINAPI WsReadToStartElement(WS_XML_READER*, const WS_XML_STRING*, const
BOOL*, WS_ERROR*);
HRESULT WINAPI WsReadType(WS_XML_READER*, WS_TYPE_MAPPING, WS_TYPE, const void*, WS_READ_OPTION,
WS_HEAP*, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsReadValue(WS_XML_READER*, WS_VALUE_TYPE, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsResetHeap(WS_HEAP*, WS_ERROR*);
HRESULT WINAPI WsSendMessage(WS_CHANNEL*, WS_MESSAGE*, const WS_MESSAGE_DESCRIPTION*, WS_WRITE_OPTION,
const void*, ULONG, const WS_ASYNC_CONTEXT*, WS_ERROR*);
......
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