ReactOS 0.4.17-dev-966-gf06eace
reader.c
Go to the documentation of this file.
1/*
2 * IXmlReader tests
3 *
4 * Copyright 2010, 2012-2013, 2016-2017 Nikolay Sivov
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#define CONST_VTABLE
23
24#include <stdarg.h>
25#include <stdio.h>
26
27#include "windef.h"
28#include "winbase.h"
29#include "initguid.h"
30#include "ole2.h"
31#include "xmllite.h"
32#include "wine/test.h"
33
34DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
35
36static const char xmldecl_full[] = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
37static const char xmldecl_short[] = "<?xml version=\"1.0\"?><RegistrationInfo/>";
38
39static IStream *create_stream_on_data(const void *data, unsigned int size)
40{
42 HGLOBAL hglobal;
43 void *ptr;
44 HRESULT hr;
45
46 hglobal = GlobalAlloc(GHND, size);
47 ptr = GlobalLock(hglobal);
48
50
51 hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
52 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
53 ok(stream != NULL, "Expected non-NULL stream\n");
54
55 GlobalUnlock(hglobal);
56
57 return stream;
58}
59
60static void test_reader_pos(IXmlReader *reader, UINT line, UINT pos, UINT line_broken,
61 UINT pos_broken, int _line_)
62{
63 UINT l = ~0u, p = ~0u;
64 BOOL broken_state;
65
66 IXmlReader_GetLineNumber(reader, &l);
67 IXmlReader_GetLinePosition(reader, &p);
68
69 if (line_broken == ~0u && pos_broken == ~0u)
70 broken_state = FALSE;
71 else
72 broken_state = broken((line_broken == ~0u ? line : line_broken) == l &&
73 (pos_broken == ~0u ? pos : pos_broken) == p);
74
75 ok_(__FILE__, _line_)((l == line && pos == p) || broken_state,
76 "Expected (%d,%d), got (%d,%d)\n", line, pos, l, p);
77}
78#define TEST_READER_POSITION(reader, line, pos) \
79 test_reader_pos(reader, line, pos, ~0u, ~0u, __LINE__)
80#define TEST_READER_POSITION2(reader, line, pos, line_broken, pos_broken) \
81 test_reader_pos(reader, line, pos, line_broken, pos_broken, __LINE__)
82
83typedef struct input_iids_t {
84 IID iids[10];
85 int count;
87
88static const IID *setinput_full[] = {
89 &IID_IXmlReaderInput,
90 &IID_IStream,
91 &IID_ISequentialStream,
92 NULL
93};
94
95/* this applies to early xmllite versions */
96static const IID *setinput_full_old[] = {
97 &IID_IXmlReaderInput,
98 &IID_ISequentialStream,
99 &IID_IStream,
100 NULL
101};
102
103/* after ::SetInput(IXmlReaderInput*) */
104static const IID *setinput_readerinput[] = {
105 &IID_IStream,
106 &IID_ISequentialStream,
107 NULL
108};
109
110static const IID *empty_seq[] = {
111 NULL
112};
113
115
116static void ok_iids_(const input_iids_t *iids, const IID **expected, const IID **exp_broken, BOOL todo, int line)
117{
118 int i = 0, size = 0;
119
120 while (expected[i++]) size++;
121
123 ok_(__FILE__, line)(iids->count == size, "Sequence size mismatch (%d), got (%d)\n", size, iids->count);
124
125 if (iids->count != size) return;
126
127 for (i = 0; i < size; i++) {
128 ok_(__FILE__, line)(IsEqualGUID(&iids->iids[i], expected[i]) ||
129 (exp_broken ? broken(IsEqualGUID(&iids->iids[i], exp_broken[i])) : FALSE),
130 "Wrong IID(%d), got %s\n", i, wine_dbgstr_guid(&iids->iids[i]));
131 }
132}
133#define ok_iids(got, exp, brk, todo) ok_iids_(got, exp, brk, todo, __LINE__)
134
135static const char *state_to_str(XmlReadState state)
136{
137 static const char* state_names[] = {
138 "XmlReadState_Initial",
139 "XmlReadState_Interactive",
140 "XmlReadState_Error",
141 "XmlReadState_EndOfFile",
142 "XmlReadState_Closed"
143 };
144
145 static const char unknown[] = "unknown";
146
147 switch (state)
148 {
154 return state_names[state];
155 default:
156 return unknown;
157 }
158}
159
160static const char *type_to_str(XmlNodeType type)
161{
162 static const char* type_names[] = {
163 "XmlNodeType_None",
164 "XmlNodeType_Element",
165 "XmlNodeType_Attribute",
166 "XmlNodeType_Text",
167 "XmlNodeType_CDATA",
168 "", "",
169 "XmlNodeType_ProcessingInstruction",
170 "XmlNodeType_Comment",
171 "",
172 "XmlNodeType_DocumentType",
173 "", "",
174 "XmlNodeType_Whitespace",
175 "",
176 "XmlNodeType_EndElement",
177 "",
178 "XmlNodeType_XmlDeclaration"
179 };
180
181 static const char unknown[] = "unknown";
182
183 switch (type)
184 {
185 case XmlNodeType_None:
188 case XmlNodeType_Text:
196 return type_names[type];
197 default:
198 return unknown;
199 }
200}
201
202#define set_input_string(a,b) _set_input_string(__LINE__,a,b);
203static void _set_input_string(unsigned line, IXmlReader *reader, const char *xml)
204{
206 HRESULT hr;
207
209
210 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
211 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
212
213 IStream_Release(stream);
214}
215
216#define read_node(a,b) _read_node(__LINE__,a,b)
217static void _read_node(unsigned line, IXmlReader *reader, XmlNodeType expected_type)
218{
220 HRESULT hr;
221
222 hr = IXmlReader_Read(reader, &type);
223 if (expected_type == XmlNodeType_None)
224 ok_(__FILE__,line)(hr == S_FALSE, "Read returned %#lx, expected S_FALSE.\n", hr);
225 else
226 ok_(__FILE__,line)(hr == S_OK, "Read returned %#lx.\n", hr);
227 ok_(__FILE__,line)(type == expected_type, "read type %d, expected %d\n", type, expected_type);
228}
229
230#define next_attribute(a) _next_attribute(__LINE__,a)
231static void _next_attribute(unsigned line, IXmlReader *reader)
232{
233 HRESULT hr;
234 hr = IXmlReader_MoveToNextAttribute(reader);
235 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
236}
237
238#define move_to_element(a) _move_to_element(__LINE__,a)
239static void _move_to_element(unsigned line, IXmlReader *reader)
240{
241 HRESULT hr;
242 hr = IXmlReader_MoveToElement(reader);
243 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
244}
245
247 XmlReadState exp_broken, int line)
248{
249 BOOL broken_state;
251
252 state = -1; /* invalid state value */
253 IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
254
255 if (exp_broken == expected)
256 broken_state = FALSE;
257 else
258 broken_state = broken(exp_broken == state);
259
260 ok_(__FILE__, line)(state == expected || broken_state, "Expected (%s), got (%s)\n",
262}
263
264#define TEST_READER_STATE(reader, state) test_read_state(reader, state, state, __LINE__)
265#define TEST_READER_STATE2(reader, state, brk) test_read_state(reader, state, brk, __LINE__)
266
267#define reader_value(a,b) _reader_value(__LINE__,a,b)
268static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR *expect)
269{
270 const WCHAR *str = (void*)0xdeadbeef;
271 UINT len = 0xdeadbeef;
272 HRESULT hr;
273
274 hr = IXmlReader_GetValue(reader, &str, &len);
275 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
276 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
277 ok_(__FILE__,line)(!lstrcmpW(str, expect), "value = %s\n", wine_dbgstr_w(str));
278 return str;
279}
280
281#define reader_name(a,b) _reader_name(__LINE__,a,b)
282static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR *expect)
283{
284 const WCHAR *str = (void*)0xdeadbeef;
285 UINT len = 0xdeadbeef;
286 HRESULT hr;
287
288 hr = IXmlReader_GetLocalName(reader, &str, &len);
289 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
290 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
291 ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str));
292 return str;
293}
294
295#define reader_prefix(a,b) _reader_prefix(__LINE__,a,b)
296static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHAR *expect)
297{
298 const WCHAR *str = (void*)0xdeadbeef;
299 UINT len = 0xdeadbeef;
300 HRESULT hr;
301
302 hr = IXmlReader_GetPrefix(reader, &str, &len);
303 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
304 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
305 ok_(__FILE__,line)(!lstrcmpW(str, expect), "prefix = %s\n", wine_dbgstr_w(str));
306 return str;
307}
308
309#define reader_namespace(a,b) _reader_namespace(__LINE__,a,b)
310static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const WCHAR *expect)
311{
312 const WCHAR *str = (void*)0xdeadbeef;
313 UINT len = 0xdeadbeef;
314 HRESULT hr;
315
316 hr = IXmlReader_GetNamespaceUri(reader, &str, &len);
317 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
318 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
319 ok_(__FILE__,line)(!lstrcmpW(str, expect), "namespace = %s\n", wine_dbgstr_w(str));
320 return str;
321}
322
323#define reader_qname(a,b) _reader_qname(a,b,__LINE__)
324static const WCHAR *_reader_qname(IXmlReader *reader, const WCHAR *expect, unsigned line)
325{
326 const WCHAR *str = (void*)0xdeadbeef;
327 UINT len = 0xdeadbeef;
328 HRESULT hr;
329
330 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
331 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
332 ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
333 ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str));
334 return str;
335}
336
337#define read_value_char(a,b) _read_value_char(a,b,__LINE__)
338static void _read_value_char(IXmlReader *reader, WCHAR expected_char, unsigned line)
339{
340 WCHAR c = 0xffff;
341 UINT count = 0;
342 HRESULT hr;
343
344 hr = IXmlReader_ReadValueChunk(reader, &c, 1, &count);
345 ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
346 ok_(__FILE__,line)(count == 1, "got %u\n", c);
347 ok_(__FILE__,line)(c == expected_char, "got %x\n", c);
348}
349
350typedef struct _testinput
351{
355
357{
358 return CONTAINING_RECORD(iface, testinput, IUnknown_iface);
359}
360
362{
364 {
365 *ppvObj = iface;
366 IUnknown_AddRef(iface);
367 return S_OK;
368 }
369
371
372 *ppvObj = NULL;
373
374 return E_NOINTERFACE;
375}
376
378{
380 return InterlockedIncrement(&This->ref);
381}
382
384{
386 LONG ref;
387
389 if (ref == 0)
390 free(input);
391
392 return ref;
393}
394
395static const struct IUnknownVtbl testinput_vtbl =
396{
400};
401
403{
405
406 input = malloc(sizeof(*input));
407 if(!input) return E_OUTOFMEMORY;
408
409 input->IUnknown_iface.lpVtbl = &testinput_vtbl;
410 input->ref = 1;
411
412 *ppObj = &input->IUnknown_iface;
413
414 return S_OK;
415}
416
418{
419 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ISequentialStream))
420 {
421 *obj = iface;
422 return S_OK;
423 }
424
425 *obj = NULL;
426 return E_NOINTERFACE;
427}
428
430{
431 return 2;
432}
433
435{
436 return 1;
437}
438
440
442{
443 static const char xml[] = "<!-- comment -->";
444
445 if (stream_readcall++)
446 {
447 *pread = 0;
448 return E_PENDING;
449 }
450
451 *pread = sizeof(xml) / 2;
452 memcpy(pv, xml, *pread);
453 return S_OK;
454}
455
456static HRESULT WINAPI teststream_Write(ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written)
457{
458 ok(0, "unexpected call\n");
459 return E_NOTIMPL;
460}
461
462static const ISequentialStreamVtbl teststreamvtbl =
463{
469};
470
472{
473 ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
474
475 if (IsEqualIID(riid, &IID_IXmlResolver) || IsEqualIID(riid, &IID_IUnknown))
476 {
477 *obj = iface;
478 IXmlResolver_AddRef(iface);
479 return S_OK;
480 }
481
482 *obj = NULL;
483 return E_NOINTERFACE;
484}
485
487{
488 return 2;
489}
490
492{
493 return 1;
494}
495
496static HRESULT WINAPI resolver_ResolveUri(IXmlResolver *iface, const WCHAR *base_uri,
497 const WCHAR *public_id, const WCHAR *system_id, IUnknown **input)
498{
499 ok(0, "unexpected call\n");
500 return E_NOTIMPL;
501}
502
503static const IXmlResolverVtbl resolvervtbl =
504{
509};
510
512
513static void test_reader_create(void)
514{
515 IXmlResolver *resolver;
516 IUnknown *input, *unk;
518 LONG_PTR dtd;
519 XmlNodeType nodetype;
520 HRESULT hr;
521
522 /* crashes native */
523 if (0)
524 {
525 CreateXmlReader(&IID_IXmlReader, NULL, NULL);
526 CreateXmlReader(NULL, (void**)&reader, NULL);
527 }
528
529 hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL);
530 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
531
532 hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL);
533 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
534 hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader);
535 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
536 ok(unk == (IUnknown *)reader, "unexpected interface\n");
537 IXmlReader_Release(reader);
538 IUnknown_Release(unk);
539
540 hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL);
541 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
542 IXmlReader_Release(reader);
543
544 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
545 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
546
548
549 nodetype = XmlNodeType_Element;
550 hr = IXmlReader_GetNodeType(reader, &nodetype);
551 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
552 ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
553
554 /* crashes on XP, 2k3, works on newer versions */
555 if (0)
556 {
557 hr = IXmlReader_GetNodeType(reader, NULL);
558 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
559 }
560
561 resolver = (void*)0xdeadbeef;
562 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
563 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
564 ok(resolver == NULL, "got %p\n", resolver);
565
566 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
567 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
568
569 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR)&testresolver);
570 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
571
572 resolver = NULL;
573 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
574 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
575 ok(resolver == &testresolver, "got %p\n", resolver);
576 IXmlResolver_Release(resolver);
577
578 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
579 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
580
581 dtd = -1;
582 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, &dtd);
583 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
584 ok(dtd == DtdProcessing_Prohibit, "got %Id\n", dtd);
585
586 dtd = 2;
587 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, dtd);
588 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
589
590 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, -1);
591 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
592
593 /* Null input pointer, releases previous input */
594 hr = IXmlReader_SetInput(reader, NULL);
595 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
596
598
599 /* test input interface selection sequence */
601 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
602
603 if (hr == S_OK)
604 {
605 input_iids.count = 0;
606 hr = IXmlReader_SetInput(reader, input);
607 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
609 IUnknown_Release(input);
610 }
611 IXmlReader_Release(reader);
612}
613
614static void test_readerinput(void)
615{
616 IXmlReaderInput *reader_input;
617 IXmlReader *reader, *reader2;
618 IUnknown *obj, *input;
619 IStream *stream, *stream2;
620 XmlNodeType nodetype;
621 HRESULT hr;
622 LONG ref;
623
625 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
627 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
628
630 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
631
632 ref = IStream_AddRef(stream);
633 ok(ref == 2, "Expected 2, got %ld.\n", ref);
634 IStream_Release(stream);
636 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
637
638 hr = IUnknown_QueryInterface(reader_input, &IID_IStream, (void**)&stream2);
639 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
640
641 hr = IUnknown_QueryInterface(reader_input, &IID_ISequentialStream, (void**)&stream2);
642 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
643
644 /* IXmlReaderInput grabs a stream reference */
645 ref = IStream_AddRef(stream);
646 ok(ref == 3, "Expected 3, got %ld.\n", ref);
647 IStream_Release(stream);
648
649 /* try ::SetInput() with valid IXmlReaderInput */
650 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
651 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
652
653 ref = IUnknown_AddRef(reader_input);
654 ok(ref == 2, "Expected 2, got %ld.\n", ref);
655 IUnknown_Release(reader_input);
656
657 hr = IXmlReader_SetInput(reader, reader_input);
658 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
659
661
662 nodetype = XmlNodeType_Element;
663 hr = IXmlReader_GetNodeType(reader, &nodetype);
664 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
665 ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
666
667 /* IXmlReader grabs a IXmlReaderInput reference */
668 ref = IUnknown_AddRef(reader_input);
669 ok(ref == 3, "Expected 3, got %ld.\n", ref);
670 IUnknown_Release(reader_input);
671
672 ref = IStream_AddRef(stream);
673 ok(ref == 4, "Expected 4, got %ld.\n", ref);
674 IStream_Release(stream);
675
676 /* reset input and check state */
677 hr = IXmlReader_SetInput(reader, NULL);
678 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
679
681
682 IXmlReader_Release(reader);
683
684 ref = IStream_AddRef(stream);
685 ok(ref == 3, "Expected 3, got %ld.\n", ref);
686 IStream_Release(stream);
687
688 ref = IUnknown_AddRef(reader_input);
689 ok(ref == 2, "Expected 2, got %ld.\n", ref);
690 IUnknown_Release(reader_input);
691
692 /* IID_IXmlReaderInput */
693 /* it returns a kind of private undocumented vtable incompatible with IUnknown,
694 so it's not a COM interface actually.
695 Such query will be used only to check if input is really IXmlReaderInput */
696 obj = (IUnknown*)0xdeadbeef;
697 hr = IUnknown_QueryInterface(reader_input, &IID_IXmlReaderInput, (void**)&obj);
698 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
699 ref = IUnknown_AddRef(reader_input);
700 ok(ref == 3, "Expected 3, got %ld.\n", ref);
701 IUnknown_Release(reader_input);
702
703 IUnknown_Release(reader_input);
704 IUnknown_Release(reader_input);
705 IStream_Release(stream);
706
707 /* test input interface selection sequence */
708 input = NULL;
710 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
711
712 input_iids.count = 0;
713 ref = IUnknown_AddRef(input);
714 ok(ref == 2, "Expected 2, got %ld.\n", ref);
715 IUnknown_Release(input);
717 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
719 /* IXmlReaderInput stores stream interface as IUnknown */
720 ref = IUnknown_AddRef(input);
721 ok(ref == 3, "Expected 3, got %ld.\n", ref);
722 IUnknown_Release(input);
723
724 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
725 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
726
727 input_iids.count = 0;
728 ref = IUnknown_AddRef(reader_input);
729 ok(ref == 2, "Expected 2, got %ld.\n", ref);
730 IUnknown_Release(reader_input);
731 ref = IUnknown_AddRef(input);
732 ok(ref == 3, "Expected 3, got %ld.\n", ref);
733 IUnknown_Release(input);
734 hr = IXmlReader_SetInput(reader, reader_input);
735 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
737
739
740 ref = IUnknown_AddRef(input);
741 ok(ref == 3, "Expected 3, got %ld.\n", ref);
742 IUnknown_Release(input);
743
744 ref = IUnknown_AddRef(reader_input);
745 ok(ref == 3 || broken(ref == 2) /* versions 1.0.x and 1.1.x - XP, Vista */,
746 "Expected 3, got %ld.\n", ref);
747 IUnknown_Release(reader_input);
748 /* repeat another time, no check or caching here */
749 input_iids.count = 0;
750 hr = IXmlReader_SetInput(reader, reader_input);
751 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
753
754 /* another reader */
755 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL);
756 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
757
758 /* resolving from IXmlReaderInput to IStream/ISequentialStream is done at
759 ::SetInput() level, each time it's called */
760 input_iids.count = 0;
761 hr = IXmlReader_SetInput(reader2, reader_input);
762 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
764
765 IXmlReader_Release(reader2);
766 IXmlReader_Release(reader);
767
768 IUnknown_Release(reader_input);
769
770 /* Using codepage */
772 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
773 IUnknown_Release(reader_input);
774
775 IUnknown_Release(input);
776}
777
778static void test_reader_state(void)
779{
780 XmlNodeType nodetype;
782 HRESULT hr;
783
784 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
785 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
786
787 /* invalid arguments */
788 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, NULL);
789 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
790
791 /* attempt to read on closed reader */
793
794if (0)
795{
796 /* newer versions crash here, probably because no input was set */
797 hr = IXmlReader_Read(reader, &nodetype);
798 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
799}
800 set_input_string(reader, "xml");
802
803 nodetype = XmlNodeType_Element;
804 hr = IXmlReader_Read(reader, &nodetype);
806 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
807 ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
808
811
812 nodetype = XmlNodeType_Element;
813 hr = IXmlReader_Read(reader, &nodetype);
815 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
816 ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
817
818 IXmlReader_Release(reader);
819}
820
822{
824 UINT d = ~0u;
825
826 IXmlReader_GetDepth(reader, &d);
827
828 condition = d == depth;
829 if (brk != ~0u)
830 condition |= broken(d == brk);
831 ok_(__FILE__, line)(condition, "Unexpected nesting depth %u, expected %u\n", d, depth);
832}
833
834#define TEST_DEPTH(reader, depth) test_reader_depth(reader, depth, ~0u, __LINE__)
835#define TEST_DEPTH2(reader, depth, brk) test_reader_depth(reader, depth, brk, __LINE__)
836
838{
839 static const struct
840 {
841 WCHAR name[12];
842 WCHAR val[12];
843 } name_val[] =
844 {
845 { {'v','e','r','s','i','o','n',0}, {'1','.','0',0} },
846 { {'e','n','c','o','d','i','n','g',0}, {'U','T','F','-','8',0} },
847 { {'s','t','a','n','d','a','l','o','n','e',0}, {'y','e','s',0} }
848 };
851 HRESULT hr;
853 UINT count = 0, len, i;
854 BOOL ret;
855 const WCHAR *val;
856
857 hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
858 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
859
861
862 hr = IXmlReader_SetInput(reader, (IUnknown*)stream);
863 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
864
865 hr = IXmlReader_GetAttributeCount(reader, &count);
866 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
867 ok(count == 0, "got %d\n", count);
868
869 /* try to move without attributes */
870 hr = IXmlReader_MoveToElement(reader);
871 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
872
873 hr = IXmlReader_MoveToNextAttribute(reader);
874 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
875
876 hr = IXmlReader_MoveToFirstAttribute(reader);
877 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
878
880
882
883 /* new version 1.2.x and 1.3.x properly update position for <?xml ?> */
884 TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
885
886 TEST_DEPTH(reader, 0);
888
890
891 /* check attributes */
893
894 TEST_DEPTH(reader, 1);
895
897 hr = IXmlReader_GetNodeType(reader, &type);
898 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
899 ok(type == XmlNodeType_Attribute, "got %d\n", type);
900
901 TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
902
903 /* try to move from last attribute */
906 hr = IXmlReader_MoveToNextAttribute(reader);
907 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
908
910 hr = IXmlReader_GetNodeType(reader, &type);
911 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
912 ok(type == XmlNodeType_Attribute, "got %d\n", type);
913
914 hr = IXmlReader_MoveToFirstAttribute(reader);
915 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
916 TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
917
918 hr = IXmlReader_GetAttributeCount(reader, NULL);
919 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
920
921 hr = IXmlReader_GetAttributeCount(reader, &count);
922 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
923 ok(count == 3, "Expected 3, got %d\n", count);
924
925 for (i = 0; i < count; i++)
926 {
927 len = 0;
928 hr = IXmlReader_GetLocalName(reader, &val, &len);
929 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
930 ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len);
931 ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val));
932
933 len = 0;
934 hr = IXmlReader_GetValue(reader, &val, &len);
935 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
936 ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len);
937 ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
938
939 hr = IXmlReader_MoveToNextAttribute(reader);
940 ok(hr == ((i < count - 1) ? S_OK : S_FALSE), "Unexpected hr %#lx.\n", hr);
941 }
942
943 TEST_DEPTH(reader, 1);
944
946 TEST_READER_POSITION2(reader, 1, 3, ~0u, 55);
947
949 hr = IXmlReader_GetNodeType(reader, &type);
950 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
951 ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
952
954 hr = IXmlReader_Read(reader, &type);
955 /* newer versions return syntax error here cause document is incomplete,
956 it makes more sense than invalid char error */
957todo_wine {
958 ok(hr == WC_E_SYNTAX || broken(hr == WC_E_XMLCHARACTER), "Unexpected hr %#lx.\n", hr);
959 ok(type == XmlNodeType_None, "got %d\n", type);
960}
961 IStream_Release(stream);
962
963 /* test short variant */
965
966 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
967 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
968
970 TEST_READER_POSITION2(reader, 1, 3, ~0u, 21);
972
973 hr = IXmlReader_GetAttributeCount(reader, &count);
974 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
975 ok(count == 1, "expected 1, got %d\n", count);
976
977 ret = IXmlReader_IsEmptyElement(reader);
978 ok(!ret, "element should not be empty\n");
979
981 reader_name(reader, L"xml");
982
983 reader_qname(reader, L"xml");
984
985 /* check attributes */
987
988 type = -1;
989 hr = IXmlReader_GetNodeType(reader, &type);
990 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
991 ok(type == XmlNodeType_Attribute, "got %d\n", type);
992 TEST_READER_POSITION2(reader, 1, 7, ~0u, 21);
993
994 /* try to move from last attribute */
995 hr = IXmlReader_MoveToNextAttribute(reader);
996 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
997
999 TEST_READER_POSITION2(reader, 1, 23, ~0u, 40);
1001
1002 hr = IXmlReader_GetAttributeCount(reader, &count);
1003 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1004 ok(count == 0, "expected 0, got %d\n", count);
1005
1006 ret = IXmlReader_IsEmptyElement(reader);
1007 ok(ret, "element should be empty\n");
1008
1009 reader_value(reader, L"");
1010 reader_name(reader, L"RegistrationInfo");
1011
1012 type = -1;
1013 hr = IXmlReader_Read(reader, &type);
1014 todo_wine
1015 ok(hr == WC_E_SYNTAX || hr == WC_E_XMLCHARACTER /* XP */, "Unexpected hr %#lx.\n", hr);
1016 ok(type == XmlNodeType_None, "expected XmlNodeType_None, got %s\n", type_to_str(type));
1018 todo_wine
1020
1021 IStream_Release(stream);
1022
1023 /* No encoding attribute. */
1024 set_input_string(reader, "<?xml version=\"1.0\" standalone=\"yes\"?><a/>");
1025 hr = IXmlReader_Read(reader, &type);
1026 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1027 ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
1028
1029 /* Just version attribute, no spaces. */
1030 set_input_string(reader, "<?xml version=\"1.0\"?><a/>");
1031 hr = IXmlReader_Read(reader, &type);
1032 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1033 ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
1034
1035 set_input_string(reader, "<?xml version=\"1.0\"encoding=\"UTF-8\"?><a/>");
1036 hr = IXmlReader_Read(reader, &type);
1037 ok(hr == WC_E_XMLDECL, "Unexpected hr %#lx.\n", hr);
1038
1039 set_input_string(reader, "<?xml version=\"1.0\"standalone=\"yes\"?><a/>");
1040 hr = IXmlReader_Read(reader, &type);
1041 ok(hr == WC_E_XMLDECL, "Unexpected hr %#lx.\n", hr);
1042
1043 IXmlReader_Release(reader);
1044}
1045
1046struct test_entry
1047{
1048 const char *xml;
1049 const WCHAR *name;
1050 const WCHAR *value;
1052 HRESULT hr_broken; /* this is set to older version results */
1054};
1055
1056static struct test_entry comment_tests[] =
1057{
1058 { "<!-- comment -->", L"", L" comment ", S_OK },
1059 { "<!-- - comment-->", L"", L" - comment", S_OK },
1060 { "<!-- -- comment-->", NULL, NULL, WC_E_COMMENT, WC_E_GREATERTHAN },
1061 { "<!-- -- comment--->", NULL, NULL, WC_E_COMMENT, WC_E_GREATERTHAN },
1062 { NULL }
1063};
1064
1065static void test_read_comment(void)
1066{
1067 static const char *teststr = "<a>text<!-- comment --></a>";
1068 struct test_entry *test = comment_tests;
1069 static const XmlNodeType types[] =
1070 {
1075 };
1076 unsigned int i = 0;
1079 HRESULT hr;
1080
1081 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1082 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1083
1084 set_input_string(reader, teststr);
1085
1086 while (IXmlReader_Read(reader, &type) == S_OK)
1087 {
1088 const WCHAR *value;
1089
1090 ok(type == types[i], "%d: unexpected node type %d\n", i, type);
1091
1093 {
1094 hr = IXmlReader_GetValue(reader, &value, NULL);
1095 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1096 ok(*value != 0, "Expected node value\n");
1097 }
1098 i++;
1099 }
1100
1101 while (test->xml)
1102 {
1104
1106 hr = IXmlReader_Read(reader, &type);
1107 if (test->hr_broken)
1108 ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1109 else
1110 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1111 if (hr == S_OK)
1112 {
1113 const WCHAR *str;
1114
1115 ok(type == XmlNodeType_Comment, "got %d for %s\n", type, test->xml);
1116
1117 reader_name(reader, L"");
1118
1119 str = NULL;
1120 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1121 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1122 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1123
1124 reader_qname(reader, L"");
1125
1126 str = NULL;
1127 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1128 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1129 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1130
1131 /* value */
1133 }
1134
1135 test++;
1136 }
1137
1138 IXmlReader_Release(reader);
1139}
1140
1141static struct test_entry pi_tests[] =
1142{
1143 { "<?pi?>", L"pi", L"", S_OK },
1144 { "<?pi ?>", L"pi", L"", S_OK },
1145 { "<?pi ?>", L"pi", L"", S_OK },
1146 { "<?pi pi data?>", L"pi", L"pi data", S_OK },
1147 { "<?pi pi data ?>", L"pi", L"pi data ", S_OK },
1148 { "<?pi data ?>", L"pi", L"data ", S_OK },
1149 { "<?pi:pi?>", NULL, NULL, NC_E_NAMECOLON, WC_E_NAMECHARACTER },
1150 { "<?:pi ?>", NULL, NULL, WC_E_PI, WC_E_NAMECHARACTER },
1151 { "<?-pi ?>", NULL, NULL, WC_E_PI, WC_E_NAMECHARACTER },
1152 { "<?xml-stylesheet ?>", L"xml-stylesheet", L"", S_OK },
1153 { NULL }
1154};
1155
1156static void test_read_pi(void)
1157{
1158 struct test_entry *test = pi_tests;
1160 HRESULT hr;
1161
1162 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1163 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1164
1165 while (test->xml)
1166 {
1168
1170
1172 hr = IXmlReader_Read(reader, &type);
1173 if (test->hr_broken)
1174 ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1175 else
1176 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1177 if (hr == S_OK)
1178 {
1179 const WCHAR *str;
1180 UINT len;
1181
1182 ok(type == XmlNodeType_ProcessingInstruction, "got %d for %s\n", type, test->xml);
1183
1185
1186 len = 0;
1187 str = NULL;
1188 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1189 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1190 ok(len == lstrlenW(test->name), "got %u\n", len);
1191 ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
1192
1193 /* value */
1195 }
1196
1197 test++;
1198 }
1199
1200 IXmlReader_Release(reader);
1201}
1202
1204 const char *xml;
1205 struct {
1207 const WCHAR *value;
1208 } nodes[20];
1209};
1210
1211static const char misc_test_xml[] =
1212 "<!-- comment1 -->"
1213 "<!-- comment2 -->"
1214 "<?pi1 pi1body ?>"
1215 "<!-- comment3 -->"
1216 " \t \r \n"
1217 "<!-- comment4 -->"
1218 "<a>"
1219 "\r\n\t"
1220 "<b/>"
1221 "text"
1222 "<!-- comment -->"
1223 "text2"
1224 "<?pi pibody ?>"
1225 "\r\n"
1226 "</a>"
1227;
1228
1229static struct nodes_test misc_test = {
1231 {
1232 { XmlNodeType_Comment, L" comment1 " },
1233 { XmlNodeType_Comment, L" comment2 " },
1234 { XmlNodeType_ProcessingInstruction, L"pi1body " },
1235 { XmlNodeType_Comment, L" comment3 " },
1236 { XmlNodeType_Whitespace, L" \t \n \n" },
1237 { XmlNodeType_Comment, L" comment4 " },
1238 { XmlNodeType_Element, L"" },
1239 { XmlNodeType_Whitespace, L"\n\t" },
1240 { XmlNodeType_Element, L"" },
1241 { XmlNodeType_Text, L"text" },
1242 { XmlNodeType_Comment, L" comment " },
1243 { XmlNodeType_Text, L"text2" },
1245 { XmlNodeType_Whitespace, L"\n" },
1247 { XmlNodeType_None, L"" }
1248 }
1249};
1250
1251static void test_read_full(void)
1252{
1253 struct nodes_test *test = &misc_test;
1255 HRESULT hr;
1256 int i;
1257
1258 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1259 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1260
1262
1263 i = 0;
1264 do
1265 {
1266 read_node(reader, test->nodes[i].type);
1267 reader_value(reader, test->nodes[i].value);
1268 } while(test->nodes[i++].type != XmlNodeType_None);
1269
1270 IXmlReader_Release(reader);
1271}
1272
1273static const char test_public_dtd[] =
1274 "<!DOCTYPE testdtd PUBLIC \"pubid\" \"externalid uri\" >";
1275
1276static void test_read_public_dtd(void)
1277{
1279 const WCHAR *str;
1281 UINT len, count;
1282 HRESULT hr;
1283
1284 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1285 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1286
1288 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1289
1291
1293
1294 count = 0;
1295 hr = IXmlReader_GetAttributeCount(reader, &count);
1296 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1297 ok(count == 2, "got %d\n", count);
1298
1299 hr = IXmlReader_MoveToFirstAttribute(reader);
1300 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1301
1303 hr = IXmlReader_GetNodeType(reader, &type);
1304 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1305 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1306
1307 reader_name(reader, L"PUBLIC");
1308 reader_value(reader, L"pubid");
1309
1311
1313 hr = IXmlReader_GetNodeType(reader, &type);
1314 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1315 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1316
1317 reader_name(reader, L"SYSTEM");
1318 reader_value(reader, L"externalid uri");
1319
1321 reader_name(reader, L"testdtd");
1322
1323 len = 0;
1324 str = NULL;
1325 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1326 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1327todo_wine {
1328 ok(len == 7, "got %u\n", len);
1329 ok(!lstrcmpW(str, L"testdtd"), "got %s\n", wine_dbgstr_w(str));
1330}
1331 IXmlReader_Release(reader);
1332}
1333
1334static const char test_system_dtd[] =
1335 "<!DOCTYPE testdtd SYSTEM \"externalid uri\" >"
1336 "<!-- comment -->";
1337
1338static void test_read_system_dtd(void)
1339{
1341 const WCHAR *str;
1343 UINT len, count;
1344 HRESULT hr;
1345
1346 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1347 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1348
1350 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1351
1353
1355
1356 count = 0;
1357 hr = IXmlReader_GetAttributeCount(reader, &count);
1358 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1359 ok(count == 1, "got %d\n", count);
1360
1361 hr = IXmlReader_MoveToFirstAttribute(reader);
1362 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1363
1365 hr = IXmlReader_GetNodeType(reader, &type);
1366 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1367 ok(type == XmlNodeType_Attribute, "got %d\n", type);
1368
1369 reader_name(reader, L"SYSTEM");
1370 reader_value(reader, L"externalid uri");
1371
1373 reader_name(reader, L"testdtd");
1374
1375 len = 0;
1376 str = NULL;
1377 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1378 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1379todo_wine {
1380 ok(len == 7, "got %u\n", len);
1381 ok(!lstrcmpW(str, L"testdtd"), "got %s\n", wine_dbgstr_w(str));
1382}
1383
1385
1386 IXmlReader_Release(reader);
1387}
1388
1389static struct test_entry element_tests[] =
1390{
1391 { "<a/>", L"a", L"", S_OK },
1392 { "<a />", L"a", L"", S_OK },
1393 { "<a:b/>", L"a:b", L"", NC_E_UNDECLAREDPREFIX },
1394 { "<:a/>", NULL, NULL, NC_E_QNAMECHARACTER },
1395 { "< a/>", NULL, NULL, NC_E_QNAMECHARACTER },
1396 { "<a>", L"a", L"", S_OK },
1397 { "<a >", L"a", L"", S_OK },
1398 { "<a \r \t\n>", L"a", L"", S_OK },
1399 { "</a>", NULL, NULL, NC_E_QNAMECHARACTER },
1400 { "<a:b:c />", NULL, NULL, NC_E_QNAMECOLON },
1401 { "<:b:c />", NULL, NULL, NC_E_QNAMECHARACTER },
1402 { NULL }
1403};
1404
1405static void test_read_element(void)
1406{
1407 struct test_entry *test = element_tests;
1408 static const char stag[] =
1409 "<a attr1=\"_a\">"
1410 "<b attr2=\"_b\">"
1411 "text"
1412 "<c attr3=\"_c\"/>"
1413 "<d attr4=\"_d\"></d>"
1414 "</b>"
1415 "</a>";
1416 static const UINT depths[] = { 0, 1, 2, 2, 2, 3, 2, 1 };
1419 unsigned int i;
1420 UINT depth;
1421 HRESULT hr;
1422
1423 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1424 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1425
1426 while (test->xml)
1427 {
1429
1431 hr = IXmlReader_Read(reader, &type);
1432 if (test->hr_broken)
1433 ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1434 else
1436 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1437 if (hr == S_OK)
1438 {
1439 const WCHAR *str;
1440 UINT len;
1441
1442 ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1443
1444 len = 0;
1445 str = NULL;
1446 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1447 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1448 ok(len == lstrlenW(test->name), "got %u\n", len);
1449 ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
1450
1451 /* value */
1452 reader_value(reader, L"");
1453 }
1454
1455 test++;
1456 }
1457
1458 /* test reader depth increment */
1459 set_input_string(reader, stag);
1460
1461 i = 0;
1462 while (IXmlReader_Read(reader, &type) == S_OK)
1463 {
1464 UINT count;
1465
1467 type == XmlNodeType_Text, "Unexpected node type %d\n", type);
1468
1469 depth = 123;
1470 hr = IXmlReader_GetDepth(reader, &depth);
1471 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1472 ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1473
1475 {
1476 const WCHAR *prefix;
1477
1478 prefix = NULL;
1479 hr = IXmlReader_GetPrefix(reader, &prefix, NULL);
1480 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1481 ok(prefix != NULL, "got %p\n", prefix);
1482
1483 if (!*prefix)
1484 {
1485 const WCHAR *local, *qname;
1486
1487 local = NULL;
1488 hr = IXmlReader_GetLocalName(reader, &local, NULL);
1489 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1490 ok(local != NULL, "got %p\n", local);
1491
1492 qname = NULL;
1493 hr = IXmlReader_GetQualifiedName(reader, &qname, NULL);
1494 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1495 ok(qname != NULL, "got %p\n", qname);
1496
1497 ok(local == qname, "expected same pointer\n");
1498 }
1499 }
1500
1502 {
1503 count = 1;
1504 hr = IXmlReader_GetAttributeCount(reader, &count);
1505 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1506 ok(count == 0, "got %u\n", count);
1507 }
1508
1510 {
1511 count = 0;
1512 hr = IXmlReader_GetAttributeCount(reader, &count);
1513 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1514
1515 /* moving to attributes increases depth */
1516 if (count)
1517 {
1518 const WCHAR *value;
1519
1520 reader_value(reader, L"");
1521
1522 hr = IXmlReader_MoveToFirstAttribute(reader);
1523 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1524
1525 hr = IXmlReader_GetValue(reader, &value, NULL);
1526 ok(*value != 0, "Unexpected value %s\n", wine_dbgstr_w(value));
1527
1528 depth = 123;
1529 hr = IXmlReader_GetDepth(reader, &depth);
1530 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1531 ok(depth == depths[i] + 1, "%u: got depth %u, expected %u\n", i, depth, depths[i] + 1);
1532
1534 reader_value(reader, L"");
1535
1536 depth = 123;
1537 hr = IXmlReader_GetDepth(reader, &depth);
1538 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1539 ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
1540 }
1541 }
1542
1543 i++;
1544 }
1545
1546 /* start/end tag mismatch */
1547 set_input_string(reader, "<a></b>");
1548
1550
1552 hr = IXmlReader_Read(reader, &type);
1553 ok(hr == WC_E_ELEMENTMATCH, "Unexpected hr %#lx.\n", hr);
1554 ok(type == XmlNodeType_None, "got %d\n", type);
1556
1557 IXmlReader_Release(reader);
1558}
1559
1561
1562static void test_read_pending(void)
1563{
1565 const WCHAR *value;
1567 HRESULT hr;
1568 int c;
1569
1570 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1571 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1572
1573 hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream);
1574 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1575
1576 /* first read call returns incomplete node, second attempt fails with E_PENDING */
1577 stream_readcall = 0;
1579 hr = IXmlReader_Read(reader, &type);
1580 ok(hr == S_OK || broken(hr == E_PENDING), "Unexpected hr %#lx.\n", hr);
1581 /* newer versions are happy when it's enough data to detect node type,
1582 older versions keep reading until it fails to read more */
1583 todo_wine
1584 ok(stream_readcall == 1 || broken(stream_readcall > 1), "got %d\n", stream_readcall);
1585 ok(type == XmlNodeType_Comment || broken(type == XmlNodeType_None), "got %d\n", type);
1586
1587 /* newer versions' GetValue() makes an attempt to read more */
1589 value = (void*)0xdeadbeef;
1590 hr = IXmlReader_GetValue(reader, &value, NULL);
1591 ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
1592 ok(value == NULL || broken(value == (void*)0xdeadbeef) /* Win8 sets it to NULL */, "got %p\n", value);
1593 ok(c < stream_readcall || broken(c == stream_readcall), "got %d, expected %d\n", stream_readcall, c+1);
1594
1595 IXmlReader_Release(reader);
1596}
1597
1598static void test_readvaluechunk(void)
1599{
1602 WCHAR buf[64];
1603 WCHAR b;
1604 HRESULT hr;
1605 UINT c;
1606
1607 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1608 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1609
1610 set_input_string(reader, "<!-- comment1 --><!-- comment2 -->");
1611
1612 hr = IXmlReader_Read(reader, &type);
1613 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1614 ok(type == XmlNodeType_Comment, "type = %u\n", type);
1615
1616 read_value_char(reader, ' ');
1617 read_value_char(reader, 'c');
1618
1619 /* portion read as chunk is skipped from resulting node value */
1620 reader_value(reader, L"omment1 ");
1621
1622 /* once value is returned/allocated it's not possible to read by chunk */
1623 c = 0;
1624 b = 0;
1625 hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
1626 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1627 ok(c == 0, "got %u\n", c);
1628 ok(b == 0, "got %x\n", b);
1629
1630 c = 0xdeadbeef;
1631 hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
1632 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1633 ok(!c, "c = %u\n", c);
1634
1635 reader_value(reader, L"omment1 ");
1636
1637 /* read comment2 */
1639
1640 c = 0xdeadbeef;
1641 hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
1642 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1643 ok(!c, "c = %u\n", c);
1644
1645 c = 0xdeadbeef;
1646 memset(buf, 0xcc, sizeof(buf));
1647 hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
1648 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1649 ok(c == 10, "got %u\n", c);
1650 ok(buf[c] == 0xcccc, "buffer overflow\n");
1651 buf[c] = 0;
1652 ok(!lstrcmpW(buf, L" comment2 "), "buf = %s\n", wine_dbgstr_w(buf));
1653
1654 c = 0xdeadbeef;
1655 memset(buf, 0xcc, sizeof(buf));
1656 hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
1657 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1658 ok(!c, "got %u\n", c);
1659
1660 /* portion read as chunk is skipped from resulting node value */
1661 reader_value(reader, L"");
1662
1663 /* once value is returned/allocated it's not possible to read by chunk */
1664 c = 0xdeadbeef;
1665 b = 0xffff;
1666 hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
1667 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
1668 ok(c == 0, "got %u\n", c);
1669 ok(b == 0xffff, "got %x\n", b);
1670
1671 reader_value(reader, L"");
1672
1673 IXmlReader_Release(reader);
1674}
1675
1676static struct test_entry cdata_tests[] =
1677{
1678 { "<a><![CDATA[ ]]data ]]></a>", L"", L" ]]data ", S_OK },
1679 { "<a><![CDATA[<![CDATA[ data ]]]]></a>", L"", L"<![CDATA[ data ]]", S_OK },
1680 { "<a><![CDATA[\n \r\n \n\n ]]></a>", L"", L"\n \n \n\n ", S_OK, S_OK },
1681 { "<a><![CDATA[\r \r\r\n \n\n ]]></a>", L"", L"\n \n\n \n\n ", S_OK, S_OK },
1682 { "<a><![CDATA[\r\r \n\r \r \n\n ]]></a>", L"", L"\n\n \n\n \n \n\n ", S_OK },
1683 { NULL }
1684};
1685
1686static void test_read_cdata(void)
1687{
1688 struct test_entry *test = cdata_tests;
1690 HRESULT hr;
1691
1692 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1693 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1694
1695 while (test->xml)
1696 {
1698
1700
1702 hr = IXmlReader_Read(reader, &type);
1703
1704 /* read one more to get to CDATA */
1706 {
1708 hr = IXmlReader_Read(reader, &type);
1709 }
1710
1711 if (test->hr_broken)
1712 ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1713 else
1714 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1715 if (hr == S_OK)
1716 {
1717 const WCHAR *str;
1718 UINT len;
1719
1720 ok(type == XmlNodeType_CDATA, "got %d for %s\n", type, test->xml);
1721
1722 reader_name(reader, L"");
1723
1724 str = NULL;
1725 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1726 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1727 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1728
1729 len = 1;
1730 str = NULL;
1731 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1732 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1733 ok(len == 0, "got %u\n", len);
1734 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1735
1736 str = NULL;
1737 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1738 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1739 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1740
1741 /* value */
1743 }
1744
1745 test++;
1746 }
1747
1748 IXmlReader_Release(reader);
1749}
1750
1751static struct test_entry text_tests[] =
1752{
1753 { "<a>simple text</a>", L"", L"simple text", S_OK },
1754 { "<a>text ]]> text</a>", L"", L"", WC_E_CDSECTEND },
1755 { "<a>\n \r\n \n\n text</a>", L"", L"\n \n \n\n text", S_OK, S_OK },
1756 { "<a>\r \r\r\n \n\n text</a>", L"", L"\n \n\n \n\n text", S_OK, S_OK },
1757 { NULL }
1758};
1759
1760static void test_read_text(void)
1761{
1762 struct test_entry *test = text_tests;
1764 HRESULT hr;
1765
1766 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1767 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1768
1769 while (test->xml)
1770 {
1772
1774
1776 hr = IXmlReader_Read(reader, &type);
1777
1778 /* read one more to get to text node */
1780 {
1782 hr = IXmlReader_Read(reader, &type);
1783 }
1784 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1785 if (hr == S_OK)
1786 {
1787 const WCHAR *str;
1788 UINT len;
1789
1790 ok(type == XmlNodeType_Text, "got %d for %s\n", type, test->xml);
1791
1792 reader_name(reader, L"");
1793
1794 str = NULL;
1795 hr = IXmlReader_GetLocalName(reader, &str, NULL);
1796 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1797 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1798
1799 len = 1;
1800 str = NULL;
1801 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1802 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1803 ok(len == 0, "got %u\n", len);
1804 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1805
1806 str = NULL;
1807 hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
1808 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1809 ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
1810
1811 /* value */
1813 }
1814
1815 test++;
1816 }
1817
1818 IXmlReader_Release(reader);
1819}
1820
1822 const char *xml;
1824};
1825
1827 { "<a></a>", FALSE },
1828 { "<a/>", TRUE },
1829 { NULL }
1830};
1831
1832static void test_isemptyelement(void)
1833{
1837 HRESULT hr;
1838 BOOL ret;
1839
1840 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1841 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1842
1843 while (test->xml)
1844 {
1846
1848 hr = IXmlReader_Read(reader, &type);
1849 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1850 ok(type == XmlNodeType_Element, "got %d\n", type);
1851
1852 ret = IXmlReader_IsEmptyElement(reader);
1853 ok(ret == test->empty, "got %d, expected %d. xml=%s\n", ret, test->empty, test->xml);
1854
1855 test++;
1856 }
1857
1858 /* Move to an attribute of an empty element. */
1859 set_input_string(reader, "<a attr1=\'b\' />");
1860
1861 hr = IXmlReader_Read(reader, &type);
1862 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1863 ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type);
1864 ret = IXmlReader_IsEmptyElement(reader);
1865 ok(ret, "Unexpected empty flag %d.\n", ret);
1866
1867 hr = IXmlReader_MoveToFirstAttribute(reader);
1868 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1869 hr = IXmlReader_GetNodeType(reader, &type);
1870 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1871 ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
1872 ret = IXmlReader_IsEmptyElement(reader);
1873 ok(!ret, "Unexpected empty flag %d.\n", ret);
1874
1875 IXmlReader_Release(reader);
1876}
1877
1879{
1880 { "<a attr1=\"attrvalue\"/>", L"attr1", L"attrvalue", S_OK },
1881 { "<a attr1=\"a\'\'ttrvalue\"/>", L"attr1", L"a\'\'ttrvalue", S_OK },
1882 { "<a attr1=\'a\"ttrvalue\'/>", L"attr1", L"a\"ttrvalue", S_OK },
1883 { "<a attr1=\' \'/>", L"attr1", L" ", S_OK },
1884 { "<a attr1=\" \"/>", L"attr1", L" ", S_OK },
1885 { "<a attr1=\"\r\n \r \n \t\n\r\"/>", L"attr1", L" ", S_OK },
1886 { "<a attr1=\" val \"/>", L"attr1", L" val ", S_OK },
1887 { "<a attr1=\"\r\n\tval\n\"/>", L"attr1", L" val ", S_OK },
1888 { "<a attr1=\"val&#32;\"/>", L"attr1", L"val ", S_OK },
1889 { "<a attr1=\"val&#x20;\"/>", L"attr1", L"val ", S_OK },
1890 { "<a attr1=\"&lt;&gt;&amp;&apos;&quot;\"/>", L"attr1", L"<>&\'\"", S_OK },
1891 { "<a attr1=\"&entname;\"/>", NULL, NULL, WC_E_UNDECLAREDENTITY },
1892 { "<a attr1=\"val&#xfffe;\"/>", NULL, NULL, WC_E_XMLCHARACTER },
1893 { "<a attr1=\"val &#a;\"/>", NULL, NULL, WC_E_DIGIT, WC_E_SEMICOLON },
1894 { "<a attr1=\"val &#12a;\"/>", NULL, NULL, WC_E_SEMICOLON },
1895 { "<a attr1=\"val &#x12g;\"/>", NULL, NULL, WC_E_SEMICOLON },
1896 { "<a attr1=\"val &#xg;\"/>", NULL, NULL, WC_E_HEXDIGIT, WC_E_SEMICOLON },
1897 { "<a attr1=attrvalue/>", NULL, NULL, WC_E_QUOTE },
1898 { "<a attr1=\"attr<value\"/>", NULL, NULL, WC_E_LESSTHAN },
1899 { "<a attr1=\"&entname\"/>", NULL, NULL, WC_E_SEMICOLON },
1900 { NULL }
1901};
1902
1903static void test_read_attribute(void)
1904{
1907 HRESULT hr;
1908
1909 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1910 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1911
1912 while (test->xml)
1913 {
1915
1917
1918 hr = IXmlReader_Read(reader, NULL);
1919
1920 if (test->hr_broken)
1921 ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1922 else
1923 ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
1924 if (hr == S_OK)
1925 {
1926 const WCHAR *str;
1927 UINT len;
1928
1930 hr = IXmlReader_GetNodeType(reader, &type);
1931 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1932
1933 ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
1934
1935 hr = IXmlReader_MoveToFirstAttribute(reader);
1936 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1937
1939
1940 len = 1;
1941 str = NULL;
1942 hr = IXmlReader_GetQualifiedName(reader, &str, &len);
1943 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1944 ok(len == lstrlenW(test->name), "got %u\n", len);
1945 ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
1946
1947 /* value */
1949 }
1950
1951 test++;
1952 }
1953
1954 IXmlReader_Release(reader);
1955}
1956
1957static void test_reader_properties(void)
1958{
1961 HRESULT hr;
1962
1963 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
1964 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1965
1966 value = 0;
1967 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
1968 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1969 ok(value == 256, "Unexpected default max depth value %Id.\n", value);
1970
1971 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MultiLanguage, 0);
1972 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1973
1974 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
1975 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1976
1977 value = 256;
1978 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
1979 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1980 ok(value == 0, "Unexpected max depth value %Id.\n", value);
1981
1982 IXmlReader_Release(reader);
1983}
1984
1985static void test_prefix(void)
1986{
1987 static const struct
1988 {
1989 const char *xml;
1990 const WCHAR *prefix1;
1991 const WCHAR *prefix2;
1992 const WCHAR *prefix3;
1993 } prefix_tests[] =
1994 {
1995 { "<b xmlns=\"defns\" xml:a=\"a ns\"/>", L"", L"", L"xml" },
1996 { "<c:b xmlns:c=\"c ns\" xml:a=\"a ns\"/>", L"c", L"xmlns", L"xml" },
1997 };
1999 unsigned int i;
2000 HRESULT hr;
2001
2002 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
2003 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2004
2005 for (i = 0; i < ARRAY_SIZE(prefix_tests); i++) {
2007
2008 set_input_string(reader, prefix_tests[i].xml);
2009
2010 hr = IXmlReader_Read(reader, &type);
2011 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2012 ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type);
2013
2014 reader_prefix(reader, prefix_tests[i].prefix1);
2015
2016 hr = IXmlReader_MoveToFirstAttribute(reader);
2017 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2018
2019 hr = IXmlReader_GetNodeType(reader, &type);
2020 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2021 ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2022
2023 reader_prefix(reader, prefix_tests[i].prefix2);
2024
2026
2027 hr = IXmlReader_GetNodeType(reader, &type);
2028 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2029 ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
2030
2031 reader_prefix(reader, prefix_tests[i].prefix3);
2032
2033 /* back to the element, check prefix */
2035 reader_prefix(reader, prefix_tests[i].prefix1);
2036 }
2037
2038 IXmlReader_Release(reader);
2039}
2040
2041static void test_namespaceuri(void)
2042{
2043 struct uri_test
2044 {
2045 const char *xml;
2046 const WCHAR *uri[5];
2047 } uri_tests[] =
2048 {
2049 { "<a xmlns=\"defns a\"><b xmlns=\"defns b\"><c xmlns=\"defns c\"/></b></a>",
2050 { L"defns a", L"defns b", L"defns c", L"defns b", L"defns a" }},
2051 { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"/>",
2052 { L"ns r" }},
2053 { "<r:a xmlns=\"defns a\" xmlns:r=\"ns r\"><b/></r:a>",
2054 { L"ns r", L"defns a", L"ns r" }},
2055 { "<a xmlns=\"defns a\" xmlns:r=\"ns r\"><r:b/></a>",
2056 { L"defns a", L"ns r", L"defns a" }},
2057 { "<a><b><c/></b></a>",
2058 { L"", L"", L"", L"", L"" }},
2059 { "<a>text</a>",
2060 { L"", L"", L"" }},
2061 { "<a>\r\n</a>",
2062 { L"", L"", L"" }},
2063 { "<a><![CDATA[data]]></a>",
2064 { L"", L"", L"" }},
2065 { "<?xml version=\"1.0\" ?><a/>",
2066 { L"", L"" }},
2067 { "<a><?pi ?></a>",
2068 { L"", L"", L"" }},
2069 { "<a><!-- comment --></a>",
2070 { L"", L"", L"" }},
2071 };
2074 unsigned int i;
2075 HRESULT hr;
2076
2077 hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
2078 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2079
2080 for (i = 0; i < ARRAY_SIZE(uri_tests); i++) {
2081 unsigned int j = 0;
2082
2084
2085 type = ~0u;
2086 while (IXmlReader_Read(reader, &type) == S_OK) {
2087 const WCHAR *local, *qname;
2088 UINT length, length2;
2089
2097 type == XmlNodeType_XmlDeclaration, "Unexpected node type %d.\n", type);
2098
2099 local = NULL;
2100 length = 0;
2101 hr = IXmlReader_GetLocalName(reader, &local, &length);
2102 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2103 ok(local != NULL, "Unexpected NULL local name pointer\n");
2104
2105 qname = NULL;
2106 length2 = 0;
2107 hr = IXmlReader_GetQualifiedName(reader, &qname, &length2);
2108 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2109 ok(qname != NULL, "Unexpected NULL qualified name pointer\n");
2110
2111 if (type == XmlNodeType_Element ||
2115 {
2116 ok(*local != 0, "Unexpected empty local name\n");
2117 ok(length > 0, "Unexpected local name length\n");
2118
2119 ok(*qname != 0, "Unexpected empty qualified name\n");
2120 ok(length2 > 0, "Unexpected qualified name length\n");
2121 }
2122
2124
2125 j++;
2126 }
2127 ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2128 }
2129
2130 IXmlReader_Release(reader);
2131}
2132
2133static void test_read_charref(void)
2134{
2135 static const char testA[] = "<a b=\"c\">&#x1f3;&#x103;&gt;</a>";
2136 static const WCHAR chardataW[] = {0x01f3,0x0103,'>',0};
2137 const WCHAR *value;
2140 HRESULT hr;
2141
2142 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2143 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2144
2145 set_input_string(reader, testA);
2146
2147 hr = IXmlReader_Read(reader, &type);
2148 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2149 ok(type == XmlNodeType_Element, "Unexpected node type %d\n", type);
2150
2151 hr = IXmlReader_Read(reader, &type);
2152 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2153 ok(type == XmlNodeType_Text, "Unexpected node type %d\n", type);
2154
2155 hr = IXmlReader_GetValue(reader, &value, NULL);
2156 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2157 ok(!lstrcmpW(value, chardataW), "Text value : %s\n", wine_dbgstr_w(value));
2158
2159 hr = IXmlReader_Read(reader, &type);
2160 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2161 ok(type == XmlNodeType_EndElement, "Unexpected node type %d\n", type);
2162
2163 hr = IXmlReader_Read(reader, &type);
2164 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2165 ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
2166
2167 IXmlReader_Release(reader);
2168}
2169
2171{
2172 static const struct encoding_testW
2173 {
2174 WCHAR text[16];
2175 }
2176 encoding_testsW[] =
2177 {
2178 { { '<','?','p','i',' ','?','>',0 } },
2179 { { '<','!','-','-',' ','c','-','-','>',0 } },
2180 { { 0xfeff,'<','a','/','>',0 } },
2181 { { '<','a','/','>',0 } },
2182 };
2183 static const char *encoding_testsA[] =
2184 {
2185 "<?pi ?>",
2186 "<!-- comment -->",
2187 "\xef\xbb\xbf<a/>", /* UTF-8 BOM */
2188 "<a/>",
2189 };
2192 IStream *stream;
2193 unsigned int i;
2194 HRESULT hr;
2195
2196 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2197 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2198
2199 /* there's no way to query detected encoding back, so just verify that document is browsable */
2200
2201 for (i = 0; i < ARRAY_SIZE(encoding_testsA); i++)
2202 {
2203 set_input_string(reader, encoding_testsA[i]);
2204
2206 hr = IXmlReader_Read(reader, &type);
2207 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2208 ok(type != XmlNodeType_None, "Unexpected node type %d\n", type);
2209 }
2210
2211 for (i = 0; i < ARRAY_SIZE(encoding_testsW); i++)
2212 {
2213 stream = create_stream_on_data(encoding_testsW[i].text, lstrlenW(encoding_testsW[i].text) * sizeof(WCHAR));
2214
2215 hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
2216 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2217
2219 hr = IXmlReader_Read(reader, &type);
2220 ok(hr == S_OK, "%u: unexpected hr %#lx.\n", i, hr);
2221 ok(type != XmlNodeType_None, "%u: unexpected node type %d\n", i, type);
2222
2223 IStream_Release(stream);
2224 }
2225
2226 IXmlReader_Release(reader);
2227}
2228
2230{
2232 HRESULT hr;
2233
2234 ok(IXmlReader_IsEOF(reader) == eof, "Unexpected IsEOF() result\n");
2235 hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
2236 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2237 ok((state == XmlReadState_EndOfFile) == eof, "Unexpected EndOfFile state %Id.\n", state);
2238}
2239
2240static void test_endoffile(void)
2241{
2244 HRESULT hr;
2245
2246 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2247 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2248
2250
2251 set_input_string(reader, "<a/>");
2252
2254
2256 hr = IXmlReader_Read(reader, &type);
2257 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2258 ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2259
2261
2263 hr = IXmlReader_Read(reader, &type);
2264 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2265 ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2266
2268
2269 hr = IXmlReader_SetInput(reader, NULL);
2270 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2271
2273
2274 IXmlReader_Release(reader);
2275
2276 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2277 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2278
2279 set_input_string(reader, "<a/>text");
2280
2282 hr = IXmlReader_Read(reader, &type);
2283 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2284 ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
2285
2287
2289 hr = IXmlReader_Read(reader, &type);
2290 ok(hr == WC_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
2291 ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
2292
2294
2295 hr = IXmlReader_SetInput(reader, NULL);
2296 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2297
2298 IXmlReader_Release(reader);
2299}
2300
2301static void test_max_element_depth(void)
2302{
2303 static const char *xml =
2304 "<a>"
2305 "<b attrb=\"_b\">"
2306 "<c>"
2307 "<d></d>"
2308 "</c>"
2309 "</b>"
2310 "</a>";
2311 XmlNodeType nodetype;
2312 unsigned int count;
2314 HRESULT hr;
2315
2316 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2317 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2318
2320
2321 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2322 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2323
2324 TEST_DEPTH(reader, 0);
2325
2326 hr = IXmlReader_Read(reader, NULL);
2327 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2328
2329 TEST_DEPTH(reader, 0);
2330
2331 hr = IXmlReader_Read(reader, NULL);
2332 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2333
2334 TEST_DEPTH(reader, 1);
2336
2337 hr = IXmlReader_Read(reader, NULL);
2338 ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
2339
2340 TEST_DEPTH2(reader, 0, 2);
2342
2343 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 10);
2344 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2345
2346 hr = IXmlReader_Read(reader, NULL);
2347 ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
2348
2349 TEST_DEPTH2(reader, 0, 2);
2351
2352 /* test if stepping into attributes enforces depth limit too */
2354
2355 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
2356 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2357
2358 TEST_DEPTH(reader, 0);
2359
2360 hr = IXmlReader_Read(reader, NULL);
2361 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2362
2363 TEST_DEPTH(reader, 0);
2364
2365 hr = IXmlReader_Read(reader, NULL);
2366 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2367
2368 TEST_DEPTH(reader, 1);
2369
2370 hr = IXmlReader_MoveToFirstAttribute(reader);
2371 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2372
2373 TEST_DEPTH(reader, 2);
2375
2376 nodetype = 123;
2377 hr = IXmlReader_Read(reader, &nodetype);
2378 ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
2379 ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2380
2381 nodetype = 123;
2382 hr = IXmlReader_Read(reader, &nodetype);
2383 ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
2384 ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
2385
2386 TEST_DEPTH2(reader, 0, 2);
2388
2389 /* set max depth to 0, this disables depth limit */
2391
2392 hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
2393 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2394
2395 count = 0;
2396 while (IXmlReader_Read(reader, NULL) == S_OK)
2397 count++;
2398 ok(count == 8, "Unexpected node number %u\n", count);
2400
2401 IXmlReader_Release(reader);
2402}
2403
2404static void test_reader_position(void)
2405{
2406 static const char *xml = "<c:a xmlns:c=\"nsdef c\" b=\"attr b\">\n</c:a>";
2409 UINT position;
2410 HRESULT hr;
2411
2412 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2413 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2414
2416
2417 /* position methods with Null args */
2418 hr = IXmlReader_GetLineNumber(reader, NULL);
2419 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2420
2421 hr = IXmlReader_GetLinePosition(reader, NULL);
2422 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2423
2424 position = 123;
2425 hr = IXmlReader_GetLinePosition(reader, &position);
2426 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2427 ok(position == 0, "got %u\n", position);
2428
2429 position = 123;
2430 hr = IXmlReader_GetLineNumber(reader, &position);
2431 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2432 ok(position == 0, "got %u\n", position);
2433
2435
2438 hr = IXmlReader_Read(reader, &type);
2439 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2440 ok(type == XmlNodeType_Element, "got type %d\n", type);
2441 TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2442
2444 TEST_READER_POSITION2(reader, 1, 6, ~0u, 34);
2445
2447 TEST_READER_POSITION2(reader, 1, 24, ~0u, 34);
2448
2450 TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
2451
2452 hr = IXmlReader_Read(reader, &type);
2453 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2454 ok(type == XmlNodeType_Whitespace, "got type %d\n", type);
2455 TEST_READER_POSITION2(reader, 1, 35, 2, 6);
2456
2457 hr = IXmlReader_Read(reader, &type);
2458 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2459 ok(type == XmlNodeType_EndElement, "got type %d\n", type);
2460 TEST_READER_POSITION2(reader, 2, 3, 2, 6);
2461
2462 hr = IXmlReader_SetInput(reader, NULL);
2463 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2466
2467 IXmlReader_Release(reader);
2468}
2469
2470static void test_string_pointers(void)
2471{
2472 const WCHAR *ns, *nsq, *empty, *xmlns_ns, *xmlns_name, *name, *p, *q, *xml, *ptr, *value;
2474 HRESULT hr;
2475
2476 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2477 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2478
2479 set_input_string(reader, "<elem xmlns=\"myns\">myns<elem2 /></elem>");
2480
2482 empty = reader_value(reader, L"");
2483 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2484 name = reader_name(reader, L"elem");
2485 ok(name == reader_qname(reader, L"elem"), "name != qname\n");
2486 ns = reader_namespace(reader, L"myns");
2487
2489 ptr = reader_value(reader, L"myns");
2490 if (ns != ptr)
2491 {
2492 win_skip("attr value is different than namespace pointer, assuming old xmllite\n");
2493 IXmlReader_Release(reader);
2494 return;
2495 }
2496 ok(ns == ptr, "ns != value\n");
2497 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2498 xmlns_ns = reader_namespace(reader, L"http://www.w3.org/2000/xmlns/");
2499 xmlns_name = reader_name(reader, L"xmlns");
2500 ok(xmlns_name == reader_qname(reader, L"xmlns"), "xmlns_name != qname\n");
2501
2503 ok(ns != reader_value(reader, L"myns"), "ns == value\n");
2504 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2505 ok(empty == reader_namespace(reader, L""), "empty != namespace\n");
2506 ok(empty == reader_name(reader, L""), "empty != name\n");
2507 ok(empty == reader_qname(reader, L""), "empty != qname\n");
2508
2510 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2511 ok(ns == reader_namespace(reader, L"myns"), "empty != namespace\n");
2512
2514 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2515 ok(name == reader_name(reader, L"elem"), "empty != name\n");
2516 ok(name == reader_qname(reader, L"elem"), "empty != qname\n");
2517 ok(ns == reader_namespace(reader, L"myns"), "empty != namespace\n");
2518
2519 set_input_string(reader, "<elem xmlns:p=\"myns\" xmlns:q=\"mynsq\"><p:elem2 q:attr=\"\"></p:elem2></elem>");
2520
2522 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2523 name = reader_name(reader, L"elem");
2524 ok(empty == reader_namespace(reader, L""), "empty != namespace\n");
2525
2527 ns = reader_value(reader, L"myns");
2528 ok(xmlns_name == reader_prefix(reader, L"xmlns"), "xmlns_name != prefix\n");
2529 p = reader_name(reader, L"p");
2530 ok(xmlns_ns == reader_namespace(reader, L"http://www.w3.org/2000/xmlns/"), "xmlns_ns != namespace\n");
2531
2533 nsq = reader_value(reader, L"mynsq");
2534 ok(xmlns_name == reader_prefix(reader, L"xmlns"), "xmlns_name != prefix\n");
2535 q = reader_name(reader, L"q");
2536 ok(xmlns_ns == reader_namespace(reader, L"http://www.w3.org/2000/xmlns/"), "xmlns_ns != namespace\n");
2537
2539 ok(p == reader_prefix(reader, L"p"), "p != prefix\n");
2540 ok(ns == reader_namespace(reader, L"myns"), "empty != namespace\n");
2541 name = reader_qname(reader, L"p:elem2");
2542
2544 ok(empty != reader_value(reader, L""), "empty == value\n");
2545 ok(q == reader_prefix(reader, L"q"), "q != prefix\n");
2546 ok(nsq == reader_namespace(reader, L"mynsq"), "nsq != namespace\n");
2547
2549 ptr = reader_qname(reader, L"p:elem2"); todo_wine ok(name != ptr, "q == qname\n");
2550
2551 set_input_string(reader, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
2552
2554 ok(empty == reader_value(reader, L""), "empty != value\n");
2555 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2556 xml = reader_name(reader, L"xml");
2557 ptr = reader_qname(reader, L"xml"); todo_wine ok(xml == ptr, "xml != qname\n");
2558 ok(empty == reader_namespace(reader, L""), "empty != namespace\n");
2559
2561 ok(empty == reader_prefix(reader, L""), "empty != prefix\n");
2562 ok(empty == reader_namespace(reader, L""), "empty != namespace\n");
2563
2564 set_input_string(reader, "<elem xmlns:p=\"myns\"><p:elem2 attr=\"\" /></elem>");
2565
2568 read_value_char(reader, 'm');
2569 p = reader_value(reader, L"yns");
2570
2572 ns = reader_namespace(reader, L"myns");
2573 ok(ns+1 == p, "ns+1 != p\n");
2574
2575 set_input_string(reader, "<elem attr=\"value\"></elem>");
2576
2579 name = reader_name(reader, L"attr");
2580 value = reader_value(reader, L"value");
2581
2584 ok(name == reader_name(reader, L"attr"), "attr pointer changed\n");
2585 ok(value == reader_value(reader, L"value"), "value pointer changed\n");
2586
2587 IXmlReader_Release(reader);
2588}
2589
2590static void test_attribute_by_name(void)
2591{
2592 static const char *xml = "<a><elem xmlns=\"myns\" a=\"value a\" b=\"value b\" xmlns:ns=\"ns uri\" "
2593 "ns:c=\"value c\" c=\"value c2\"/></a>";
2594 static const WCHAR xmlns_uriW[] = L"http://www.w3.org/2000/xmlns/";
2596 HRESULT hr;
2597
2598 hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
2599 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2600
2602
2603 hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
2604 ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* WinXP */, "Unexpected hr %#lx.\n", hr);
2605
2606 hr = IXmlReader_MoveToAttributeByName(reader, L"", NULL);
2607 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2608
2610 TEST_DEPTH(reader, 0);
2611
2612 hr = IXmlReader_MoveToAttributeByName(reader, L"", NULL);
2613 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2614
2616 TEST_DEPTH(reader, 1);
2617
2618 hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
2619 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2620
2621 hr = IXmlReader_MoveToAttributeByName(reader, NULL, xmlns_uriW);
2622 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
2623
2624 hr = IXmlReader_MoveToAttributeByName(reader, L"", xmlns_uriW);
2625 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2626
2627 hr = IXmlReader_MoveToAttributeByName(reader, L"xmlns", NULL);
2628 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2629
2630 hr = IXmlReader_MoveToAttributeByName(reader, L"xmlns", xmlns_uriW);
2631 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2632 TEST_DEPTH(reader, 2);
2633 reader_value(reader, L"myns");
2634
2635 hr = IXmlReader_MoveToAttributeByName(reader, L"a", NULL);
2636 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2637 TEST_DEPTH(reader, 2);
2638 reader_value(reader, L"value a");
2639
2640 hr = IXmlReader_MoveToAttributeByName(reader, L"b", NULL);
2641 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2642 TEST_DEPTH(reader, 2);
2643 reader_value(reader, L"value b");
2644
2645 hr = IXmlReader_MoveToAttributeByName(reader, L"a", L"myns");
2646 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2647
2648 hr = IXmlReader_MoveToAttributeByName(reader, L"ns", NULL);
2649 ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
2650
2651 hr = IXmlReader_MoveToAttributeByName(reader, L"ns", xmlns_uriW);
2652 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2653 TEST_DEPTH(reader, 2);
2654 reader_value(reader, L"ns uri");
2655
2656 hr = IXmlReader_MoveToAttributeByName(reader, L"b", L"");
2657 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2658 TEST_DEPTH(reader, 2);
2659 reader_value(reader, L"value b");
2660
2661 hr = IXmlReader_MoveToAttributeByName(reader, L"c", NULL);
2662 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2663 TEST_DEPTH(reader, 2);
2664 reader_value(reader, L"value c2");
2665
2666 hr = IXmlReader_MoveToAttributeByName(reader, L"c", L"ns uri");
2667 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2668 TEST_DEPTH(reader, 2);
2669 reader_value(reader, L"value c");
2670
2671 IXmlReader_Release(reader);
2672}
2673
2675{
2682 test_read_pi();
2693 test_prefix();
2702}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
static int state
Definition: maze.c:121
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:20
const GUID IID_IUnknown
r l[0]
Definition: byte_order.h:168
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
#define E_PENDING
Definition: dinput.h:172
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
static const WCHAR empty[1]
Definition: string.c:47
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1674
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
const WCHAR * text
Definition: package.c:1826
static int eof(int fd)
Definition: io.h:21
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
Definition: reader.c:3616
HRESULT WINAPI CreateXmlReaderInputWithEncodingCodePage(IUnknown *stream, IMalloc *imalloc, UINT codepage, BOOL hint, const WCHAR *base_uri, IXmlReaderInput **input)
Definition: reader.c:3707
HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream, IMalloc *imalloc, const WCHAR *encoding, BOOL hint, const WCHAR *base_uri, IXmlReaderInput **input)
Definition: reader.c:3695
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
#define local
Definition: zutil.h:30
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLsizeiptr size
Definition: glext.h:5919
GLenum condition
Definition: glext.h:9255
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define d
Definition: ke_i.h:81
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
#define wine_dbgstr_w
Definition: kernel32.h:34
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
__u8 system_id[8]
Definition: mkdosfs.c:1
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2000
const WCHAR * uri
Definition: sec_mgr.c:1564
static const uri_properties uri_tests[]
Definition: uri.c:140
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
static void test_read_element(void)
Definition: reader.c:1405
static void test_reader_pos(IXmlReader *reader, UINT line, UINT pos, UINT line_broken, UINT pos_broken, int _line_)
Definition: reader.c:60
static void test_readerinput(void)
Definition: reader.c:614
static void test_prefix(void)
Definition: reader.c:1985
static HRESULT WINAPI resolver_ResolveUri(IXmlResolver *iface, const WCHAR *base_uri, const WCHAR *public_id, const WCHAR *system_id, IUnknown **input)
Definition: reader.c:496
static const WCHAR * _reader_prefix(unsigned line, IXmlReader *reader, const WCHAR *expect)
Definition: reader.c:296
static const IID * setinput_full_old[]
Definition: reader.c:96
static HRESULT testinput_createinstance(void **ppObj)
Definition: reader.c:402
static void test_eof_state(IXmlReader *reader, BOOL eof)
Definition: reader.c:2229
static ULONG WINAPI testinput_AddRef(IUnknown *iface)
Definition: reader.c:377
static HRESULT WINAPI teststream_QueryInterface(ISequentialStream *iface, REFIID riid, void **obj)
Definition: reader.c:417
static const WCHAR * _reader_qname(IXmlReader *reader, const WCHAR *expect, unsigned line)
Definition: reader.c:324
static const char test_system_dtd[]
Definition: reader.c:1334
static void test_read_public_dtd(void)
Definition: reader.c:1276
#define reader_name(a, b)
Definition: reader.c:281
static struct test_entry text_tests[]
Definition: reader.c:1751
#define read_value_char(a, b)
Definition: reader.c:337
static void test_reader_state(void)
Definition: reader.c:778
#define TEST_READER_STATE(reader, state)
Definition: reader.c:264
#define TEST_DEPTH2(reader, depth, brk)
Definition: reader.c:835
#define ok_iids(got, exp, brk, todo)
Definition: reader.c:133
static void test_namespaceuri(void)
Definition: reader.c:2041
static const WCHAR * _reader_name(unsigned line, IXmlReader *reader, const WCHAR *expect)
Definition: reader.c:282
static void test_read_charref(void)
Definition: reader.c:2133
#define reader_value(a, b)
Definition: reader.c:267
static HRESULT WINAPI teststream_Write(ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written)
Definition: reader.c:456
static HRESULT WINAPI testinput_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObj)
Definition: reader.c:361
static struct test_entry cdata_tests[]
Definition: reader.c:1676
static void test_endoffile(void)
Definition: reader.c:2240
static void test_read_full(void)
Definition: reader.c:1251
#define TEST_DEPTH(reader, depth)
Definition: reader.c:834
static const char xmldecl_full[]
Definition: reader.c:36
static int stream_readcall
Definition: reader.c:439
#define reader_namespace(a, b)
Definition: reader.c:309
static ULONG WINAPI teststream_AddRef(ISequentialStream *iface)
Definition: reader.c:429
static const WCHAR * _reader_value(unsigned line, IXmlReader *reader, const WCHAR *expect)
Definition: reader.c:268
static void test_encoding_detection(void)
Definition: reader.c:2170
static HRESULT WINAPI resolver_QI(IXmlResolver *iface, REFIID riid, void **obj)
Definition: reader.c:471
static const char misc_test_xml[]
Definition: reader.c:1211
static void _read_node(unsigned line, IXmlReader *reader, XmlNodeType expected_type)
Definition: reader.c:217
#define TEST_READER_POSITION(reader, line, pos)
Definition: reader.c:78
static void test_string_pointers(void)
Definition: reader.c:2470
static void test_attribute_by_name(void)
Definition: reader.c:2590
struct _testinput testinput
static void test_read_system_dtd(void)
Definition: reader.c:1338
static const ISequentialStreamVtbl teststreamvtbl
Definition: reader.c:462
#define TEST_READER_STATE2(reader, state, brk)
Definition: reader.c:265
static void _read_value_char(IXmlReader *reader, WCHAR expected_char, unsigned line)
Definition: reader.c:338
static void _next_attribute(unsigned line, IXmlReader *reader)
Definition: reader.c:231
#define reader_prefix(a, b)
Definition: reader.c:295
static ULONG WINAPI resolver_AddRef(IXmlResolver *iface)
Definition: reader.c:486
static const IID * empty_seq[]
Definition: reader.c:110
static const char * type_to_str(XmlNodeType type)
Definition: reader.c:160
static const struct IUnknownVtbl testinput_vtbl
Definition: reader.c:395
static ULONG WINAPI testinput_Release(IUnknown *iface)
Definition: reader.c:383
static IStream * create_stream_on_data(const void *data, unsigned int size)
Definition: reader.c:39
static const char test_public_dtd[]
Definition: reader.c:1273
static const IID * setinput_readerinput[]
Definition: reader.c:104
static const char xmldecl_short[]
Definition: reader.c:37
static const WCHAR * _reader_namespace(unsigned line, IXmlReader *reader, const WCHAR *expect)
Definition: reader.c:310
static void test_isemptyelement(void)
Definition: reader.c:1832
static ULONG WINAPI resolver_Release(IXmlResolver *iface)
Definition: reader.c:491
#define set_input_string(a, b)
Definition: reader.c:202
static ULONG WINAPI teststream_Release(ISequentialStream *iface)
Definition: reader.c:434
static const IID * setinput_full[]
Definition: reader.c:88
static HRESULT WINAPI teststream_Read(ISequentialStream *iface, void *pv, ULONG cb, ULONG *pread)
Definition: reader.c:441
static void test_reader_position(void)
Definition: reader.c:2404
static const char * state_to_str(XmlReadState state)
Definition: reader.c:135
static void test_reader_depth(IXmlReader *reader, UINT depth, UINT brk, int line)
Definition: reader.c:821
static struct nodes_test misc_test
Definition: reader.c:1229
#define read_node(a, b)
Definition: reader.c:216
static void test_read_state(IXmlReader *reader, XmlReadState expected, XmlReadState exp_broken, int line)
Definition: reader.c:246
static void test_read_cdata(void)
Definition: reader.c:1686
static void test_reader_properties(void)
Definition: reader.c:1957
static void test_read_pi(void)
Definition: reader.c:1156
static void test_reader_create(void)
Definition: reader.c:513
#define reader_qname(a, b)
Definition: reader.c:323
static void _move_to_element(unsigned line, IXmlReader *reader)
Definition: reader.c:239
static void test_read_pending(void)
Definition: reader.c:1562
static IXmlResolver testresolver
Definition: reader.c:511
#define move_to_element(a)
Definition: reader.c:238
#define next_attribute(a)
Definition: reader.c:230
static void test_read_text(void)
Definition: reader.c:1760
static void test_max_element_depth(void)
Definition: reader.c:2301
#define TEST_READER_POSITION2(reader, line, pos, line_broken, pos_broken)
Definition: reader.c:80
static struct test_entry pi_tests[]
Definition: reader.c:1141
static input_iids_t input_iids
Definition: reader.c:114
static void test_read_comment(void)
Definition: reader.c:1065
static struct test_entry attributes_tests[]
Definition: reader.c:1878
static void test_read_xmldeclaration(void)
Definition: reader.c:837
static struct test_entry comment_tests[]
Definition: reader.c:1056
static void test_read_attribute(void)
Definition: reader.c:1903
static const IXmlResolverVtbl resolvervtbl
Definition: reader.c:503
static void test_readvaluechunk(void)
Definition: reader.c:1598
static void ok_iids_(const input_iids_t *iids, const IID **expected, const IID **exp_broken, BOOL todo, int line)
Definition: reader.c:116
static struct test_entry_empty empty_element_tests[]
Definition: reader.c:1826
static void _set_input_string(unsigned line, IXmlReader *reader, const char *xml)
Definition: reader.c:203
static struct test_entry element_tests[]
Definition: reader.c:1389
static testinput * impl_from_IUnknown(IUnknown *iface)
Definition: reader.c:356
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define test
Definition: rosglue.h:37
const WCHAR * str
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
#define memset(x, y, z)
Definition: compat.h:39
IUnknown IUnknown_iface
Definition: reader.c:352
LONG ref
Definition: reader.c:353
char * value
Definition: wpp.c:53
char * name
Definition: wpp.c:52
IID iids[10]
Definition: reader.c:84
int count
Definition: reader.c:85
Definition: parser.c:49
Definition: name.c:39
const WCHAR * value
Definition: reader.c:1207
struct nodes_test::@2023 nodes[20]
const char * xml
Definition: reader.c:1204
XmlNodeType type
Definition: reader.c:1206
Definition: mxnamespace.c:38
Definition: reader.h:84
Definition: send.c:48
Definition: parse.h:23
Definition: reader.c:1821
const char * xml
Definition: reader.c:1822
BOOL empty
Definition: reader.c:1823
BOOL todo
Definition: reader.c:1053
const char * xml
Definition: reader.c:1048
const WCHAR * value
Definition: reader.c:1050
HRESULT hr
Definition: reader.c:1051
const WCHAR * name
Definition: reader.c:1049
HRESULT hr_broken
Definition: reader.c:1052
Definition: cmds.c:130
Character const *const prefix
Definition: tempnam.cpp:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:64
#define GHND
Definition: winbase.h:321
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
XmlReadState
Definition: xmllite.idl:98
@ XmlReadState_Closed
Definition: xmllite.idl:103
@ XmlReadState_Error
Definition: xmllite.idl:101
@ XmlReadState_EndOfFile
Definition: xmllite.idl:102
@ XmlReadState_Initial
Definition: xmllite.idl:99
@ XmlReadState_Interactive
Definition: xmllite.idl:100
@ DtdProcessing_Parse
Definition: xmllite.idl:119
@ DtdProcessing_Prohibit
Definition: xmllite.idl:118
@ WC_E_LESSTHAN
Definition: xmllite.idl:151
@ NC_E_UNDECLAREDPREFIX
Definition: xmllite.idl:199
@ WC_E_PI
Definition: xmllite.idl:187
@ WC_E_XMLDECL
Definition: xmllite.idl:177
@ WC_E_DIGIT
Definition: xmllite.idl:153
@ NC_E_QNAMECOLON
Definition: xmllite.idl:196
@ WC_E_SYNTAX
Definition: xmllite.idl:158
@ WC_E_UNDECLAREDENTITY
Definition: xmllite.idl:184
@ SC_E_MAXELEMENTDEPTH
Definition: xmllite.idl:206
@ WC_E_GREATERTHAN
Definition: xmllite.idl:148
@ WC_E_CDSECTEND
Definition: xmllite.idl:190
@ WC_E_NAMECHARACTER
Definition: xmllite.idl:157
@ WC_E_SEMICOLON
Definition: xmllite.idl:147
@ WC_E_ELEMENTMATCH
Definition: xmllite.idl:172
@ NC_E_NAMECOLON
Definition: xmllite.idl:197
@ WC_E_XMLCHARACTER
Definition: xmllite.idl:156
@ NC_E_QNAMECHARACTER
Definition: xmllite.idl:195
@ WC_E_QUOTE
Definition: xmllite.idl:149
@ WC_E_HEXDIGIT
Definition: xmllite.idl:152
@ WC_E_COMMENT
Definition: xmllite.idl:160
@ XmlReaderProperty_MultiLanguage
Definition: xmllite.idl:126
@ XmlReaderProperty_DtdProcessing
Definition: xmllite.idl:130
@ XmlReaderProperty_XmlResolver
Definition: xmllite.idl:129
@ XmlReaderProperty_MaxElementDepth
Definition: xmllite.idl:132
@ XmlReaderProperty_ReadState
Definition: xmllite.idl:131
XmlNodeType
Definition: xmllite.idl:23
@ XmlNodeType_Whitespace
Definition: xmllite.idl:32
@ XmlNodeType_EndElement
Definition: xmllite.idl:33
@ XmlNodeType_ProcessingInstruction
Definition: xmllite.idl:29
@ XmlNodeType_Attribute
Definition: xmllite.idl:26
@ XmlNodeType_CDATA
Definition: xmllite.idl:28
@ XmlNodeType_XmlDeclaration
Definition: xmllite.idl:34
@ XmlNodeType_Comment
Definition: xmllite.idl:30
@ XmlNodeType_DocumentType
Definition: xmllite.idl:31
@ XmlNodeType_None
Definition: xmllite.idl:24
@ XmlNodeType_Element
Definition: xmllite.idl:25
@ XmlNodeType_Text
Definition: xmllite.idl:27