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

xmllite: Implement GetNodeType() for reader.

parent d6937901
......@@ -87,6 +87,7 @@ typedef struct _xmlreader
xmlreaderinput *input;
IMalloc *imalloc;
XmlReadState state;
XmlNodeType nodetype;
DtdProcessing dtdmode;
UINT line, pos; /* reader position in XML stream */
} xmlreader;
......@@ -469,8 +470,10 @@ static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *node_type)
static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node_type)
{
FIXME("(%p %p): stub\n", iface, node_type);
return E_NOTIMPL;
xmlreader *This = impl_from_IXmlReader(iface);
TRACE("(%p)->(%p)\n", This, node_type);
*node_type = This->nodetype;
return This->state == XmlReadState_Closed ? S_FALSE : S_OK;
}
static HRESULT WINAPI xmlreader_MoveToFirstAttribute(IXmlReader* iface)
......@@ -725,6 +728,7 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
reader->line = reader->pos = 0;
reader->imalloc = imalloc;
if (imalloc) IMalloc_AddRef(imalloc);
reader->nodetype = XmlNodeType_None;
*obj = &reader->IXmlReader_iface;
......
......@@ -351,6 +351,7 @@ static void test_reader_create(void)
IXmlReader *reader;
IUnknown *input;
DtdProcessing dtd;
XmlNodeType nodetype;
/* crashes native */
if (0)
......@@ -364,6 +365,11 @@ static void test_reader_create(void)
test_read_state(reader, XmlReadState_Closed, -1, FALSE);
nodetype = XmlNodeType_Element;
hr = IXmlReader_GetNodeType(reader, &nodetype);
ok(hr == S_FALSE, "got %08x\n", hr);
ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
dtd = 2;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
......@@ -403,6 +409,7 @@ static void test_readerinput(void)
IXmlReader *reader, *reader2;
IUnknown *obj, *input;
IStream *stream, *stream2;
XmlNodeType nodetype;
HRESULT hr;
LONG ref;
......@@ -444,6 +451,11 @@ static void test_readerinput(void)
test_read_state(reader, XmlReadState_Initial, -1, FALSE);
nodetype = XmlNodeType_Element;
hr = IXmlReader_GetNodeType(reader, &nodetype);
ok(hr == S_OK, "got %08x\n", hr);
ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
/* IXmlReader grabs a IXmlReaderInput reference */
ref = IUnknown_AddRef(reader_input);
ok(ref == 3, "Expected 3, got %d\n", ref);
......
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