84{
88 IXMLDocument *doc =
NULL;
97
98 static const WCHAR szBankAccount[] = {
'B',
'A',
'N',
'K',
'A',
'C',
'C',
'O',
'U',
'N',
'T',0};
99 static const WCHAR szNumber[] = {
'N',
'U',
'M',
'B',
'E',
'R',0};
100 static const WCHAR szNumVal[] = {
'1',
'2',
'3',
'4',0};
102 static const WCHAR szNameVal[] = {
'C',
'a',
'p',
't',
'a',
'i',
'n',
' ',
'A',
'h',
'a',
'b',0};
104 static const WCHAR rootW[] = {
'r',
'o',
'o',
't',0};
105
107 &IID_IXMLDocument, (void**)&doc);
109
110
113
114
115 hr = IDispatch_GetTypeInfo(disp, 0, 0, &ti);
122
123 ITypeInfo_Release(ti);
124 IDispatch_Release(disp);
125
126 hr = IXMLDocument_QueryInterface(doc, &IID_IXMLDOMDocument, (
void**)&disp);
128
132
134 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
135 ok(psi !=
NULL,
"Expected non-NULL psi\n");
136
137 hr = IXMLDocument_get_root(doc, &
element);
140
141 hr = IPersistStreamInit_Load(psi,
stream);
145
147
148
149 hr = IXMLDocument_get_version(doc,
NULL);
151
153 hr = IXMLDocument_get_version(doc, &
name);
154 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
157
158
159 hr = IXMLDocument_get_doctype(doc,
NULL);
161
162 hr = IXMLDocument_get_doctype(doc, &
name);
163 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
166
167 hr = IXMLDocument_get_root(doc, &
element);
168 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
170
171
172 hr = IXMLDocument_get_root(doc, &
child);
173 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
176 IXMLElement_Release(
child);
177
179 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
180 ok(
type == XMLELEMTYPE_ELEMENT,
"Expected XMLELEMTYPE_ELEMENT, got %d\n",
type);
181
183 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
186
188 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
190
191 hr = IXMLElementCollection_get_length(
collection, &num_child);
192 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
193 ok(num_child == 2,
"Expected 2, got %d\n", num_child);
194
200 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
202
204 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
205 ok(
type == XMLELEMTYPE_ELEMENT,
"Expected XMLELEMTYPE_ELEMENT, got %d\n",
type);
206
208 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
211
212 hr = IXMLElement_get_children(
child, &inner);
213 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
214 ok(inner !=
NULL,
"Expected non-NULL inner\n");
215
216 hr = IXMLElementCollection_get_length(inner, &num_child);
217 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
218 ok(num_child == 1,
"Expected 1, got %d\n", num_child);
219
220 hr = IXMLElementCollection_item(inner, vIndex, vName, (
IDispatch **)&
value);
221 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
223
225 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
226 ok(
type == XMLELEMTYPE_TEXT,
"Expected XMLELEMTYPE_TEXT, got %d\n",
type);
227
229 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
232
233 IXMLElementCollection_Release(inner);
234
235 inner = (IXMLElementCollection *)0xdeadbeef;
236 hr = IXMLElement_get_children(
value, &inner);
237 ok(
hr == 1,
"Expected 1, got %08x\n",
hr);
238 ok(inner ==
NULL,
"Expected NULL inner, got %p\n", inner);
239
240 IXMLElement_Release(
value);
241 IXMLElement_Release(
child);
244
247 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
249
251 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
252 ok(
type == XMLELEMTYPE_ELEMENT,
"Expected XMLELEMTYPE_ELEMENT, got %d\n",
type);
253
255 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
258
259 hr = IXMLElement_get_children(
child, &inner);
260 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
261 ok(inner !=
NULL,
"Expected non-NULL inner\n");
262
263 hr = IXMLElementCollection_get_length(inner, &num_child);
264 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
265 ok(num_child == 1,
"Expected 1, got %d\n", num_child);
266
268 hr = IXMLElementCollection_item(inner, vIndex, vName, (
IDispatch **)&
value);
269 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
271
273 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
274 ok(
type == XMLELEMTYPE_TEXT,
"Expected XMLELEMTYPE_TEXT, got %d\n",
type);
275
277 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
280
281 IXMLElementCollection_Release(inner);
282
283 inner = (IXMLElementCollection *)0xdeadbeef;
284 hr = IXMLElement_get_children(
value, &inner);
285 ok(
hr == 1,
"Expected 1, got %08x\n",
hr);
286 ok(inner ==
NULL,
"Expected NULL inner, got %p\n", inner);
287
288 IXMLElement_Release(
value);
289 IXMLElement_Release(
child);
294 IPersistStreamInit_Release(psi);
295 IXMLDocument_Release(doc);
296
298}
static const WCHAR rootW[]
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
#define EXPECT_HR(hr, hr_exp)
static ICollection collection
#define DISPID_XMLDOCUMENT_ROOT
static const WCHAR szName[]
#define DISP_E_PARAMNOTFOUND