wineps: Fix a couple of typos in the path painting function.
[wine/testsucceed.git] / dlls / msxml3 / comment.c
blob6ae9965c5a649488d97fe021f063a92666c3c385
1 /*
2 * DOM comment 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
21 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #ifdef HAVE_LIBXML2
27 # include <libxml/parser.h>
28 # include <libxml/xmlerror.h>
29 #endif
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winuser.h"
34 #include "ole2.h"
35 #include "msxml6.h"
37 #include "msxml_private.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
43 #ifdef HAVE_LIBXML2
45 typedef struct _domcomment
47 xmlnode node;
48 IXMLDOMComment IXMLDOMComment_iface;
49 LONG ref;
50 } domcomment;
52 static inline domcomment *impl_from_IXMLDOMComment( IXMLDOMComment *iface )
54 return CONTAINING_RECORD(iface, domcomment, IXMLDOMComment_iface);
57 static HRESULT WINAPI domcomment_QueryInterface(
58 IXMLDOMComment *iface,
59 REFIID riid,
60 void** ppvObject )
62 domcomment *This = impl_from_IXMLDOMComment( iface );
63 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
65 if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) ||
66 IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
67 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
68 IsEqualGUID( riid, &IID_IDispatch ) ||
69 IsEqualGUID( riid, &IID_IUnknown ) )
71 *ppvObject = iface;
73 else if(node_query_interface(&This->node, riid, ppvObject))
75 return *ppvObject ? S_OK : E_NOINTERFACE;
77 else
79 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
80 *ppvObject = NULL;
81 return E_NOINTERFACE;
84 IXMLDOMText_AddRef((IUnknown*)*ppvObject);
85 return S_OK;
88 static ULONG WINAPI domcomment_AddRef(
89 IXMLDOMComment *iface )
91 domcomment *This = impl_from_IXMLDOMComment( iface );
92 ULONG ref = InterlockedIncrement( &This->ref );
93 TRACE("(%p)->(%d)\n", This, ref);
94 return ref;
97 static ULONG WINAPI domcomment_Release(
98 IXMLDOMComment *iface )
100 domcomment *This = impl_from_IXMLDOMComment( iface );
101 ULONG ref = InterlockedDecrement( &This->ref );
103 TRACE("(%p)->(%d)\n", This, ref);
104 if ( ref == 0 )
106 destroy_xmlnode(&This->node);
107 heap_free( This );
110 return ref;
113 static HRESULT WINAPI domcomment_GetTypeInfoCount(
114 IXMLDOMComment *iface,
115 UINT* pctinfo )
117 domcomment *This = impl_from_IXMLDOMComment( iface );
119 TRACE("(%p)->(%p)\n", This, pctinfo);
121 *pctinfo = 1;
123 return S_OK;
126 static HRESULT WINAPI domcomment_GetTypeInfo(
127 IXMLDOMComment *iface,
128 UINT iTInfo, LCID lcid,
129 ITypeInfo** ppTInfo )
131 domcomment *This = impl_from_IXMLDOMComment( iface );
132 HRESULT hr;
134 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
136 hr = get_typeinfo(IXMLDOMComment_tid, ppTInfo);
138 return hr;
141 static HRESULT WINAPI domcomment_GetIDsOfNames(
142 IXMLDOMComment *iface,
143 REFIID riid, LPOLESTR* rgszNames,
144 UINT cNames, LCID lcid, DISPID* rgDispId )
146 domcomment *This = impl_from_IXMLDOMComment( iface );
147 ITypeInfo *typeinfo;
148 HRESULT hr;
150 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
151 lcid, rgDispId);
153 if(!rgszNames || cNames == 0 || !rgDispId)
154 return E_INVALIDARG;
156 hr = get_typeinfo(IXMLDOMComment_tid, &typeinfo);
157 if(SUCCEEDED(hr))
159 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
160 ITypeInfo_Release(typeinfo);
163 return hr;
166 static HRESULT WINAPI domcomment_Invoke(
167 IXMLDOMComment *iface,
168 DISPID dispIdMember, REFIID riid, LCID lcid,
169 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
170 EXCEPINFO* pExcepInfo, UINT* puArgErr )
172 domcomment *This = impl_from_IXMLDOMComment( iface );
173 ITypeInfo *typeinfo;
174 HRESULT hr;
176 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
177 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
179 hr = get_typeinfo(IXMLDOMComment_tid, &typeinfo);
180 if(SUCCEEDED(hr))
182 hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMComment_iface, dispIdMember, wFlags,
183 pDispParams, pVarResult, pExcepInfo, puArgErr);
184 ITypeInfo_Release(typeinfo);
187 return hr;
190 static HRESULT WINAPI domcomment_get_nodeName(
191 IXMLDOMComment *iface,
192 BSTR* p )
194 domcomment *This = impl_from_IXMLDOMComment( iface );
196 static const WCHAR commentW[] = {'#','c','o','m','m','e','n','t',0};
198 TRACE("(%p)->(%p)\n", This, p);
200 return return_bstr(commentW, p);
203 static HRESULT WINAPI domcomment_get_nodeValue(
204 IXMLDOMComment *iface,
205 VARIANT* value)
207 domcomment *This = impl_from_IXMLDOMComment( iface );
209 TRACE("(%p)->(%p)\n", This, value);
211 return node_get_content(&This->node, value);
214 static HRESULT WINAPI domcomment_put_nodeValue(
215 IXMLDOMComment *iface,
216 VARIANT value)
218 domcomment *This = impl_from_IXMLDOMComment( iface );
220 TRACE("(%p)->(%s)\n", This, debugstr_variant(&value));
222 return node_put_value(&This->node, &value);
225 static HRESULT WINAPI domcomment_get_nodeType(
226 IXMLDOMComment *iface,
227 DOMNodeType* domNodeType )
229 domcomment *This = impl_from_IXMLDOMComment( iface );
231 TRACE("(%p)->(%p)\n", This, domNodeType);
233 *domNodeType = NODE_COMMENT;
234 return S_OK;
237 static HRESULT WINAPI domcomment_get_parentNode(
238 IXMLDOMComment *iface,
239 IXMLDOMNode** parent )
241 domcomment *This = impl_from_IXMLDOMComment( iface );
243 TRACE("(%p)->(%p)\n", This, parent);
245 return node_get_parent(&This->node, parent);
248 static HRESULT WINAPI domcomment_get_childNodes(
249 IXMLDOMComment *iface,
250 IXMLDOMNodeList** outList)
252 domcomment *This = impl_from_IXMLDOMComment( iface );
254 TRACE("(%p)->(%p)\n", This, outList);
256 return node_get_child_nodes(&This->node, outList);
259 static HRESULT WINAPI domcomment_get_firstChild(
260 IXMLDOMComment *iface,
261 IXMLDOMNode** domNode)
263 domcomment *This = impl_from_IXMLDOMComment( iface );
265 TRACE("(%p)->(%p)\n", This, domNode);
267 return return_null_node(domNode);
270 static HRESULT WINAPI domcomment_get_lastChild(
271 IXMLDOMComment *iface,
272 IXMLDOMNode** domNode)
274 domcomment *This = impl_from_IXMLDOMComment( iface );
276 TRACE("(%p)->(%p)\n", This, domNode);
278 return return_null_node(domNode);
281 static HRESULT WINAPI domcomment_get_previousSibling(
282 IXMLDOMComment *iface,
283 IXMLDOMNode** domNode)
285 domcomment *This = impl_from_IXMLDOMComment( iface );
287 TRACE("(%p)->(%p)\n", This, domNode);
289 return node_get_previous_sibling(&This->node, domNode);
292 static HRESULT WINAPI domcomment_get_nextSibling(
293 IXMLDOMComment *iface,
294 IXMLDOMNode** domNode)
296 domcomment *This = impl_from_IXMLDOMComment( iface );
298 TRACE("(%p)->(%p)\n", This, domNode);
300 return node_get_next_sibling(&This->node, domNode);
303 static HRESULT WINAPI domcomment_get_attributes(
304 IXMLDOMComment *iface,
305 IXMLDOMNamedNodeMap** attributeMap)
307 domcomment *This = impl_from_IXMLDOMComment( iface );
309 TRACE("(%p)->(%p)\n", This, attributeMap);
311 return return_null_ptr((void**)attributeMap);
314 static HRESULT WINAPI domcomment_insertBefore(
315 IXMLDOMComment *iface,
316 IXMLDOMNode* newNode, VARIANT refChild,
317 IXMLDOMNode** outOldNode)
319 domcomment *This = impl_from_IXMLDOMComment( iface );
321 FIXME("(%p)->(%p %s %p) needs test\n", This, newNode, debugstr_variant(&refChild), outOldNode);
323 return node_insert_before(&This->node, newNode, &refChild, outOldNode);
326 static HRESULT WINAPI domcomment_replaceChild(
327 IXMLDOMComment *iface,
328 IXMLDOMNode* newNode,
329 IXMLDOMNode* oldNode,
330 IXMLDOMNode** outOldNode)
332 domcomment *This = impl_from_IXMLDOMComment( iface );
334 FIXME("(%p)->(%p %p %p) needs tests\n", This, newNode, oldNode, outOldNode);
336 return node_replace_child(&This->node, newNode, oldNode, outOldNode);
339 static HRESULT WINAPI domcomment_removeChild(
340 IXMLDOMComment *iface,
341 IXMLDOMNode *child, IXMLDOMNode **oldChild)
343 domcomment *This = impl_from_IXMLDOMComment( iface );
344 TRACE("(%p)->(%p %p)\n", This, child, oldChild);
345 return node_remove_child(&This->node, child, oldChild);
348 static HRESULT WINAPI domcomment_appendChild(
349 IXMLDOMComment *iface,
350 IXMLDOMNode *child, IXMLDOMNode **outChild)
352 domcomment *This = impl_from_IXMLDOMComment( iface );
353 TRACE("(%p)->(%p %p)\n", This, child, outChild);
354 return node_append_child(&This->node, child, outChild);
357 static HRESULT WINAPI domcomment_hasChildNodes(
358 IXMLDOMComment *iface,
359 VARIANT_BOOL *ret)
361 domcomment *This = impl_from_IXMLDOMComment( iface );
362 TRACE("(%p)->(%p)\n", This, ret);
363 return node_has_childnodes(&This->node, ret);
366 static HRESULT WINAPI domcomment_get_ownerDocument(
367 IXMLDOMComment *iface,
368 IXMLDOMDocument **doc)
370 domcomment *This = impl_from_IXMLDOMComment( iface );
371 TRACE("(%p)->(%p)\n", This, doc);
372 return node_get_owner_doc(&This->node, doc);
375 static HRESULT WINAPI domcomment_cloneNode(
376 IXMLDOMComment *iface,
377 VARIANT_BOOL deep, IXMLDOMNode** outNode)
379 domcomment *This = impl_from_IXMLDOMComment( iface );
380 TRACE("(%p)->(%d %p)\n", This, deep, outNode);
381 return node_clone( &This->node, deep, outNode );
384 static HRESULT WINAPI domcomment_get_nodeTypeString(
385 IXMLDOMComment *iface,
386 BSTR* p)
388 domcomment *This = impl_from_IXMLDOMComment( iface );
389 static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
391 TRACE("(%p)->(%p)\n", This, p);
393 return return_bstr(commentW, p);
396 static HRESULT WINAPI domcomment_get_text(
397 IXMLDOMComment *iface,
398 BSTR* p)
400 domcomment *This = impl_from_IXMLDOMComment( iface );
401 TRACE("(%p)->(%p)\n", This, p);
402 return node_get_text(&This->node, p);
405 static HRESULT WINAPI domcomment_put_text(
406 IXMLDOMComment *iface,
407 BSTR p)
409 domcomment *This = impl_from_IXMLDOMComment( iface );
410 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
411 return node_put_text( &This->node, p );
414 static HRESULT WINAPI domcomment_get_specified(
415 IXMLDOMComment *iface,
416 VARIANT_BOOL* isSpecified)
418 domcomment *This = impl_from_IXMLDOMComment( iface );
419 FIXME("(%p)->(%p) stub!\n", This, isSpecified);
420 *isSpecified = VARIANT_TRUE;
421 return S_OK;
424 static HRESULT WINAPI domcomment_get_definition(
425 IXMLDOMComment *iface,
426 IXMLDOMNode** definitionNode)
428 domcomment *This = impl_from_IXMLDOMComment( iface );
429 FIXME("(%p)->(%p)\n", This, definitionNode);
430 return E_NOTIMPL;
433 static HRESULT WINAPI domcomment_get_nodeTypedValue(
434 IXMLDOMComment *iface,
435 VARIANT* v)
437 domcomment *This = impl_from_IXMLDOMComment( iface );
438 TRACE("(%p)->(%p)\n", This, v);
439 return node_get_content(&This->node, v);
442 static HRESULT WINAPI domcomment_put_nodeTypedValue(
443 IXMLDOMComment *iface,
444 VARIANT typedValue)
446 domcomment *This = impl_from_IXMLDOMComment( iface );
447 FIXME("(%p)->(%s)\n", This, debugstr_variant(&typedValue));
448 return E_NOTIMPL;
451 static HRESULT WINAPI domcomment_get_dataType(
452 IXMLDOMComment *iface,
453 VARIANT* typename)
455 domcomment *This = impl_from_IXMLDOMComment( iface );
456 TRACE("(%p)->(%p)\n", This, typename);
457 return return_null_var( typename );
460 static HRESULT WINAPI domcomment_put_dataType(
461 IXMLDOMComment *iface,
462 BSTR p)
464 domcomment *This = impl_from_IXMLDOMComment( iface );
466 FIXME("(%p)->(%s)\n", This, debugstr_w(p));
468 if(!p)
469 return E_INVALIDARG;
471 return E_FAIL;
474 static HRESULT WINAPI domcomment_get_xml(
475 IXMLDOMComment *iface,
476 BSTR* p)
478 domcomment *This = impl_from_IXMLDOMComment( iface );
480 TRACE("(%p)->(%p)\n", This, p);
482 return node_get_xml(&This->node, FALSE, FALSE, p);
485 static HRESULT WINAPI domcomment_transformNode(
486 IXMLDOMComment *iface,
487 IXMLDOMNode *node, BSTR *p)
489 domcomment *This = impl_from_IXMLDOMComment( iface );
490 TRACE("(%p)->(%p %p)\n", This, node, p);
491 return node_transform_node(&This->node, node, p);
494 static HRESULT WINAPI domcomment_selectNodes(
495 IXMLDOMComment *iface,
496 BSTR p, IXMLDOMNodeList** outList)
498 domcomment *This = impl_from_IXMLDOMComment( iface );
499 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outList);
500 return node_select_nodes(&This->node, p, outList);
503 static HRESULT WINAPI domcomment_selectSingleNode(
504 IXMLDOMComment *iface,
505 BSTR p, IXMLDOMNode** outNode)
507 domcomment *This = impl_from_IXMLDOMComment( iface );
508 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outNode);
509 return node_select_singlenode(&This->node, p, outNode);
512 static HRESULT WINAPI domcomment_get_parsed(
513 IXMLDOMComment *iface,
514 VARIANT_BOOL* isParsed)
516 domcomment *This = impl_from_IXMLDOMComment( iface );
517 FIXME("(%p)->(%p) stub!\n", This, isParsed);
518 *isParsed = VARIANT_TRUE;
519 return S_OK;
522 static HRESULT WINAPI domcomment_get_namespaceURI(
523 IXMLDOMComment *iface,
524 BSTR* p)
526 domcomment *This = impl_from_IXMLDOMComment( iface );
527 TRACE("(%p)->(%p)\n", This, p);
528 return node_get_namespaceURI(&This->node, p);
531 static HRESULT WINAPI domcomment_get_prefix(
532 IXMLDOMComment *iface,
533 BSTR* prefix)
535 domcomment *This = impl_from_IXMLDOMComment( iface );
536 TRACE("(%p)->(%p)\n", This, prefix);
537 return return_null_bstr( prefix );
540 static HRESULT WINAPI domcomment_get_baseName(
541 IXMLDOMComment *iface,
542 BSTR* name)
544 domcomment *This = impl_from_IXMLDOMComment( iface );
545 TRACE("(%p)->(%p)\n", This, name);
546 return return_null_bstr( name );
549 static HRESULT WINAPI domcomment_transformNodeToObject(
550 IXMLDOMComment *iface,
551 IXMLDOMNode* domNode, VARIANT var1)
553 domcomment *This = impl_from_IXMLDOMComment( iface );
554 FIXME("(%p)->(%p %s)\n", This, domNode, debugstr_variant(&var1));
555 return E_NOTIMPL;
558 static HRESULT WINAPI domcomment_get_data(
559 IXMLDOMComment *iface,
560 BSTR *p)
562 domcomment *This = impl_from_IXMLDOMComment( iface );
563 HRESULT hr;
564 VARIANT vRet;
566 TRACE("(%p)->(%p)\n", This, p);
568 if(!p)
569 return E_INVALIDARG;
571 hr = IXMLDOMComment_get_nodeValue( iface, &vRet );
572 if(hr == S_OK)
574 *p = V_BSTR(&vRet);
577 return hr;
580 static HRESULT WINAPI domcomment_put_data(
581 IXMLDOMComment *iface,
582 BSTR data)
584 domcomment *This = impl_from_IXMLDOMComment( iface );
585 VARIANT val;
587 TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
589 V_VT(&val) = VT_BSTR;
590 V_BSTR(&val) = data;
591 return node_put_value(&This->node, &val);
594 static HRESULT WINAPI domcomment_get_length(
595 IXMLDOMComment *iface,
596 LONG *len)
598 domcomment *This = impl_from_IXMLDOMComment( iface );
599 HRESULT hr;
600 BSTR data;
602 TRACE("(%p)->(%p)\n", This, len);
604 if(!len)
605 return E_INVALIDARG;
607 hr = IXMLDOMComment_get_data(iface, &data);
608 if(hr == S_OK)
610 *len = SysStringLen(data);
611 SysFreeString(data);
614 return hr;
617 static HRESULT WINAPI domcomment_substringData(
618 IXMLDOMComment *iface,
619 LONG offset, LONG count, BSTR *p)
621 domcomment *This = impl_from_IXMLDOMComment( iface );
622 HRESULT hr;
623 BSTR data;
625 TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
627 if(!p)
628 return E_INVALIDARG;
630 *p = NULL;
631 if(offset < 0 || count < 0)
632 return E_INVALIDARG;
634 if(count == 0)
635 return S_FALSE;
637 hr = IXMLDOMComment_get_data(iface, &data);
638 if(hr == S_OK)
640 LONG len = SysStringLen(data);
642 if(offset < len)
644 if(offset + count > len)
645 *p = SysAllocString(&data[offset]);
646 else
647 *p = SysAllocStringLen(&data[offset], count);
649 else
650 hr = S_FALSE;
652 SysFreeString(data);
655 return hr;
658 static HRESULT WINAPI domcomment_appendData(
659 IXMLDOMComment *iface,
660 BSTR p)
662 domcomment *This = impl_from_IXMLDOMComment( iface );
663 HRESULT hr;
664 BSTR data;
665 LONG p_len;
667 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
669 /* Nothing to do if NULL or an Empty string passed in. */
670 if((p_len = SysStringLen(p)) == 0) return S_OK;
672 hr = IXMLDOMComment_get_data(iface, &data);
673 if(hr == S_OK)
675 LONG len = SysStringLen(data);
676 BSTR str = SysAllocStringLen(NULL, p_len + len);
678 memcpy(str, data, len*sizeof(WCHAR));
679 memcpy(&str[len], p, p_len*sizeof(WCHAR));
680 str[len+p_len] = 0;
682 hr = IXMLDOMComment_put_data(iface, str);
684 SysFreeString(str);
685 SysFreeString(data);
688 return hr;
691 static HRESULT WINAPI domcomment_insertData(
692 IXMLDOMComment *iface,
693 LONG offset, BSTR p)
695 domcomment *This = impl_from_IXMLDOMComment( iface );
696 HRESULT hr;
697 BSTR data;
698 LONG p_len;
700 TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
702 /* If have a NULL or empty string, don't do anything. */
703 if((p_len = SysStringLen(p)) == 0)
704 return S_OK;
706 if(offset < 0)
708 return E_INVALIDARG;
711 hr = IXMLDOMComment_get_data(iface, &data);
712 if(hr == S_OK)
714 LONG len = SysStringLen(data);
715 BSTR str;
717 if(len < offset)
719 SysFreeString(data);
720 return E_INVALIDARG;
723 str = SysAllocStringLen(NULL, len + p_len);
724 /* start part, supplied string and end part */
725 memcpy(str, data, offset*sizeof(WCHAR));
726 memcpy(&str[offset], p, p_len*sizeof(WCHAR));
727 memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR));
728 str[len+p_len] = 0;
730 hr = IXMLDOMComment_put_data(iface, str);
732 SysFreeString(str);
733 SysFreeString(data);
736 return hr;
739 static HRESULT WINAPI domcomment_deleteData(
740 IXMLDOMComment *iface,
741 LONG offset, LONG count)
743 HRESULT hr;
744 LONG len = -1;
745 BSTR str;
747 TRACE("(%p)->(%d %d)\n", iface, offset, count);
749 hr = IXMLDOMComment_get_length(iface, &len);
750 if(hr != S_OK) return hr;
752 if((offset < 0) || (offset > len) || (count < 0))
753 return E_INVALIDARG;
755 if(len == 0) return S_OK;
757 /* cutting start or end */
758 if((offset == 0) || ((count + offset) >= len))
760 if(offset == 0)
761 IXMLDOMComment_substringData(iface, count, len - count, &str);
762 else
763 IXMLDOMComment_substringData(iface, 0, offset, &str);
764 hr = IXMLDOMComment_put_data(iface, str);
766 else
767 /* cutting from the inside */
769 BSTR str_end;
771 IXMLDOMComment_substringData(iface, 0, offset, &str);
772 IXMLDOMComment_substringData(iface, offset + count, len - count, &str_end);
774 hr = IXMLDOMComment_put_data(iface, str);
775 if(hr == S_OK)
776 hr = IXMLDOMComment_appendData(iface, str_end);
778 SysFreeString(str_end);
781 SysFreeString(str);
783 return hr;
786 static HRESULT WINAPI domcomment_replaceData(
787 IXMLDOMComment *iface,
788 LONG offset, LONG count, BSTR p)
790 domcomment *This = impl_from_IXMLDOMComment( iface );
791 HRESULT hr;
793 TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
795 hr = IXMLDOMComment_deleteData(iface, offset, count);
797 if (hr == S_OK)
798 hr = IXMLDOMComment_insertData(iface, offset, p);
800 return hr;
803 static const struct IXMLDOMCommentVtbl domcomment_vtbl =
805 domcomment_QueryInterface,
806 domcomment_AddRef,
807 domcomment_Release,
808 domcomment_GetTypeInfoCount,
809 domcomment_GetTypeInfo,
810 domcomment_GetIDsOfNames,
811 domcomment_Invoke,
812 domcomment_get_nodeName,
813 domcomment_get_nodeValue,
814 domcomment_put_nodeValue,
815 domcomment_get_nodeType,
816 domcomment_get_parentNode,
817 domcomment_get_childNodes,
818 domcomment_get_firstChild,
819 domcomment_get_lastChild,
820 domcomment_get_previousSibling,
821 domcomment_get_nextSibling,
822 domcomment_get_attributes,
823 domcomment_insertBefore,
824 domcomment_replaceChild,
825 domcomment_removeChild,
826 domcomment_appendChild,
827 domcomment_hasChildNodes,
828 domcomment_get_ownerDocument,
829 domcomment_cloneNode,
830 domcomment_get_nodeTypeString,
831 domcomment_get_text,
832 domcomment_put_text,
833 domcomment_get_specified,
834 domcomment_get_definition,
835 domcomment_get_nodeTypedValue,
836 domcomment_put_nodeTypedValue,
837 domcomment_get_dataType,
838 domcomment_put_dataType,
839 domcomment_get_xml,
840 domcomment_transformNode,
841 domcomment_selectNodes,
842 domcomment_selectSingleNode,
843 domcomment_get_parsed,
844 domcomment_get_namespaceURI,
845 domcomment_get_prefix,
846 domcomment_get_baseName,
847 domcomment_transformNodeToObject,
848 domcomment_get_data,
849 domcomment_put_data,
850 domcomment_get_length,
851 domcomment_substringData,
852 domcomment_appendData,
853 domcomment_insertData,
854 domcomment_deleteData,
855 domcomment_replaceData
858 static const tid_t domcomment_iface_tids[] = {
859 IXMLDOMComment_tid,
863 static dispex_static_data_t domcomment_dispex = {
864 NULL,
865 IXMLDOMComment_tid,
866 NULL,
867 domcomment_iface_tids
870 IUnknown* create_comment( xmlNodePtr comment )
872 domcomment *This;
874 This = heap_alloc( sizeof *This );
875 if ( !This )
876 return NULL;
878 This->IXMLDOMComment_iface.lpVtbl = &domcomment_vtbl;
879 This->ref = 1;
881 init_xmlnode(&This->node, comment, (IXMLDOMNode*)&This->IXMLDOMComment_iface, &domcomment_dispex);
883 return (IUnknown*)&This->IXMLDOMComment_iface;
886 #endif