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