winecfg: Update Portuguese translation.
[wine/testsucceed.git] / dlls / msxml3 / cdata.c
blob3fba66cdbc79b85f040f0291fccc05993bddd6e5
1 /*
2 * DOM CDATA node implementation
4 * Copyright 2007 Alistair Leslie-Hughes
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 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "msxml2.h"
32 #include "msxml_private.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
38 #ifdef HAVE_LIBXML2
40 typedef struct _domcdata
42 xmlnode node;
43 const struct IXMLDOMCDATASectionVtbl *lpVtbl;
44 LONG ref;
45 } domcdata;
47 static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface )
49 return (domcdata *)((char*)iface - FIELD_OFFSET(domcdata, lpVtbl));
52 static HRESULT WINAPI domcdata_QueryInterface(
53 IXMLDOMCDATASection *iface,
54 REFIID riid,
55 void** ppvObject )
57 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
58 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
60 if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) ||
61 IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
62 IsEqualGUID( riid, &IID_IDispatch ) ||
63 IsEqualGUID( riid, &IID_IUnknown ) )
65 *ppvObject = iface;
67 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
69 *ppvObject = IXMLDOMNode_from_impl(&This->node);
71 else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
72 IsEqualGUID( riid, &IID_IXMLDOMElement ) )
74 TRACE("Unsupported interface\n");
75 return E_NOINTERFACE;
77 else
79 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
80 return E_NOINTERFACE;
83 IXMLDOMText_AddRef((IUnknown*)*ppvObject);
84 return S_OK;
87 static ULONG WINAPI domcdata_AddRef(
88 IXMLDOMCDATASection *iface )
90 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
91 return InterlockedIncrement( &This->ref );
94 static ULONG WINAPI domcdata_Release(
95 IXMLDOMCDATASection *iface )
97 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
98 ULONG ref;
100 ref = InterlockedDecrement( &This->ref );
101 if ( ref == 0 )
103 destroy_xmlnode(&This->node);
104 heap_free( This );
107 return ref;
110 static HRESULT WINAPI domcdata_GetTypeInfoCount(
111 IXMLDOMCDATASection *iface,
112 UINT* pctinfo )
114 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
116 TRACE("(%p)->(%p)\n", This, pctinfo);
118 *pctinfo = 1;
120 return S_OK;
123 static HRESULT WINAPI domcdata_GetTypeInfo(
124 IXMLDOMCDATASection *iface,
125 UINT iTInfo, LCID lcid,
126 ITypeInfo** ppTInfo )
128 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
129 HRESULT hr;
131 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
133 hr = get_typeinfo(IXMLDOMCDATASection_tid, ppTInfo);
135 return hr;
138 static HRESULT WINAPI domcdata_GetIDsOfNames(
139 IXMLDOMCDATASection *iface,
140 REFIID riid, LPOLESTR* rgszNames,
141 UINT cNames, LCID lcid, DISPID* rgDispId )
143 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
144 ITypeInfo *typeinfo;
145 HRESULT hr;
147 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
148 lcid, rgDispId);
150 if(!rgszNames || cNames == 0 || !rgDispId)
151 return E_INVALIDARG;
153 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
154 if(SUCCEEDED(hr))
156 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
157 ITypeInfo_Release(typeinfo);
160 return hr;
163 static HRESULT WINAPI domcdata_Invoke(
164 IXMLDOMCDATASection *iface,
165 DISPID dispIdMember, REFIID riid, LCID lcid,
166 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
167 EXCEPINFO* pExcepInfo, UINT* puArgErr )
169 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
170 ITypeInfo *typeinfo;
171 HRESULT hr;
173 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
174 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
176 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
177 if(SUCCEEDED(hr))
179 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
180 pVarResult, pExcepInfo, puArgErr);
181 ITypeInfo_Release(typeinfo);
184 return hr;
187 static HRESULT WINAPI domcdata_get_nodeName(
188 IXMLDOMCDATASection *iface,
189 BSTR* p )
191 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
192 return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
195 static HRESULT WINAPI domcdata_get_nodeValue(
196 IXMLDOMCDATASection *iface,
197 VARIANT* var1 )
199 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
200 return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
203 static HRESULT WINAPI domcdata_put_nodeValue(
204 IXMLDOMCDATASection *iface,
205 VARIANT var1 )
207 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
208 return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
211 static HRESULT WINAPI domcdata_get_nodeType(
212 IXMLDOMCDATASection *iface,
213 DOMNodeType* domNodeType )
215 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
216 return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(&This->node), domNodeType );
219 static HRESULT WINAPI domcdata_get_parentNode(
220 IXMLDOMCDATASection *iface,
221 IXMLDOMNode** parent )
223 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
224 return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(&This->node), parent );
227 static HRESULT WINAPI domcdata_get_childNodes(
228 IXMLDOMCDATASection *iface,
229 IXMLDOMNodeList** outList)
231 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
232 return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(&This->node), outList );
235 static HRESULT WINAPI domcdata_get_firstChild(
236 IXMLDOMCDATASection *iface,
237 IXMLDOMNode** domNode)
239 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
240 return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
243 static HRESULT WINAPI domcdata_get_lastChild(
244 IXMLDOMCDATASection *iface,
245 IXMLDOMNode** domNode)
247 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
248 return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
251 static HRESULT WINAPI domcdata_get_previousSibling(
252 IXMLDOMCDATASection *iface,
253 IXMLDOMNode** domNode)
255 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
256 return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(&This->node), domNode );
259 static HRESULT WINAPI domcdata_get_nextSibling(
260 IXMLDOMCDATASection *iface,
261 IXMLDOMNode** domNode)
263 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
264 return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(&This->node), domNode );
267 static HRESULT WINAPI domcdata_get_attributes(
268 IXMLDOMCDATASection *iface,
269 IXMLDOMNamedNodeMap** attributeMap)
271 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
272 return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
275 static HRESULT WINAPI domcdata_insertBefore(
276 IXMLDOMCDATASection *iface,
277 IXMLDOMNode* newNode, VARIANT var1,
278 IXMLDOMNode** outOldNode)
280 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
281 return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
284 static HRESULT WINAPI domcdata_replaceChild(
285 IXMLDOMCDATASection *iface,
286 IXMLDOMNode* newNode,
287 IXMLDOMNode* oldNode,
288 IXMLDOMNode** outOldNode)
290 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
291 return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
294 static HRESULT WINAPI domcdata_removeChild(
295 IXMLDOMCDATASection *iface,
296 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
298 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
299 return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(&This->node), domNode, oldNode );
302 static HRESULT WINAPI domcdata_appendChild(
303 IXMLDOMCDATASection *iface,
304 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
306 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
307 return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(&This->node), newNode, outNewNode );
310 static HRESULT WINAPI domcdata_hasChildNodes(
311 IXMLDOMCDATASection *iface,
312 VARIANT_BOOL* pbool)
314 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
315 return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(&This->node), pbool );
318 static HRESULT WINAPI domcdata_get_ownerDocument(
319 IXMLDOMCDATASection *iface,
320 IXMLDOMDocument** domDocument)
322 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
323 return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(&This->node), domDocument );
326 static HRESULT WINAPI domcdata_cloneNode(
327 IXMLDOMCDATASection *iface,
328 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
330 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
331 return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(&This->node), pbool, outNode );
334 static HRESULT WINAPI domcdata_get_nodeTypeString(
335 IXMLDOMCDATASection *iface,
336 BSTR* p)
338 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
339 return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
342 static HRESULT WINAPI domcdata_get_text(
343 IXMLDOMCDATASection *iface,
344 BSTR* p)
346 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
347 return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(&This->node), p );
350 static HRESULT WINAPI domcdata_put_text(
351 IXMLDOMCDATASection *iface,
352 BSTR p)
354 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
355 return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(&This->node), p );
358 static HRESULT WINAPI domcdata_get_specified(
359 IXMLDOMCDATASection *iface,
360 VARIANT_BOOL* pbool)
362 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
363 return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(&This->node), pbool );
366 static HRESULT WINAPI domcdata_get_definition(
367 IXMLDOMCDATASection *iface,
368 IXMLDOMNode** domNode)
370 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
371 return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(&This->node), domNode );
374 static HRESULT WINAPI domcdata_get_nodeTypedValue(
375 IXMLDOMCDATASection *iface,
376 VARIANT* var1)
378 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
379 return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
382 static HRESULT WINAPI domcdata_put_nodeTypedValue(
383 IXMLDOMCDATASection *iface,
384 VARIANT var1)
386 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
387 return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
390 static HRESULT WINAPI domcdata_get_dataType(
391 IXMLDOMCDATASection *iface,
392 VARIANT* var1)
394 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
395 return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(&This->node), var1 );
398 static HRESULT WINAPI domcdata_put_dataType(
399 IXMLDOMCDATASection *iface,
400 BSTR p)
402 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
403 return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(&This->node), p );
406 static HRESULT WINAPI domcdata_get_xml(
407 IXMLDOMCDATASection *iface,
408 BSTR* p)
410 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
411 return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), p );
414 static HRESULT WINAPI domcdata_transformNode(
415 IXMLDOMCDATASection *iface,
416 IXMLDOMNode* domNode, BSTR* p)
418 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
419 return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(&This->node), domNode, p );
422 static HRESULT WINAPI domcdata_selectNodes(
423 IXMLDOMCDATASection *iface,
424 BSTR p, IXMLDOMNodeList** outList)
426 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
427 return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(&This->node), p, outList );
430 static HRESULT WINAPI domcdata_selectSingleNode(
431 IXMLDOMCDATASection *iface,
432 BSTR p, IXMLDOMNode** outNode)
434 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
435 return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(&This->node), p, outNode );
438 static HRESULT WINAPI domcdata_get_parsed(
439 IXMLDOMCDATASection *iface,
440 VARIANT_BOOL* pbool)
442 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
443 return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(&This->node), pbool );
446 static HRESULT WINAPI domcdata_get_namespaceURI(
447 IXMLDOMCDATASection *iface,
448 BSTR* p)
450 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
451 return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(&This->node), p );
454 static HRESULT WINAPI domcdata_get_prefix(
455 IXMLDOMCDATASection *iface,
456 BSTR* p)
458 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
459 return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p );
462 static HRESULT WINAPI domcdata_get_baseName(
463 IXMLDOMCDATASection *iface,
464 BSTR* p)
466 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
467 return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(&This->node), p );
470 static HRESULT WINAPI domcdata_transformNodeToObject(
471 IXMLDOMCDATASection *iface,
472 IXMLDOMNode* domNode, VARIANT var1)
474 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
475 return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(&This->node), domNode, var1 );
478 static HRESULT WINAPI domcdata_get_data(
479 IXMLDOMCDATASection *iface,
480 BSTR *p)
482 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
483 HRESULT hr;
484 VARIANT vRet;
486 if(!p)
487 return E_INVALIDARG;
489 hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet );
490 if(hr == S_OK)
492 *p = V_BSTR(&vRet);
495 return hr;
498 static HRESULT WINAPI domcdata_put_data(
499 IXMLDOMCDATASection *iface,
500 BSTR data)
502 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
503 VARIANT val;
505 TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
507 V_VT(&val) = VT_BSTR;
508 V_BSTR(&val) = data;
510 return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
513 static HRESULT WINAPI domcdata_get_length(
514 IXMLDOMCDATASection *iface,
515 LONG *len)
517 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
518 HRESULT hr;
519 BSTR data;
521 TRACE("(%p)->(%p)\n", This, len);
523 if(!len)
524 return E_INVALIDARG;
526 hr = IXMLDOMCDATASection_get_data(iface, &data);
527 if(hr == S_OK)
529 *len = SysStringLen(data);
530 SysFreeString(data);
533 return S_OK;
536 static HRESULT WINAPI domcdata_substringData(
537 IXMLDOMCDATASection *iface,
538 LONG offset, LONG count, BSTR *p)
540 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
541 HRESULT hr;
542 BSTR data;
544 TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
546 if(!p)
547 return E_INVALIDARG;
549 *p = NULL;
550 if(offset < 0 || count < 0)
551 return E_INVALIDARG;
553 if(count == 0)
554 return S_FALSE;
556 hr = IXMLDOMCDATASection_get_data(iface, &data);
557 if(hr == S_OK)
559 LONG len = SysStringLen(data);
561 if(offset < len)
563 if(offset + count > len)
564 *p = SysAllocString(&data[offset]);
565 else
566 *p = SysAllocStringLen(&data[offset], count);
568 else
569 hr = S_FALSE;
571 SysFreeString(data);
574 return hr;
577 static HRESULT WINAPI domcdata_appendData(
578 IXMLDOMCDATASection *iface,
579 BSTR p)
581 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
582 HRESULT hr;
583 BSTR data;
584 LONG p_len;
586 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
588 /* Nothing to do if NULL or an Empty string passed in. */
589 if((p_len = SysStringLen(p)) == 0) return S_OK;
591 hr = IXMLDOMCDATASection_get_data(iface, &data);
592 if(hr == S_OK)
594 LONG len = SysStringLen(data);
595 BSTR str = SysAllocStringLen(NULL, p_len + len);
597 memcpy(str, data, len*sizeof(WCHAR));
598 memcpy(&str[len], p, p_len*sizeof(WCHAR));
599 str[len+p_len] = 0;
601 hr = IXMLDOMCDATASection_put_data(iface, str);
603 SysFreeString(str);
604 SysFreeString(data);
607 return hr;
610 static HRESULT WINAPI domcdata_insertData(
611 IXMLDOMCDATASection *iface,
612 LONG offset, BSTR p)
614 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
615 HRESULT hr;
616 BSTR data;
617 LONG p_len;
619 TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
621 /* If have a NULL or empty string, don't do anything. */
622 if((p_len = SysStringLen(p)) == 0)
623 return S_OK;
625 if(offset < 0)
627 return E_INVALIDARG;
630 hr = IXMLDOMCDATASection_get_data(iface, &data);
631 if(hr == S_OK)
633 LONG len = SysStringLen(data);
634 BSTR str;
636 if(len < offset)
638 SysFreeString(data);
639 return E_INVALIDARG;
642 str = SysAllocStringLen(NULL, len + p_len);
643 /* start part, supplied string and end part */
644 memcpy(str, data, offset*sizeof(WCHAR));
645 memcpy(&str[offset], p, p_len*sizeof(WCHAR));
646 memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR));
647 str[len+p_len] = 0;
649 hr = IXMLDOMCDATASection_put_data(iface, str);
651 SysFreeString(str);
652 SysFreeString(data);
655 return hr;
658 static HRESULT WINAPI domcdata_deleteData(
659 IXMLDOMCDATASection *iface,
660 LONG offset, LONG count)
662 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
663 HRESULT hr;
664 LONG len = -1;
665 BSTR str;
667 TRACE("(%p)->(%d %d)\n", This, offset, count);
669 hr = IXMLDOMCDATASection_get_length(iface, &len);
670 if(hr != S_OK) return hr;
672 if((offset < 0) || (offset > len) || (count < 0))
673 return E_INVALIDARG;
675 if(len == 0) return S_OK;
677 /* cutting start or end */
678 if((offset == 0) || ((count + offset) >= len))
680 if(offset == 0)
681 IXMLDOMCDATASection_substringData(iface, count, len - count, &str);
682 else
683 IXMLDOMCDATASection_substringData(iface, 0, offset, &str);
684 hr = IXMLDOMCDATASection_put_data(iface, str);
686 else
687 /* cutting from the inside */
689 BSTR str_end;
691 IXMLDOMCDATASection_substringData(iface, 0, offset, &str);
692 IXMLDOMCDATASection_substringData(iface, offset + count, len - count, &str_end);
694 hr = IXMLDOMCDATASection_put_data(iface, str);
695 if(hr == S_OK)
696 hr = IXMLDOMCDATASection_appendData(iface, str_end);
698 SysFreeString(str_end);
701 SysFreeString(str);
703 return hr;
706 static HRESULT WINAPI domcdata_replaceData(
707 IXMLDOMCDATASection *iface,
708 LONG offset, LONG count, BSTR p)
710 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
711 HRESULT hr;
713 TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
715 hr = IXMLDOMCDATASection_deleteData(iface, offset, count);
717 if (hr == S_OK)
718 hr = IXMLDOMCDATASection_insertData(iface, offset, p);
720 return hr;
723 static HRESULT WINAPI domcdata_splitText(
724 IXMLDOMCDATASection *iface,
725 LONG offset, IXMLDOMText **txtNode)
727 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
728 FIXME("(%p)->(%d %p)\n", This, offset, txtNode);
729 return E_NOTIMPL;
733 static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
735 domcdata_QueryInterface,
736 domcdata_AddRef,
737 domcdata_Release,
738 domcdata_GetTypeInfoCount,
739 domcdata_GetTypeInfo,
740 domcdata_GetIDsOfNames,
741 domcdata_Invoke,
742 domcdata_get_nodeName,
743 domcdata_get_nodeValue,
744 domcdata_put_nodeValue,
745 domcdata_get_nodeType,
746 domcdata_get_parentNode,
747 domcdata_get_childNodes,
748 domcdata_get_firstChild,
749 domcdata_get_lastChild,
750 domcdata_get_previousSibling,
751 domcdata_get_nextSibling,
752 domcdata_get_attributes,
753 domcdata_insertBefore,
754 domcdata_replaceChild,
755 domcdata_removeChild,
756 domcdata_appendChild,
757 domcdata_hasChildNodes,
758 domcdata_get_ownerDocument,
759 domcdata_cloneNode,
760 domcdata_get_nodeTypeString,
761 domcdata_get_text,
762 domcdata_put_text,
763 domcdata_get_specified,
764 domcdata_get_definition,
765 domcdata_get_nodeTypedValue,
766 domcdata_put_nodeTypedValue,
767 domcdata_get_dataType,
768 domcdata_put_dataType,
769 domcdata_get_xml,
770 domcdata_transformNode,
771 domcdata_selectNodes,
772 domcdata_selectSingleNode,
773 domcdata_get_parsed,
774 domcdata_get_namespaceURI,
775 domcdata_get_prefix,
776 domcdata_get_baseName,
777 domcdata_transformNodeToObject,
778 domcdata_get_data,
779 domcdata_put_data,
780 domcdata_get_length,
781 domcdata_substringData,
782 domcdata_appendData,
783 domcdata_insertData,
784 domcdata_deleteData,
785 domcdata_replaceData,
786 domcdata_splitText
789 IUnknown* create_cdata( xmlNodePtr text )
791 domcdata *This;
793 This = heap_alloc( sizeof *This );
794 if ( !This )
795 return NULL;
797 This->lpVtbl = &domcdata_vtbl;
798 This->ref = 1;
800 init_xmlnode(&This->node, text, (IUnknown*)&This->lpVtbl, NULL);
802 return (IUnknown*) &This->lpVtbl;
805 #endif