mciavi: Support more MCI_STATUS queries.
[wine.git] / dlls / msxml3 / cdata.c
blob7d02a946a0cbb0efce7ec2151613b8fd1ff08b84
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 = E_FAIL;
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 HRESULT hr = E_FAIL;
504 VARIANT val;
506 TRACE("%p %s\n", This, debugstr_w(data) );
508 V_VT(&val) = VT_BSTR;
509 V_BSTR(&val) = data;
511 hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
513 return hr;
516 static HRESULT WINAPI domcdata_get_length(
517 IXMLDOMCDATASection *iface,
518 LONG *len)
520 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
521 xmlChar *pContent;
522 LONG nLength = 0;
524 TRACE("%p\n", iface);
526 if(!len)
527 return E_INVALIDARG;
529 pContent = xmlNodeGetContent(This->node.node);
530 if(pContent)
532 nLength = xmlStrlen(pContent);
533 xmlFree(pContent);
536 *len = nLength;
538 return S_OK;
541 static HRESULT WINAPI domcdata_substringData(
542 IXMLDOMCDATASection *iface,
543 LONG offset, LONG count, BSTR *p)
545 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
546 xmlChar *pContent;
547 LONG nLength = 0;
548 HRESULT hr = S_FALSE;
550 TRACE("%p\n", iface);
552 if(!p)
553 return E_INVALIDARG;
555 *p = NULL;
556 if(offset < 0 || count < 0)
557 return E_INVALIDARG;
559 if(count == 0)
560 return hr;
562 pContent = xmlNodeGetContent(This->node.node);
563 if(pContent)
565 nLength = xmlStrlen(pContent);
567 if( offset < nLength)
569 BSTR sContent = bstr_from_xmlChar(pContent);
570 if(offset + count > nLength)
571 *p = SysAllocString(&sContent[offset]);
572 else
573 *p = SysAllocStringLen(&sContent[offset], count);
575 SysFreeString(sContent);
576 hr = S_OK;
579 xmlFree(pContent);
582 return hr;
585 static HRESULT WINAPI domcdata_appendData(
586 IXMLDOMCDATASection *iface,
587 BSTR p)
589 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
590 xmlChar *pContent;
591 HRESULT hr = S_FALSE;
593 TRACE("%p\n", iface);
595 /* Nothing to do if NULL or an Empty string passed in. */
596 if(p == NULL || SysStringLen(p) == 0)
597 return S_OK;
599 pContent = xmlChar_from_wchar( p );
600 if(pContent)
602 if(xmlTextConcat(This->node.node, pContent, SysStringLen(p) ) == 0)
603 hr = S_OK;
604 else
605 hr = E_FAIL;
607 else
608 hr = E_FAIL;
609 heap_free(pContent);
611 return hr;
614 static HRESULT WINAPI domcdata_insertData(
615 IXMLDOMCDATASection *iface,
616 LONG offset, BSTR p)
618 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
619 xmlChar *pXmlContent;
620 BSTR sNewString;
621 HRESULT hr = S_FALSE;
622 LONG nLength = 0, nLengthP = 0;
623 xmlChar *str = NULL;
625 TRACE("%p\n", This);
627 /* If have a NULL or empty string, don't do anything. */
628 if(SysStringLen(p) == 0)
629 return S_OK;
631 if(offset < 0)
633 return E_INVALIDARG;
636 pXmlContent = xmlNodeGetContent(This->node.node);
637 if(pXmlContent)
639 BSTR sContent = bstr_from_xmlChar( pXmlContent );
640 nLength = SysStringLen(sContent);
641 nLengthP = SysStringLen(p);
643 if(nLength < offset)
645 SysFreeString(sContent);
646 xmlFree(pXmlContent);
648 return E_INVALIDARG;
651 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
652 if(sNewString)
654 if(offset > 0)
655 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
657 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
659 if(offset+nLengthP < nLength)
660 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
662 sNewString[nLengthP + nLength] = 0;
664 str = xmlChar_from_wchar(sNewString);
665 if(str)
667 xmlNodeSetContent(This->node.node, str);
668 hr = S_OK;
670 heap_free(str);
672 SysFreeString(sNewString);
675 SysFreeString(sContent);
677 xmlFree(pXmlContent);
680 return hr;
683 static HRESULT WINAPI domcdata_deleteData(
684 IXMLDOMCDATASection *iface,
685 LONG offset, LONG count)
687 HRESULT hr;
688 LONG len = -1;
689 BSTR str;
691 TRACE("%p %d %d\n", iface, offset, count);
693 hr = IXMLDOMCDATASection_get_length(iface, &len);
694 if(hr != S_OK) return hr;
696 if((offset < 0) || (offset > len) || (count < 0))
697 return E_INVALIDARG;
699 if(len == 0) return S_OK;
701 /* cutting start or end */
702 if((offset == 0) || ((count + offset) >= len))
704 if(offset == 0)
705 IXMLDOMCDATASection_substringData(iface, count, len - count, &str);
706 else
707 IXMLDOMCDATASection_substringData(iface, 0, offset, &str);
708 hr = IXMLDOMCDATASection_put_data(iface, str);
710 else
711 /* cutting from the inside */
713 BSTR str_end;
715 IXMLDOMCDATASection_substringData(iface, 0, offset, &str);
716 IXMLDOMCDATASection_substringData(iface, offset + count, len - count, &str_end);
718 hr = IXMLDOMCDATASection_put_data(iface, str);
719 if(hr == S_OK)
720 hr = IXMLDOMCDATASection_appendData(iface, str_end);
722 SysFreeString(str_end);
725 SysFreeString(str);
727 return hr;
730 static HRESULT WINAPI domcdata_replaceData(
731 IXMLDOMCDATASection *iface,
732 LONG offset, LONG count, BSTR p)
734 FIXME("\n");
735 return E_NOTIMPL;
738 static HRESULT WINAPI domcdata_splitText(
739 IXMLDOMCDATASection *iface,
740 LONG offset, IXMLDOMText **txtNode)
742 FIXME("\n");
743 return E_NOTIMPL;
747 static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
749 domcdata_QueryInterface,
750 domcdata_AddRef,
751 domcdata_Release,
752 domcdata_GetTypeInfoCount,
753 domcdata_GetTypeInfo,
754 domcdata_GetIDsOfNames,
755 domcdata_Invoke,
756 domcdata_get_nodeName,
757 domcdata_get_nodeValue,
758 domcdata_put_nodeValue,
759 domcdata_get_nodeType,
760 domcdata_get_parentNode,
761 domcdata_get_childNodes,
762 domcdata_get_firstChild,
763 domcdata_get_lastChild,
764 domcdata_get_previousSibling,
765 domcdata_get_nextSibling,
766 domcdata_get_attributes,
767 domcdata_insertBefore,
768 domcdata_replaceChild,
769 domcdata_removeChild,
770 domcdata_appendChild,
771 domcdata_hasChildNodes,
772 domcdata_get_ownerDocument,
773 domcdata_cloneNode,
774 domcdata_get_nodeTypeString,
775 domcdata_get_text,
776 domcdata_put_text,
777 domcdata_get_specified,
778 domcdata_get_definition,
779 domcdata_get_nodeTypedValue,
780 domcdata_put_nodeTypedValue,
781 domcdata_get_dataType,
782 domcdata_put_dataType,
783 domcdata_get_xml,
784 domcdata_transformNode,
785 domcdata_selectNodes,
786 domcdata_selectSingleNode,
787 domcdata_get_parsed,
788 domcdata_get_namespaceURI,
789 domcdata_get_prefix,
790 domcdata_get_baseName,
791 domcdata_transformNodeToObject,
792 domcdata_get_data,
793 domcdata_put_data,
794 domcdata_get_length,
795 domcdata_substringData,
796 domcdata_appendData,
797 domcdata_insertData,
798 domcdata_deleteData,
799 domcdata_replaceData,
800 domcdata_splitText
803 IUnknown* create_cdata( xmlNodePtr text )
805 domcdata *This;
807 This = heap_alloc( sizeof *This );
808 if ( !This )
809 return NULL;
811 This->lpVtbl = &domcdata_vtbl;
812 This->ref = 1;
814 init_xmlnode(&This->node, text, (IUnknown*)&This->lpVtbl, NULL);
816 return (IUnknown*) &This->lpVtbl;
819 #endif