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