[MSXML3]
[reactos.git] / reactos / dll / win32 / msxml3 / pi.c
1 /*
2 * DOM processing instruction node implementation
3 *
4 * Copyright 2006 Huw Davies
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 #include "precomp.h"
22
23 #ifdef HAVE_LIBXML2
24
25 typedef struct _dom_pi
26 {
27 xmlnode node;
28 IXMLDOMProcessingInstruction IXMLDOMProcessingInstruction_iface;
29 LONG ref;
30 } dom_pi;
31
32 static const struct nodemap_funcs dom_pi_attr_map;
33
34 static const tid_t dompi_se_tids[] = {
35 IXMLDOMNode_tid,
36 IXMLDOMProcessingInstruction_tid,
37 NULL_tid
38 };
39
40 static inline dom_pi *impl_from_IXMLDOMProcessingInstruction( IXMLDOMProcessingInstruction *iface )
41 {
42 return CONTAINING_RECORD(iface, dom_pi, IXMLDOMProcessingInstruction_iface);
43 }
44
45 static HRESULT WINAPI dom_pi_QueryInterface(
46 IXMLDOMProcessingInstruction *iface,
47 REFIID riid,
48 void** ppvObject )
49 {
50 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
51 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
52
53 if ( IsEqualGUID( riid, &IID_IXMLDOMProcessingInstruction ) ||
54 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
55 IsEqualGUID( riid, &IID_IDispatch ) ||
56 IsEqualGUID( riid, &IID_IUnknown ) )
57 {
58 *ppvObject = iface;
59 }
60 else if(node_query_interface(&This->node, riid, ppvObject))
61 {
62 return *ppvObject ? S_OK : E_NOINTERFACE;
63 }
64 else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
65 {
66 return node_create_supporterrorinfo(dompi_se_tids, ppvObject);
67 }
68 else
69 {
70 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
71 *ppvObject = NULL;
72 return E_NOINTERFACE;
73 }
74
75 IUnknown_AddRef((IUnknown*)*ppvObject);
76 return S_OK;
77 }
78
79 static ULONG WINAPI dom_pi_AddRef(
80 IXMLDOMProcessingInstruction *iface )
81 {
82 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
83 ULONG ref = InterlockedIncrement( &This->ref );
84 TRACE("(%p)->(%d)\n", This, ref);
85 return ref;
86 }
87
88 static ULONG WINAPI dom_pi_Release(
89 IXMLDOMProcessingInstruction *iface )
90 {
91 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
92 ULONG ref = InterlockedDecrement( &This->ref );
93
94 TRACE("(%p)->(%d)\n", This, ref);
95 if ( ref == 0 )
96 {
97 destroy_xmlnode(&This->node);
98 heap_free( This );
99 }
100
101 return ref;
102 }
103
104 static HRESULT WINAPI dom_pi_GetTypeInfoCount(
105 IXMLDOMProcessingInstruction *iface,
106 UINT* pctinfo )
107 {
108 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
109 return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
110 }
111
112 static HRESULT WINAPI dom_pi_GetTypeInfo(
113 IXMLDOMProcessingInstruction *iface,
114 UINT iTInfo, LCID lcid,
115 ITypeInfo** ppTInfo )
116 {
117 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
118 return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface,
119 iTInfo, lcid, ppTInfo);
120 }
121
122 static HRESULT WINAPI dom_pi_GetIDsOfNames(
123 IXMLDOMProcessingInstruction *iface,
124 REFIID riid, LPOLESTR* rgszNames,
125 UINT cNames, LCID lcid, DISPID* rgDispId )
126 {
127 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
128 return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface,
129 riid, rgszNames, cNames, lcid, rgDispId);
130 }
131
132 static HRESULT WINAPI dom_pi_Invoke(
133 IXMLDOMProcessingInstruction *iface,
134 DISPID dispIdMember, REFIID riid, LCID lcid,
135 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
136 EXCEPINFO* pExcepInfo, UINT* puArgErr )
137 {
138 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
139 return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface,
140 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
141 }
142
143 static HRESULT WINAPI dom_pi_get_nodeName(
144 IXMLDOMProcessingInstruction *iface,
145 BSTR* p )
146 {
147 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
148
149 TRACE("(%p)->(%p)\n", This, p);
150
151 return node_get_nodeName(&This->node, p);
152 }
153
154 static HRESULT WINAPI dom_pi_get_nodeValue(
155 IXMLDOMProcessingInstruction *iface,
156 VARIANT* value)
157 {
158 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
159
160 TRACE("(%p)->(%p)\n", This, value);
161
162 return node_get_content(&This->node, value);
163 }
164
165 static HRESULT WINAPI dom_pi_put_nodeValue(
166 IXMLDOMProcessingInstruction *iface,
167 VARIANT value)
168 {
169 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
170 BSTR target;
171 HRESULT hr;
172
173 TRACE("(%p)->(%s)\n", This, debugstr_variant(&value));
174
175 /* Cannot set data to a PI node whose target is 'xml' */
176 hr = IXMLDOMProcessingInstruction_get_nodeName(iface, &target);
177 if(hr == S_OK)
178 {
179 static const WCHAR xmlW[] = {'x','m','l',0};
180 if(!strcmpW(target, xmlW))
181 {
182 SysFreeString(target);
183 return E_FAIL;
184 }
185
186 SysFreeString(target);
187 }
188
189 return node_put_value(&This->node, &value);
190 }
191
192 static HRESULT WINAPI dom_pi_get_nodeType(
193 IXMLDOMProcessingInstruction *iface,
194 DOMNodeType* domNodeType )
195 {
196 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
197
198 TRACE("(%p)->(%p)\n", This, domNodeType);
199
200 *domNodeType = NODE_PROCESSING_INSTRUCTION;
201 return S_OK;
202 }
203
204 static HRESULT WINAPI dom_pi_get_parentNode(
205 IXMLDOMProcessingInstruction *iface,
206 IXMLDOMNode** parent )
207 {
208 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
209
210 TRACE("(%p)->(%p)\n", This, parent);
211
212 return node_get_parent(&This->node, parent);
213 }
214
215 static HRESULT WINAPI dom_pi_get_childNodes(
216 IXMLDOMProcessingInstruction *iface,
217 IXMLDOMNodeList** outList)
218 {
219 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
220
221 TRACE("(%p)->(%p)\n", This, outList);
222
223 return node_get_child_nodes(&This->node, outList);
224 }
225
226 static HRESULT WINAPI dom_pi_get_firstChild(
227 IXMLDOMProcessingInstruction *iface,
228 IXMLDOMNode** domNode)
229 {
230 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
231
232 TRACE("(%p)->(%p)\n", This, domNode);
233
234 return return_null_node(domNode);
235 }
236
237 static HRESULT WINAPI dom_pi_get_lastChild(
238 IXMLDOMProcessingInstruction *iface,
239 IXMLDOMNode** domNode)
240 {
241 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
242
243 TRACE("(%p)->(%p)\n", This, domNode);
244
245 return return_null_node(domNode);
246 }
247
248 static HRESULT WINAPI dom_pi_get_previousSibling(
249 IXMLDOMProcessingInstruction *iface,
250 IXMLDOMNode** domNode)
251 {
252 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
253
254 TRACE("(%p)->(%p)\n", This, domNode);
255
256 return node_get_previous_sibling(&This->node, domNode);
257 }
258
259 static HRESULT WINAPI dom_pi_get_nextSibling(
260 IXMLDOMProcessingInstruction *iface,
261 IXMLDOMNode** domNode)
262 {
263 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
264
265 TRACE("(%p)->(%p)\n", This, domNode);
266
267 return node_get_next_sibling(&This->node, domNode);
268 }
269
270 static HRESULT WINAPI dom_pi_get_attributes(
271 IXMLDOMProcessingInstruction *iface,
272 IXMLDOMNamedNodeMap** map)
273 {
274 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
275 static const WCHAR xmlW[] = {'x','m','l',0};
276 HRESULT hr;
277 BSTR name;
278
279 TRACE("(%p)->(%p)\n", This, map);
280
281 if (!map) return E_INVALIDARG;
282
283 *map = NULL;
284
285 hr = node_get_nodeName(&This->node, &name);
286 if (hr != S_OK) return hr;
287
288 if (!strcmpW(name, xmlW))
289 {
290 FIXME("created dummy map for <?xml ?>\n");
291 *map = create_nodemap(This->node.node, &dom_pi_attr_map);
292 SysFreeString(name);
293 return S_OK;
294 }
295
296 SysFreeString(name);
297
298 return S_FALSE;
299 }
300
301 static HRESULT WINAPI dom_pi_insertBefore(
302 IXMLDOMProcessingInstruction *iface,
303 IXMLDOMNode* newNode, VARIANT refChild,
304 IXMLDOMNode** outOldNode)
305 {
306 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
307
308 FIXME("(%p)->(%p %s %p) needs test\n", This, newNode, debugstr_variant(&refChild), outOldNode);
309
310 return node_insert_before(&This->node, newNode, &refChild, outOldNode);
311 }
312
313 static HRESULT WINAPI dom_pi_replaceChild(
314 IXMLDOMProcessingInstruction *iface,
315 IXMLDOMNode* newNode,
316 IXMLDOMNode* oldNode,
317 IXMLDOMNode** outOldNode)
318 {
319 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
320
321 FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
322
323 return node_replace_child(&This->node, newNode, oldNode, outOldNode);
324 }
325
326 static HRESULT WINAPI dom_pi_removeChild(
327 IXMLDOMProcessingInstruction *iface,
328 IXMLDOMNode *child, IXMLDOMNode **oldChild)
329 {
330 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
331 TRACE("(%p)->(%p %p)\n", This, child, oldChild);
332 return node_remove_child(&This->node, child, oldChild);
333 }
334
335 static HRESULT WINAPI dom_pi_appendChild(
336 IXMLDOMProcessingInstruction *iface,
337 IXMLDOMNode *child, IXMLDOMNode **outChild)
338 {
339 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
340 TRACE("(%p)->(%p %p)\n", This, child, outChild);
341 return node_append_child(&This->node, child, outChild);
342 }
343
344 static HRESULT WINAPI dom_pi_hasChildNodes(
345 IXMLDOMProcessingInstruction *iface,
346 VARIANT_BOOL *ret)
347 {
348 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
349 TRACE("(%p)->(%p)\n", This, ret);
350 return node_has_childnodes(&This->node, ret);
351 }
352
353 static HRESULT WINAPI dom_pi_get_ownerDocument(
354 IXMLDOMProcessingInstruction *iface,
355 IXMLDOMDocument **doc)
356 {
357 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
358 TRACE("(%p)->(%p)\n", This, doc);
359 return node_get_owner_doc(&This->node, doc);
360 }
361
362 static HRESULT WINAPI dom_pi_cloneNode(
363 IXMLDOMProcessingInstruction *iface,
364 VARIANT_BOOL deep, IXMLDOMNode** outNode)
365 {
366 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
367 TRACE("(%p)->(%d %p)\n", This, deep, outNode);
368 return node_clone( &This->node, deep, outNode );
369 }
370
371 static HRESULT WINAPI dom_pi_get_nodeTypeString(
372 IXMLDOMProcessingInstruction *iface,
373 BSTR* p)
374 {
375 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
376 static const WCHAR processinginstructionW[] =
377 {'p','r','o','c','e','s','s','i','n','g','i','n','s','t','r','u','c','t','i','o','n',0};
378
379 TRACE("(%p)->(%p)\n", This, p);
380
381 return return_bstr(processinginstructionW, p);
382 }
383
384 static HRESULT WINAPI dom_pi_get_text(
385 IXMLDOMProcessingInstruction *iface,
386 BSTR* p)
387 {
388 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
389 TRACE("(%p)->(%p)\n", This, p);
390 return node_get_text(&This->node, p);
391 }
392
393 static HRESULT WINAPI dom_pi_put_text(
394 IXMLDOMProcessingInstruction *iface,
395 BSTR p)
396 {
397 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
398 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
399 return node_put_text( &This->node, p );
400 }
401
402 static HRESULT WINAPI dom_pi_get_specified(
403 IXMLDOMProcessingInstruction *iface,
404 VARIANT_BOOL* isSpecified)
405 {
406 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
407 FIXME("(%p)->(%p) stub!\n", This, isSpecified);
408 *isSpecified = VARIANT_TRUE;
409 return S_OK;
410 }
411
412 static HRESULT WINAPI dom_pi_get_definition(
413 IXMLDOMProcessingInstruction *iface,
414 IXMLDOMNode** definitionNode)
415 {
416 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
417 FIXME("(%p)->(%p)\n", This, definitionNode);
418 return E_NOTIMPL;
419 }
420
421 static HRESULT WINAPI dom_pi_get_nodeTypedValue(
422 IXMLDOMProcessingInstruction *iface,
423 VARIANT* v)
424 {
425 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
426 TRACE("(%p)->(%p)\n", This, v);
427 return node_get_content(&This->node, v);
428 }
429
430 static HRESULT WINAPI dom_pi_put_nodeTypedValue(
431 IXMLDOMProcessingInstruction *iface,
432 VARIANT typedValue)
433 {
434 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
435 FIXME("(%p)->(%s)\n", This, debugstr_variant(&typedValue));
436 return E_NOTIMPL;
437 }
438
439 static HRESULT WINAPI dom_pi_get_dataType(
440 IXMLDOMProcessingInstruction *iface,
441 VARIANT* typename)
442 {
443 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
444 TRACE("(%p)->(%p)\n", This, typename);
445 return return_null_var( typename );
446 }
447
448 static HRESULT WINAPI dom_pi_put_dataType(
449 IXMLDOMProcessingInstruction *iface,
450 BSTR p)
451 {
452 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
453
454 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
455
456 if(!p)
457 return E_INVALIDARG;
458
459 return E_FAIL;
460 }
461
462 static HRESULT WINAPI dom_pi_get_xml(
463 IXMLDOMProcessingInstruction *iface,
464 BSTR* p)
465 {
466 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
467
468 TRACE("(%p)->(%p)\n", This, p);
469
470 return node_get_xml(&This->node, FALSE, p);
471 }
472
473 static HRESULT WINAPI dom_pi_transformNode(
474 IXMLDOMProcessingInstruction *iface,
475 IXMLDOMNode *node, BSTR *p)
476 {
477 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
478 TRACE("(%p)->(%p %p)\n", This, node, p);
479 return node_transform_node(&This->node, node, p);
480 }
481
482 static HRESULT WINAPI dom_pi_selectNodes(
483 IXMLDOMProcessingInstruction *iface,
484 BSTR p, IXMLDOMNodeList** outList)
485 {
486 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
487 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outList);
488 return node_select_nodes(&This->node, p, outList);
489 }
490
491 static HRESULT WINAPI dom_pi_selectSingleNode(
492 IXMLDOMProcessingInstruction *iface,
493 BSTR p, IXMLDOMNode** outNode)
494 {
495 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
496 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outNode);
497 return node_select_singlenode(&This->node, p, outNode);
498 }
499
500 static HRESULT WINAPI dom_pi_get_parsed(
501 IXMLDOMProcessingInstruction *iface,
502 VARIANT_BOOL* isParsed)
503 {
504 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
505 FIXME("(%p)->(%p) stub!\n", This, isParsed);
506 *isParsed = VARIANT_TRUE;
507 return S_OK;
508 }
509
510 static HRESULT WINAPI dom_pi_get_namespaceURI(
511 IXMLDOMProcessingInstruction *iface,
512 BSTR* p)
513 {
514 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
515 TRACE("(%p)->(%p)\n", This, p);
516 return node_get_namespaceURI(&This->node, p);
517 }
518
519 static HRESULT WINAPI dom_pi_get_prefix(
520 IXMLDOMProcessingInstruction *iface,
521 BSTR* prefix)
522 {
523 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
524 TRACE("(%p)->(%p)\n", This, prefix);
525 return return_null_bstr( prefix );
526 }
527
528 static HRESULT WINAPI dom_pi_get_baseName(
529 IXMLDOMProcessingInstruction *iface,
530 BSTR* name)
531 {
532 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
533 TRACE("(%p)->(%p)\n", This, name);
534 return node_get_base_name( &This->node, name );
535 }
536
537 static HRESULT WINAPI dom_pi_transformNodeToObject(
538 IXMLDOMProcessingInstruction *iface,
539 IXMLDOMNode* domNode, VARIANT var1)
540 {
541 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
542 FIXME("(%p)->(%p %s)\n", This, domNode, debugstr_variant(&var1));
543 return E_NOTIMPL;
544 }
545
546 static HRESULT WINAPI dom_pi_get_target(
547 IXMLDOMProcessingInstruction *iface,
548 BSTR *p)
549 {
550 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
551
552 TRACE("(%p)->(%p)\n", This, p);
553
554 /* target returns the same value as nodeName property */
555 return node_get_nodeName(&This->node, p);
556 }
557
558 static HRESULT WINAPI dom_pi_get_data(
559 IXMLDOMProcessingInstruction *iface,
560 BSTR *p)
561 {
562 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
563 HRESULT hr;
564 VARIANT ret;
565
566 TRACE("(%p)->(%p)\n", This, p);
567
568 if(!p)
569 return E_INVALIDARG;
570
571 hr = IXMLDOMProcessingInstruction_get_nodeValue( iface, &ret );
572 if(hr == S_OK)
573 {
574 *p = V_BSTR(&ret);
575 }
576
577 return hr;
578 }
579
580 static HRESULT WINAPI dom_pi_put_data(
581 IXMLDOMProcessingInstruction *iface,
582 BSTR data)
583 {
584 dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
585 BSTR target;
586 HRESULT hr;
587
588 TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
589
590 /* cannot set data to a PI node whose target is 'xml' */
591 hr = IXMLDOMProcessingInstruction_get_nodeName(iface, &target);
592 if(hr == S_OK)
593 {
594 static const WCHAR xmlW[] = {'x','m','l',0};
595 if(!strcmpW(target, xmlW))
596 {
597 SysFreeString(target);
598 return E_FAIL;
599 }
600
601 SysFreeString(target);
602 }
603
604 return node_set_content(&This->node, data);
605 }
606
607 static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
608 {
609 dom_pi_QueryInterface,
610 dom_pi_AddRef,
611 dom_pi_Release,
612 dom_pi_GetTypeInfoCount,
613 dom_pi_GetTypeInfo,
614 dom_pi_GetIDsOfNames,
615 dom_pi_Invoke,
616 dom_pi_get_nodeName,
617 dom_pi_get_nodeValue,
618 dom_pi_put_nodeValue,
619 dom_pi_get_nodeType,
620 dom_pi_get_parentNode,
621 dom_pi_get_childNodes,
622 dom_pi_get_firstChild,
623 dom_pi_get_lastChild,
624 dom_pi_get_previousSibling,
625 dom_pi_get_nextSibling,
626 dom_pi_get_attributes,
627 dom_pi_insertBefore,
628 dom_pi_replaceChild,
629 dom_pi_removeChild,
630 dom_pi_appendChild,
631 dom_pi_hasChildNodes,
632 dom_pi_get_ownerDocument,
633 dom_pi_cloneNode,
634 dom_pi_get_nodeTypeString,
635 dom_pi_get_text,
636 dom_pi_put_text,
637 dom_pi_get_specified,
638 dom_pi_get_definition,
639 dom_pi_get_nodeTypedValue,
640 dom_pi_put_nodeTypedValue,
641 dom_pi_get_dataType,
642 dom_pi_put_dataType,
643 dom_pi_get_xml,
644 dom_pi_transformNode,
645 dom_pi_selectNodes,
646 dom_pi_selectSingleNode,
647 dom_pi_get_parsed,
648 dom_pi_get_namespaceURI,
649 dom_pi_get_prefix,
650 dom_pi_get_baseName,
651 dom_pi_transformNodeToObject,
652
653 dom_pi_get_target,
654 dom_pi_get_data,
655 dom_pi_put_data
656 };
657
658 static HRESULT dom_pi_get_qualified_item(const xmlNodePtr node, BSTR name, BSTR uri,
659 IXMLDOMNode **item)
660 {
661 FIXME("(%p)->(%s %s %p): stub\n", node, debugstr_w(name), debugstr_w(uri), item);
662 return E_NOTIMPL;
663 }
664
665 static HRESULT dom_pi_get_named_item(const xmlNodePtr node, BSTR name, IXMLDOMNode **item)
666 {
667 FIXME("(%p)->(%s %p): stub\n", node, debugstr_w(name), item );
668 return E_NOTIMPL;
669 }
670
671 static HRESULT dom_pi_set_named_item(xmlNodePtr node, IXMLDOMNode *newItem, IXMLDOMNode **namedItem)
672 {
673 FIXME("(%p)->(%p %p): stub\n", node, newItem, namedItem );
674 return E_NOTIMPL;
675 }
676
677 static HRESULT dom_pi_remove_qualified_item(xmlNodePtr node, BSTR name, BSTR uri, IXMLDOMNode **item)
678 {
679 FIXME("(%p)->(%s %s %p): stub\n", node, debugstr_w(name), debugstr_w(uri), item);
680 return E_NOTIMPL;
681 }
682
683 static HRESULT dom_pi_remove_named_item(xmlNodePtr node, BSTR name, IXMLDOMNode **item)
684 {
685 FIXME("(%p)->(%s %p): stub\n", node, debugstr_w(name), item);
686 return E_NOTIMPL;
687 }
688
689 static HRESULT dom_pi_get_item(const xmlNodePtr node, LONG index, IXMLDOMNode **item)
690 {
691 FIXME("(%p)->(%d %p): stub\n", node, index, item);
692 return E_NOTIMPL;
693 }
694
695 static HRESULT dom_pi_get_length(const xmlNodePtr node, LONG *length)
696 {
697 FIXME("(%p)->(%p): stub\n", node, length);
698
699 *length = 0;
700 return S_OK;
701 }
702
703 static HRESULT dom_pi_next_node(const xmlNodePtr node, LONG *iter, IXMLDOMNode **nextNode)
704 {
705 FIXME("(%p)->(%d %p): stub\n", node, *iter, nextNode);
706 return E_NOTIMPL;
707 }
708
709 static const struct nodemap_funcs dom_pi_attr_map = {
710 dom_pi_get_named_item,
711 dom_pi_set_named_item,
712 dom_pi_remove_named_item,
713 dom_pi_get_item,
714 dom_pi_get_length,
715 dom_pi_get_qualified_item,
716 dom_pi_remove_qualified_item,
717 dom_pi_next_node
718 };
719
720 static const tid_t dompi_iface_tids[] = {
721 IXMLDOMProcessingInstruction_tid,
722 0
723 };
724
725 static dispex_static_data_t dompi_dispex = {
726 NULL,
727 IXMLDOMProcessingInstruction_tid,
728 NULL,
729 dompi_iface_tids
730 };
731
732 IUnknown* create_pi( xmlNodePtr pi )
733 {
734 dom_pi *This;
735
736 This = heap_alloc( sizeof *This );
737 if ( !This )
738 return NULL;
739
740 This->IXMLDOMProcessingInstruction_iface.lpVtbl = &dom_pi_vtbl;
741 This->ref = 1;
742
743 init_xmlnode(&This->node, pi, (IXMLDOMNode*)&This->IXMLDOMProcessingInstruction_iface, &dompi_dispex);
744
745 return (IUnknown*)&This->IXMLDOMProcessingInstruction_iface;
746 }
747
748 #endif