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

webservices: Move the reader to EOF at end of data in WsReadEndElement.

parent b7178446
......@@ -1194,6 +1194,16 @@ static HRESULT read_endelement( struct reader *reader )
WS_XML_STRING *prefix, *localname;
HRESULT hr;
if (reader->state == READER_STATE_EOF) return WS_E_INVALID_FORMAT;
if (read_end_of_data( reader ))
{
struct list *eof = list_tail( &reader->root->children );
reader->current = LIST_ENTRY( eof, struct node, entry );
reader->state = READER_STATE_EOF;
return S_OK;
}
if (read_cmp( reader, "</", 2 )) return WS_E_INVALID_FORMAT;
read_skip( reader, 2 );
......
......@@ -887,11 +887,11 @@ static void test_WsReadStartElement(void)
/* WsReadEndElement advances reader to EOF */
hr = WsReadEndElement( reader, NULL );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
todo_wine if (node) ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
hr = WsReadEndElement( reader, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
......@@ -904,6 +904,7 @@ static void test_WsReadEndElement(void)
HRESULT hr;
WS_XML_READER *reader;
const WS_XML_NODE *node;
int found;
hr = WsCreateReader( NULL, 0, &reader, NULL ) ;
ok( hr == S_OK, "got %08x\n", hr );
......@@ -976,11 +977,11 @@ static void test_WsReadEndElement(void)
/* WsReadEndElement advances reader to EOF */
hr = WsReadEndElement( reader, NULL );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
todo_wine if (node) ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
hr = WsReadEndElement( reader, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
......@@ -1009,6 +1010,79 @@ static void test_WsReadEndElement(void)
hr = WsReadEndElement( reader, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
hr = set_input( reader, "<a></a>", sizeof("<a></a>") - 1 );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsFillReader( reader, sizeof("<a></a>") - 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 );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", node->nodeType );
hr = WsReadEndElement( reader, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
hr = set_input( reader, "<a></a>", sizeof("<a></a>") - 1 );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsFillReader( reader, sizeof("<a></a>") - 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 );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", node->nodeType );
hr = WsReadStartElement( reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_END_ELEMENT, "got %u\n", node->nodeType );
hr = WsReadEndElement( reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_EOF, "got %u\n", node->nodeType );
hr = set_input( reader, "<a/>", sizeof("<a/>") - 1 );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsFillReader( reader, sizeof("<a/>") - 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 );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_ELEMENT, "got %u\n", node->nodeType );
hr = WsReadStartElement( reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetReaderNode( reader, &node, NULL );
ok( hr == S_OK, "got %08x\n", hr );
if (node) ok( node->nodeType == WS_XML_NODE_TYPE_END_ELEMENT, "got %u\n", node->nodeType );
hr = WsReadEndElement( reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
WsFreeReader( reader );
}
......@@ -2134,7 +2208,7 @@ static void test_WsGetNamespaceFromPrefix(void)
hr = WsReadStartElement( reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsReadEndElement( reader, NULL );
todo_wine ok( hr == S_OK, "got %08x\n", hr );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetNamespaceFromPrefix( reader, &prefix, TRUE, &ns, NULL );
todo_wine ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
......
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