Commit c085b8d9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite: Support comment nodes.

parent 61483a58
......@@ -777,8 +777,35 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader)
/* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' */
static HRESULT reader_parse_comment(xmlreader *reader)
{
FIXME("comments not supported\n");
return E_NOTIMPL;
const WCHAR *start, *ptr;
/* skip '<!--' */
reader_skipn(reader, 4);
ptr = start = reader_get_cur(reader);
while (*ptr)
{
if (ptr[0] == '-' && ptr[1] == '-')
{
if (ptr[2] == '>')
{
TRACE("%s\n", debugstr_wn(start, ptr-start));
/* skip '-->' */
reader_skipn(reader, 3);
reader->nodetype = XmlNodeType_Comment;
return S_OK;
}
else
return WC_E_COMMENT;
}
else
{
reader_skipn(reader, 1);
ptr = reader_get_cur(reader);
}
}
return MX_E_INPUTEND;
}
/* [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' */
......@@ -1014,7 +1041,7 @@ static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *nodetype)
XmlNodeType oldtype = This->nodetype;
HRESULT hr;
FIXME("(%p)->(%p): stub\n", This, nodetype);
TRACE("(%p)->(%p)\n", This, nodetype);
if (This->state == XmlReadState_Closed) return S_FALSE;
......
......@@ -721,10 +721,9 @@ static void test_read_comment(void)
type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(type == XmlNodeType_Comment, "got %d\n", type);
}
IStream_Release(stream);
stream = create_stream_on_data(xml_comment1, sizeof(xml_comment1));
......@@ -733,10 +732,9 @@ todo_wine {
type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type);
todo_wine {
ok(hr == S_OK, "got %08x\n", hr);
ok(type == XmlNodeType_Comment, "got %d\n", type);
}
IStream_Release(stream);
stream = create_stream_on_data(xml_comment2, sizeof(xml_comment2));
......@@ -745,7 +743,6 @@ todo_wine {
type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type);
todo_wine
ok(hr == WC_E_COMMENT || broken(hr == WC_E_GREATERTHAN), "got %08x\n", hr);
ok(type == XmlNodeType_None, "got %d\n", type);
IStream_Release(stream);
......
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