advapi32/tests: Add tests for GetSecurityInfo with a NULL security descriptor pointer.
[wine/wine64.git] / dlls / msxml3 / cdata.c
blob06d8bb1cb35a537ea44ef96fe2cb8207af1695ba
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 const struct IXMLDOMCDATASectionVtbl *lpVtbl;
43 LONG ref;
44 IUnknown *element_unk;
45 IXMLDOMCDATASection *element;
46 } domcdata;
48 static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface )
50 return (domcdata *)((char*)iface - FIELD_OFFSET(domcdata, lpVtbl));
53 static HRESULT WINAPI domcdata_QueryInterface(
54 IXMLDOMCDATASection *iface,
55 REFIID riid,
56 void** ppvObject )
58 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
59 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) ||
62 IsEqualGUID( riid, &IID_IDispatch ) ||
63 IsEqualGUID( riid, &IID_IUnknown ) )
65 *ppvObject = iface;
67 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
68 IsEqualGUID( riid, &IID_IXMLDOMElement ) )
70 return IUnknown_QueryInterface(This->element_unk, riid, ppvObject);
72 else
74 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
75 return E_NOINTERFACE;
78 IXMLDOMCDATASection_AddRef( iface );
80 return S_OK;
83 static ULONG WINAPI domcdata_AddRef(
84 IXMLDOMCDATASection *iface )
86 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
87 return InterlockedIncrement( &This->ref );
90 static ULONG WINAPI domcdata_Release(
91 IXMLDOMCDATASection *iface )
93 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
94 ULONG ref;
96 ref = InterlockedDecrement( &This->ref );
97 if ( ref == 0 )
99 IUnknown_Release( This->element_unk );
100 HeapFree( GetProcessHeap(), 0, This );
103 return ref;
106 static HRESULT WINAPI domcdata_GetTypeInfoCount(
107 IXMLDOMCDATASection *iface,
108 UINT* pctinfo )
110 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
112 TRACE("(%p)->(%p)\n", This, pctinfo);
114 *pctinfo = 1;
116 return S_OK;
119 static HRESULT WINAPI domcdata_GetTypeInfo(
120 IXMLDOMCDATASection *iface,
121 UINT iTInfo, LCID lcid,
122 ITypeInfo** ppTInfo )
124 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
125 HRESULT hr;
127 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
129 hr = get_typeinfo(IXMLDOMCDATASection_tid, ppTInfo);
131 return hr;
134 static HRESULT WINAPI domcdata_GetIDsOfNames(
135 IXMLDOMCDATASection *iface,
136 REFIID riid, LPOLESTR* rgszNames,
137 UINT cNames, LCID lcid, DISPID* rgDispId )
139 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
140 ITypeInfo *typeinfo;
141 HRESULT hr;
143 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
144 lcid, rgDispId);
146 if(!rgszNames || cNames == 0 || !rgDispId)
147 return E_INVALIDARG;
149 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
150 if(SUCCEEDED(hr))
152 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
153 ITypeInfo_Release(typeinfo);
156 return hr;
159 static HRESULT WINAPI domcdata_Invoke(
160 IXMLDOMCDATASection *iface,
161 DISPID dispIdMember, REFIID riid, LCID lcid,
162 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
163 EXCEPINFO* pExcepInfo, UINT* puArgErr )
165 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
166 ITypeInfo *typeinfo;
167 HRESULT hr;
169 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
170 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
172 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
173 if(SUCCEEDED(hr))
175 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
176 pVarResult, pExcepInfo, puArgErr);
177 ITypeInfo_Release(typeinfo);
180 return hr;
183 static HRESULT WINAPI domcdata_get_nodeName(
184 IXMLDOMCDATASection *iface,
185 BSTR* p )
187 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
188 return IXMLDOMNode_get_nodeName( This->element, p );
191 static HRESULT WINAPI domcdata_get_nodeValue(
192 IXMLDOMCDATASection *iface,
193 VARIANT* var1 )
195 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
196 return IXMLDOMNode_get_nodeValue( This->element, var1 );
199 static HRESULT WINAPI domcdata_put_nodeValue(
200 IXMLDOMCDATASection *iface,
201 VARIANT var1 )
203 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
204 return IXMLDOMNode_put_nodeValue( This->element, var1 );
207 static HRESULT WINAPI domcdata_get_nodeType(
208 IXMLDOMCDATASection *iface,
209 DOMNodeType* domNodeType )
211 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
212 return IXMLDOMNode_get_nodeType( This->element, domNodeType );
215 static HRESULT WINAPI domcdata_get_parentNode(
216 IXMLDOMCDATASection *iface,
217 IXMLDOMNode** parent )
219 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
220 return IXMLDOMNode_get_parentNode( This->element, parent );
223 static HRESULT WINAPI domcdata_get_childNodes(
224 IXMLDOMCDATASection *iface,
225 IXMLDOMNodeList** outList)
227 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
228 return IXMLDOMNode_get_childNodes( This->element, outList );
231 static HRESULT WINAPI domcdata_get_firstChild(
232 IXMLDOMCDATASection *iface,
233 IXMLDOMNode** domNode)
235 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
236 return IXMLDOMNode_get_firstChild( This->element, domNode );
239 static HRESULT WINAPI domcdata_get_lastChild(
240 IXMLDOMCDATASection *iface,
241 IXMLDOMNode** domNode)
243 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
244 return IXMLDOMNode_get_lastChild( This->element, domNode );
247 static HRESULT WINAPI domcdata_get_previousSibling(
248 IXMLDOMCDATASection *iface,
249 IXMLDOMNode** domNode)
251 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
252 return IXMLDOMNode_get_previousSibling( This->element, domNode );
255 static HRESULT WINAPI domcdata_get_nextSibling(
256 IXMLDOMCDATASection *iface,
257 IXMLDOMNode** domNode)
259 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
260 return IXMLDOMNode_get_nextSibling( This->element, domNode );
263 static HRESULT WINAPI domcdata_get_attributes(
264 IXMLDOMCDATASection *iface,
265 IXMLDOMNamedNodeMap** attributeMap)
267 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
268 return IXMLDOMNode_get_attributes( This->element, attributeMap );
271 static HRESULT WINAPI domcdata_insertBefore(
272 IXMLDOMCDATASection *iface,
273 IXMLDOMNode* newNode, VARIANT var1,
274 IXMLDOMNode** outOldNode)
276 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
277 return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode );
280 static HRESULT WINAPI domcdata_replaceChild(
281 IXMLDOMCDATASection *iface,
282 IXMLDOMNode* newNode,
283 IXMLDOMNode* oldNode,
284 IXMLDOMNode** outOldNode)
286 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
287 return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode );
290 static HRESULT WINAPI domcdata_removeChild(
291 IXMLDOMCDATASection *iface,
292 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
294 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
295 return IXMLDOMNode_removeChild( This->element, domNode, oldNode );
298 static HRESULT WINAPI domcdata_appendChild(
299 IXMLDOMCDATASection *iface,
300 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
302 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
303 return IXMLDOMNode_appendChild( This->element, newNode, outNewNode );
306 static HRESULT WINAPI domcdata_hasChildNodes(
307 IXMLDOMCDATASection *iface,
308 VARIANT_BOOL* pbool)
310 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
311 return IXMLDOMNode_hasChildNodes( This->element, pbool );
314 static HRESULT WINAPI domcdata_get_ownerDocument(
315 IXMLDOMCDATASection *iface,
316 IXMLDOMDocument** domDocument)
318 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
319 return IXMLDOMNode_get_ownerDocument( This->element, domDocument );
322 static HRESULT WINAPI domcdata_cloneNode(
323 IXMLDOMCDATASection *iface,
324 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
326 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
327 return IXMLDOMNode_cloneNode( This->element, pbool, outNode );
330 static HRESULT WINAPI domcdata_get_nodeTypeString(
331 IXMLDOMCDATASection *iface,
332 BSTR* p)
334 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
335 return IXMLDOMNode_get_nodeTypeString( This->element, p );
338 static HRESULT WINAPI domcdata_get_text(
339 IXMLDOMCDATASection *iface,
340 BSTR* p)
342 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
343 return IXMLDOMNode_get_text( This->element, p );
346 static HRESULT WINAPI domcdata_put_text(
347 IXMLDOMCDATASection *iface,
348 BSTR p)
350 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
351 return IXMLDOMNode_put_text( This->element, p );
354 static HRESULT WINAPI domcdata_get_specified(
355 IXMLDOMCDATASection *iface,
356 VARIANT_BOOL* pbool)
358 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
359 return IXMLDOMNode_get_specified( This->element, pbool );
362 static HRESULT WINAPI domcdata_get_definition(
363 IXMLDOMCDATASection *iface,
364 IXMLDOMNode** domNode)
366 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
367 return IXMLDOMNode_get_definition( This->element, domNode );
370 static HRESULT WINAPI domcdata_get_nodeTypedValue(
371 IXMLDOMCDATASection *iface,
372 VARIANT* var1)
374 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
375 return IXMLDOMNode_get_nodeTypedValue( This->element, var1 );
378 static HRESULT WINAPI domcdata_put_nodeTypedValue(
379 IXMLDOMCDATASection *iface,
380 VARIANT var1)
382 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
383 return IXMLDOMNode_put_nodeTypedValue( This->element, var1 );
386 static HRESULT WINAPI domcdata_get_dataType(
387 IXMLDOMCDATASection *iface,
388 VARIANT* var1)
390 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
391 return IXMLDOMNode_get_dataType( This->element, var1 );
394 static HRESULT WINAPI domcdata_put_dataType(
395 IXMLDOMCDATASection *iface,
396 BSTR p)
398 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
399 return IXMLDOMNode_put_dataType( This->element, p );
402 static HRESULT WINAPI domcdata_get_xml(
403 IXMLDOMCDATASection *iface,
404 BSTR* p)
406 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
407 return IXMLDOMNode_get_xml( This->element, p );
410 static HRESULT WINAPI domcdata_transformNode(
411 IXMLDOMCDATASection *iface,
412 IXMLDOMNode* domNode, BSTR* p)
414 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
415 return IXMLDOMNode_transformNode( This->element, domNode, p );
418 static HRESULT WINAPI domcdata_selectNodes(
419 IXMLDOMCDATASection *iface,
420 BSTR p, IXMLDOMNodeList** outList)
422 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
423 return IXMLDOMNode_selectNodes( This->element, p, outList );
426 static HRESULT WINAPI domcdata_selectSingleNode(
427 IXMLDOMCDATASection *iface,
428 BSTR p, IXMLDOMNode** outNode)
430 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
431 return IXMLDOMNode_selectSingleNode( This->element, p, outNode );
434 static HRESULT WINAPI domcdata_get_parsed(
435 IXMLDOMCDATASection *iface,
436 VARIANT_BOOL* pbool)
438 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
439 return IXMLDOMNode_get_parsed( This->element, pbool );
442 static HRESULT WINAPI domcdata_get_namespaceURI(
443 IXMLDOMCDATASection *iface,
444 BSTR* p)
446 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
447 return IXMLDOMNode_get_namespaceURI( This->element, p );
450 static HRESULT WINAPI domcdata_get_prefix(
451 IXMLDOMCDATASection *iface,
452 BSTR* p)
454 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
455 return IXMLDOMNode_get_prefix( This->element, p );
458 static HRESULT WINAPI domcdata_get_baseName(
459 IXMLDOMCDATASection *iface,
460 BSTR* p)
462 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
463 return IXMLDOMNode_get_baseName( This->element, p );
466 static HRESULT WINAPI domcdata_transformNodeToObject(
467 IXMLDOMCDATASection *iface,
468 IXMLDOMNode* domNode, VARIANT var1)
470 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
471 return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 );
474 static HRESULT WINAPI domcdata_get_data(
475 IXMLDOMCDATASection *iface,
476 BSTR *p)
478 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
479 HRESULT hr = E_FAIL;
480 VARIANT vRet;
482 if(!p)
483 return E_INVALIDARG;
485 hr = IXMLDOMNode_get_nodeValue( This->element, &vRet );
486 if(hr == S_OK)
488 *p = V_BSTR(&vRet);
491 return hr;
494 static HRESULT WINAPI domcdata_put_data(
495 IXMLDOMCDATASection *iface,
496 BSTR data)
498 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
499 HRESULT hr = E_FAIL;
500 VARIANT val;
502 TRACE("%p %s\n", This, debugstr_w(data) );
504 V_VT(&val) = VT_BSTR;
505 V_BSTR(&val) = data;
507 hr = IXMLDOMNode_put_nodeValue( This->element, val );
509 return hr;
512 static HRESULT WINAPI domcdata_get_length(
513 IXMLDOMCDATASection *iface,
514 long *len)
516 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
517 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
518 xmlChar *pContent;
519 long nLength = 0;
521 TRACE("%p\n", iface);
523 if(!len)
524 return E_INVALIDARG;
526 pContent = xmlNodeGetContent(pDOMNode->node);
527 if(pContent)
529 nLength = xmlStrlen(pContent);
530 xmlFree(pContent);
533 *len = nLength;
535 return S_OK;
538 static HRESULT WINAPI domcdata_substringData(
539 IXMLDOMCDATASection *iface,
540 long offset, long count, BSTR *p)
542 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
543 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
544 xmlChar *pContent;
545 long nLength = 0;
546 HRESULT hr = S_FALSE;
548 TRACE("%p\n", iface);
550 if(!p)
551 return E_INVALIDARG;
553 *p = NULL;
554 if(offset < 0 || count < 0)
555 return E_INVALIDARG;
557 if(count == 0)
558 return hr;
560 pContent = xmlNodeGetContent(pDOMNode->node);
561 if(pContent)
563 nLength = xmlStrlen(pContent);
565 if( offset < nLength)
567 BSTR sContent = bstr_from_xmlChar(pContent);
568 if(offset + count > nLength)
569 *p = SysAllocString(&sContent[offset]);
570 else
571 *p = SysAllocStringLen(&sContent[offset], count);
573 SysFreeString(sContent);
574 hr = S_OK;
577 xmlFree(pContent);
580 return hr;
583 static HRESULT WINAPI domcdata_appendData(
584 IXMLDOMCDATASection *iface,
585 BSTR p)
587 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
588 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
589 xmlChar *pContent;
590 HRESULT hr = S_FALSE;
592 TRACE("%p\n", iface);
594 /* Nothing to do if NULL or an Empty string passed in. */
595 if(p == NULL || SysStringLen(p) == 0)
596 return S_OK;
598 pContent = xmlChar_from_wchar( (WCHAR*)p );
599 if(pContent)
601 if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
602 hr = S_OK;
603 else
604 hr = E_FAIL;
606 else
607 hr = E_FAIL;
609 return hr;
612 static HRESULT WINAPI domcdata_insertData(
613 IXMLDOMCDATASection *iface,
614 long offset, BSTR p)
616 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
617 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
618 xmlChar *pXmlContent;
619 BSTR sNewString;
620 HRESULT hr = S_FALSE;
621 long nLength = 0, nLengthP = 0;
622 xmlChar *str = NULL;
624 TRACE("%p\n", This);
626 /* If have a NULL or empty string, don't do anything. */
627 if(SysStringLen(p) == 0)
628 return S_OK;
630 if(offset < 0)
632 return E_INVALIDARG;
635 pXmlContent = xmlNodeGetContent(pDOMNode->node);
636 if(pXmlContent)
638 BSTR sContent = bstr_from_xmlChar( pXmlContent );
639 nLength = SysStringLen(sContent);
640 nLengthP = SysStringLen(p);
642 if(nLength < offset)
644 SysFreeString(sContent);
645 xmlFree(pXmlContent);
647 return E_INVALIDARG;
650 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
651 if(sNewString)
653 if(offset > 0)
654 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
656 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
658 if(offset+nLengthP < nLength)
659 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
661 sNewString[nLengthP + nLength] = 0;
663 str = xmlChar_from_wchar((WCHAR*)sNewString);
664 if(str)
666 xmlNodeSetContent(pDOMNode->node, str);
667 hr = S_OK;
670 SysFreeString(sNewString);
673 SysFreeString(sContent);
675 xmlFree(pXmlContent);
678 return hr;
681 static HRESULT WINAPI domcdata_deleteData(
682 IXMLDOMCDATASection *iface,
683 long offset, long count)
685 FIXME("\n");
686 return E_NOTIMPL;
689 static HRESULT WINAPI domcdata_replaceData(
690 IXMLDOMCDATASection *iface,
691 long offset, long count, BSTR p)
693 FIXME("\n");
694 return E_NOTIMPL;
697 static HRESULT WINAPI domcdata_splitText(
698 IXMLDOMCDATASection *iface,
699 long offset, IXMLDOMText **txtNode)
701 FIXME("\n");
702 return E_NOTIMPL;
706 static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
708 domcdata_QueryInterface,
709 domcdata_AddRef,
710 domcdata_Release,
711 domcdata_GetTypeInfoCount,
712 domcdata_GetTypeInfo,
713 domcdata_GetIDsOfNames,
714 domcdata_Invoke,
715 domcdata_get_nodeName,
716 domcdata_get_nodeValue,
717 domcdata_put_nodeValue,
718 domcdata_get_nodeType,
719 domcdata_get_parentNode,
720 domcdata_get_childNodes,
721 domcdata_get_firstChild,
722 domcdata_get_lastChild,
723 domcdata_get_previousSibling,
724 domcdata_get_nextSibling,
725 domcdata_get_attributes,
726 domcdata_insertBefore,
727 domcdata_replaceChild,
728 domcdata_removeChild,
729 domcdata_appendChild,
730 domcdata_hasChildNodes,
731 domcdata_get_ownerDocument,
732 domcdata_cloneNode,
733 domcdata_get_nodeTypeString,
734 domcdata_get_text,
735 domcdata_put_text,
736 domcdata_get_specified,
737 domcdata_get_definition,
738 domcdata_get_nodeTypedValue,
739 domcdata_put_nodeTypedValue,
740 domcdata_get_dataType,
741 domcdata_put_dataType,
742 domcdata_get_xml,
743 domcdata_transformNode,
744 domcdata_selectNodes,
745 domcdata_selectSingleNode,
746 domcdata_get_parsed,
747 domcdata_get_namespaceURI,
748 domcdata_get_prefix,
749 domcdata_get_baseName,
750 domcdata_transformNodeToObject,
751 domcdata_get_data,
752 domcdata_put_data,
753 domcdata_get_length,
754 domcdata_substringData,
755 domcdata_appendData,
756 domcdata_insertData,
757 domcdata_deleteData,
758 domcdata_replaceData,
759 domcdata_splitText
762 IUnknown* create_cdata( xmlNodePtr text )
764 domcdata *This;
765 HRESULT hr;
767 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
768 if ( !This )
769 return NULL;
771 This->lpVtbl = &domcdata_vtbl;
772 This->ref = 1;
774 This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl );
775 if(!This->element_unk)
777 HeapFree(GetProcessHeap(), 0, This);
778 return NULL;
781 hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element);
782 if(FAILED(hr))
784 IUnknown_Release(This->element_unk);
785 HeapFree( GetProcessHeap(), 0, This );
786 return NULL;
788 /* The ref on This->element is actually looped back into this object, so release it */
789 IXMLDOMNode_Release(This->element);
791 return (IUnknown*) &This->lpVtbl;
794 #endif