2 * DOM processing instruction node implementation
4 * Copyright 2006 Huw Davies
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.
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.
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
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
40 typedef struct _dom_pi
42 const struct IXMLDOMProcessingInstructionVtbl
*lpVtbl
;
48 static inline dom_pi
*impl_from_IXMLDOMProcessingInstruction( IXMLDOMProcessingInstruction
*iface
)
50 return (dom_pi
*)((char*)iface
- FIELD_OFFSET(dom_pi
, lpVtbl
));
53 static HRESULT WINAPI
dom_pi_QueryInterface(
54 IXMLDOMProcessingInstruction
*iface
,
58 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
59 TRACE("%p %s %p\n", This
, debugstr_guid(riid
), ppvObject
);
61 if ( IsEqualGUID( riid
, &IID_IXMLDOMProcessingInstruction
) ||
62 IsEqualGUID( riid
, &IID_IUnknown
) )
66 else if ( IsEqualGUID( riid
, &IID_IDispatch
) ||
67 IsEqualGUID( riid
, &IID_IXMLDOMNode
) )
69 return IUnknown_QueryInterface(This
->node_unk
, riid
, ppvObject
);
73 FIXME("Unsupported inteferace %s\n", debugstr_guid(riid
));
77 IXMLDOMProcessingInstruction_AddRef( iface
);
82 static ULONG WINAPI
dom_pi_AddRef(
83 IXMLDOMProcessingInstruction
*iface
)
85 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
86 return InterlockedIncrement( &This
->ref
);
89 static ULONG WINAPI
dom_pi_Release(
90 IXMLDOMProcessingInstruction
*iface
)
92 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
95 ref
= InterlockedDecrement( &This
->ref
);
98 IUnknown_Release( This
->node_unk
);
99 HeapFree( GetProcessHeap(), 0, This
);
105 static HRESULT WINAPI
dom_pi_GetTypeInfoCount(
106 IXMLDOMProcessingInstruction
*iface
,
113 static HRESULT WINAPI
dom_pi_GetTypeInfo(
114 IXMLDOMProcessingInstruction
*iface
,
115 UINT iTInfo
, LCID lcid
,
116 ITypeInfo
** ppTInfo
)
122 static HRESULT WINAPI
dom_pi_GetIDsOfNames(
123 IXMLDOMProcessingInstruction
*iface
,
124 REFIID riid
, LPOLESTR
* rgszNames
,
125 UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
131 static HRESULT WINAPI
dom_pi_Invoke(
132 IXMLDOMProcessingInstruction
*iface
,
133 DISPID dispIdMember
, REFIID riid
, LCID lcid
,
134 WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
,
135 EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
141 static HRESULT WINAPI
dom_pi_get_nodeName(
142 IXMLDOMProcessingInstruction
*iface
,
145 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
146 return IXMLDOMNode_get_nodeName( This
->node
, p
);
149 static HRESULT WINAPI
dom_pi_get_nodeValue(
150 IXMLDOMProcessingInstruction
*iface
,
153 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
154 return IXMLDOMNode_get_nodeValue( This
->node
, var1
);
157 static HRESULT WINAPI
dom_pi_put_nodeValue(
158 IXMLDOMProcessingInstruction
*iface
,
161 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
162 return IXMLDOMNode_put_nodeValue( This
->node
, var1
);
165 static HRESULT WINAPI
dom_pi_get_nodeType(
166 IXMLDOMProcessingInstruction
*iface
,
167 DOMNodeType
* domNodeType
)
169 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
170 return IXMLDOMNode_get_nodeType( This
->node
, domNodeType
);
173 static HRESULT WINAPI
dom_pi_get_parentNode(
174 IXMLDOMProcessingInstruction
*iface
,
175 IXMLDOMNode
** parent
)
177 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
178 return IXMLDOMNode_get_parentNode( This
->node
, parent
);
181 static HRESULT WINAPI
dom_pi_get_childNodes(
182 IXMLDOMProcessingInstruction
*iface
,
183 IXMLDOMNodeList
** outList
)
185 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
186 return IXMLDOMNode_get_childNodes( This
->node
, outList
);
189 static HRESULT WINAPI
dom_pi_get_firstChild(
190 IXMLDOMProcessingInstruction
*iface
,
191 IXMLDOMNode
** domNode
)
193 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
194 return IXMLDOMNode_get_firstChild( This
->node
, domNode
);
197 static HRESULT WINAPI
dom_pi_get_lastChild(
198 IXMLDOMProcessingInstruction
*iface
,
199 IXMLDOMNode
** domNode
)
201 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
202 return IXMLDOMNode_get_lastChild( This
->node
, domNode
);
205 static HRESULT WINAPI
dom_pi_get_previousSibling(
206 IXMLDOMProcessingInstruction
*iface
,
207 IXMLDOMNode
** domNode
)
209 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
210 return IXMLDOMNode_get_previousSibling( This
->node
, domNode
);
213 static HRESULT WINAPI
dom_pi_get_nextSibling(
214 IXMLDOMProcessingInstruction
*iface
,
215 IXMLDOMNode
** domNode
)
217 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
218 return IXMLDOMNode_get_nextSibling( This
->node
, domNode
);
221 static HRESULT WINAPI
dom_pi_get_attributes(
222 IXMLDOMProcessingInstruction
*iface
,
223 IXMLDOMNamedNodeMap
** attributeMap
)
225 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
226 return IXMLDOMNode_get_attributes( This
->node
, attributeMap
);
229 static HRESULT WINAPI
dom_pi_insertBefore(
230 IXMLDOMProcessingInstruction
*iface
,
231 IXMLDOMNode
* newNode
, VARIANT var1
,
232 IXMLDOMNode
** outOldNode
)
234 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
235 return IXMLDOMNode_insertBefore( This
->node
, newNode
, var1
, outOldNode
);
238 static HRESULT WINAPI
dom_pi_replaceChild(
239 IXMLDOMProcessingInstruction
*iface
,
240 IXMLDOMNode
* newNode
,
241 IXMLDOMNode
* oldNode
,
242 IXMLDOMNode
** outOldNode
)
244 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
245 return IXMLDOMNode_replaceChild( This
->node
, newNode
, oldNode
, outOldNode
);
248 static HRESULT WINAPI
dom_pi_removeChild(
249 IXMLDOMProcessingInstruction
*iface
,
250 IXMLDOMNode
* domNode
, IXMLDOMNode
** oldNode
)
252 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
253 return IXMLDOMNode_removeChild( This
->node
, domNode
, oldNode
);
256 static HRESULT WINAPI
dom_pi_appendChild(
257 IXMLDOMProcessingInstruction
*iface
,
258 IXMLDOMNode
* newNode
, IXMLDOMNode
** outNewNode
)
260 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
261 return IXMLDOMNode_appendChild( This
->node
, newNode
, outNewNode
);
264 static HRESULT WINAPI
dom_pi_hasChildNodes(
265 IXMLDOMProcessingInstruction
*iface
,
268 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
269 return IXMLDOMNode_hasChildNodes( This
->node
, pbool
);
272 static HRESULT WINAPI
dom_pi_get_ownerDocument(
273 IXMLDOMProcessingInstruction
*iface
,
274 IXMLDOMDocument
** domDocument
)
276 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
277 return IXMLDOMNode_get_ownerDocument( This
->node
, domDocument
);
280 static HRESULT WINAPI
dom_pi_cloneNode(
281 IXMLDOMProcessingInstruction
*iface
,
282 VARIANT_BOOL pbool
, IXMLDOMNode
** outNode
)
284 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
285 return IXMLDOMNode_cloneNode( This
->node
, pbool
, outNode
);
288 static HRESULT WINAPI
dom_pi_get_nodeTypeString(
289 IXMLDOMProcessingInstruction
*iface
,
292 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
293 return IXMLDOMNode_get_nodeTypeString( This
->node
, p
);
296 static HRESULT WINAPI
dom_pi_get_text(
297 IXMLDOMProcessingInstruction
*iface
,
300 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
301 return IXMLDOMNode_get_text( This
->node
, p
);
304 static HRESULT WINAPI
dom_pi_put_text(
305 IXMLDOMProcessingInstruction
*iface
,
308 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
309 return IXMLDOMNode_put_text( This
->node
, p
);
312 static HRESULT WINAPI
dom_pi_get_specified(
313 IXMLDOMProcessingInstruction
*iface
,
316 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
317 return IXMLDOMNode_get_specified( This
->node
, pbool
);
320 static HRESULT WINAPI
dom_pi_get_definition(
321 IXMLDOMProcessingInstruction
*iface
,
322 IXMLDOMNode
** domNode
)
324 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
325 return IXMLDOMNode_get_definition( This
->node
, domNode
);
328 static HRESULT WINAPI
dom_pi_get_nodeTypedValue(
329 IXMLDOMProcessingInstruction
*iface
,
332 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
333 return IXMLDOMNode_get_nodeTypedValue( This
->node
, var1
);
336 static HRESULT WINAPI
dom_pi_put_nodeTypedValue(
337 IXMLDOMProcessingInstruction
*iface
,
340 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
341 return IXMLDOMNode_put_nodeTypedValue( This
->node
, var1
);
344 static HRESULT WINAPI
dom_pi_get_dataType(
345 IXMLDOMProcessingInstruction
*iface
,
348 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
349 return IXMLDOMNode_get_dataType( This
->node
, var1
);
352 static HRESULT WINAPI
dom_pi_put_dataType(
353 IXMLDOMProcessingInstruction
*iface
,
356 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
357 return IXMLDOMNode_put_dataType( This
->node
, p
);
360 static HRESULT WINAPI
dom_pi_get_xml(
361 IXMLDOMProcessingInstruction
*iface
,
364 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
365 return IXMLDOMNode_get_xml( This
->node
, p
);
368 static HRESULT WINAPI
dom_pi_transformNode(
369 IXMLDOMProcessingInstruction
*iface
,
370 IXMLDOMNode
* domNode
, BSTR
* p
)
372 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
373 return IXMLDOMNode_transformNode( This
->node
, domNode
, p
);
376 static HRESULT WINAPI
dom_pi_selectNodes(
377 IXMLDOMProcessingInstruction
*iface
,
378 BSTR p
, IXMLDOMNodeList
** outList
)
380 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
381 return IXMLDOMNode_selectNodes( This
->node
, p
, outList
);
384 static HRESULT WINAPI
dom_pi_selectSingleNode(
385 IXMLDOMProcessingInstruction
*iface
,
386 BSTR p
, IXMLDOMNode
** outNode
)
388 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
389 return IXMLDOMNode_selectSingleNode( This
->node
, p
, outNode
);
392 static HRESULT WINAPI
dom_pi_get_parsed(
393 IXMLDOMProcessingInstruction
*iface
,
396 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
397 return IXMLDOMNode_get_parsed( This
->node
, pbool
);
400 static HRESULT WINAPI
dom_pi_get_namespaceURI(
401 IXMLDOMProcessingInstruction
*iface
,
404 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
405 return IXMLDOMNode_get_namespaceURI( This
->node
, p
);
408 static HRESULT WINAPI
dom_pi_get_prefix(
409 IXMLDOMProcessingInstruction
*iface
,
412 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
413 return IXMLDOMNode_get_prefix( This
->node
, p
);
416 static HRESULT WINAPI
dom_pi_get_baseName(
417 IXMLDOMProcessingInstruction
*iface
,
420 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
421 return IXMLDOMNode_get_baseName( This
->node
, p
);
424 static HRESULT WINAPI
dom_pi_transformNodeToObject(
425 IXMLDOMProcessingInstruction
*iface
,
426 IXMLDOMNode
* domNode
, VARIANT var1
)
428 dom_pi
*This
= impl_from_IXMLDOMProcessingInstruction( iface
);
429 return IXMLDOMNode_transformNodeToObject( This
->node
, domNode
, var1
);
432 static HRESULT WINAPI
dom_pi_get_target(
433 IXMLDOMProcessingInstruction
*iface
,
440 static HRESULT WINAPI
dom_pi_get_data(
441 IXMLDOMProcessingInstruction
*iface
,
448 static HRESULT WINAPI
dom_pi_put_data(
449 IXMLDOMProcessingInstruction
*iface
,
456 static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl
=
458 dom_pi_QueryInterface
,
461 dom_pi_GetTypeInfoCount
,
463 dom_pi_GetIDsOfNames
,
466 dom_pi_get_nodeValue
,
467 dom_pi_put_nodeValue
,
469 dom_pi_get_parentNode
,
470 dom_pi_get_childNodes
,
471 dom_pi_get_firstChild
,
472 dom_pi_get_lastChild
,
473 dom_pi_get_previousSibling
,
474 dom_pi_get_nextSibling
,
475 dom_pi_get_attributes
,
480 dom_pi_hasChildNodes
,
481 dom_pi_get_ownerDocument
,
483 dom_pi_get_nodeTypeString
,
486 dom_pi_get_specified
,
487 dom_pi_get_definition
,
488 dom_pi_get_nodeTypedValue
,
489 dom_pi_put_nodeTypedValue
,
493 dom_pi_transformNode
,
495 dom_pi_selectSingleNode
,
497 dom_pi_get_namespaceURI
,
500 dom_pi_transformNodeToObject
,
507 IUnknown
* create_pi( xmlNodePtr pi
)
512 This
= HeapAlloc( GetProcessHeap(), 0, sizeof *This
);
516 This
->lpVtbl
= &dom_pi_vtbl
;
519 This
->node_unk
= create_basic_node( pi
, (IUnknown
*)&This
->lpVtbl
);
522 HeapFree(GetProcessHeap(), 0, This
);
526 hr
= IUnknown_QueryInterface(This
->node_unk
, &IID_IXMLDOMNode
, (LPVOID
*)&This
->node
);
529 IUnknown_Release(This
->node_unk
);
530 HeapFree( GetProcessHeap(), 0, This
);
533 /* The ref on This->node is actually looped back into this object, so release it */
534 IXMLDOMNode_Release(This
->node
);
536 return (IUnknown
*) &This
->lpVtbl
;