msvcrt/tests: Remove a space before a '\n'.
[wine/gsoc-2012-control.git] / dlls / msxml3 / cdata.c
blob7672bbaafe0be9217a9a88bba35ae73023f6e085
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 *node_unk;
45 IXMLDOMNode *node;
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_IXMLDOMCharacterData) ||
63 IsEqualGUID( riid, &IID_IDispatch ) ||
64 IsEqualGUID( riid, &IID_IUnknown ) )
66 *ppvObject = iface;
68 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
70 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
72 else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
73 IsEqualGUID( riid, &IID_IXMLDOMElement ) )
75 TRACE("Unsupported interface\n");
76 return E_NOINTERFACE;
78 else
80 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
81 return E_NOINTERFACE;
84 IXMLDOMCDATASection_AddRef( iface );
86 return S_OK;
89 static ULONG WINAPI domcdata_AddRef(
90 IXMLDOMCDATASection *iface )
92 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
93 return InterlockedIncrement( &This->ref );
96 static ULONG WINAPI domcdata_Release(
97 IXMLDOMCDATASection *iface )
99 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
100 ULONG ref;
102 ref = InterlockedDecrement( &This->ref );
103 if ( ref == 0 )
105 IUnknown_Release( This->node_unk );
106 HeapFree( GetProcessHeap(), 0, This );
109 return ref;
112 static HRESULT WINAPI domcdata_GetTypeInfoCount(
113 IXMLDOMCDATASection *iface,
114 UINT* pctinfo )
116 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
118 TRACE("(%p)->(%p)\n", This, pctinfo);
120 *pctinfo = 1;
122 return S_OK;
125 static HRESULT WINAPI domcdata_GetTypeInfo(
126 IXMLDOMCDATASection *iface,
127 UINT iTInfo, LCID lcid,
128 ITypeInfo** ppTInfo )
130 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
131 HRESULT hr;
133 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
135 hr = get_typeinfo(IXMLDOMCDATASection_tid, ppTInfo);
137 return hr;
140 static HRESULT WINAPI domcdata_GetIDsOfNames(
141 IXMLDOMCDATASection *iface,
142 REFIID riid, LPOLESTR* rgszNames,
143 UINT cNames, LCID lcid, DISPID* rgDispId )
145 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
146 ITypeInfo *typeinfo;
147 HRESULT hr;
149 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
150 lcid, rgDispId);
152 if(!rgszNames || cNames == 0 || !rgDispId)
153 return E_INVALIDARG;
155 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
156 if(SUCCEEDED(hr))
158 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
159 ITypeInfo_Release(typeinfo);
162 return hr;
165 static HRESULT WINAPI domcdata_Invoke(
166 IXMLDOMCDATASection *iface,
167 DISPID dispIdMember, REFIID riid, LCID lcid,
168 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
169 EXCEPINFO* pExcepInfo, UINT* puArgErr )
171 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
172 ITypeInfo *typeinfo;
173 HRESULT hr;
175 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
176 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
178 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
179 if(SUCCEEDED(hr))
181 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
182 pVarResult, pExcepInfo, puArgErr);
183 ITypeInfo_Release(typeinfo);
186 return hr;
189 static HRESULT WINAPI domcdata_get_nodeName(
190 IXMLDOMCDATASection *iface,
191 BSTR* p )
193 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
194 return IXMLDOMNode_get_nodeName( This->node, p );
197 static HRESULT WINAPI domcdata_get_nodeValue(
198 IXMLDOMCDATASection *iface,
199 VARIANT* var1 )
201 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
202 return IXMLDOMNode_get_nodeValue( This->node, var1 );
205 static HRESULT WINAPI domcdata_put_nodeValue(
206 IXMLDOMCDATASection *iface,
207 VARIANT var1 )
209 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
210 return IXMLDOMNode_put_nodeValue( This->node, var1 );
213 static HRESULT WINAPI domcdata_get_nodeType(
214 IXMLDOMCDATASection *iface,
215 DOMNodeType* domNodeType )
217 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
218 return IXMLDOMNode_get_nodeType( This->node, domNodeType );
221 static HRESULT WINAPI domcdata_get_parentNode(
222 IXMLDOMCDATASection *iface,
223 IXMLDOMNode** parent )
225 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
226 return IXMLDOMNode_get_parentNode( This->node, parent );
229 static HRESULT WINAPI domcdata_get_childNodes(
230 IXMLDOMCDATASection *iface,
231 IXMLDOMNodeList** outList)
233 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
234 return IXMLDOMNode_get_childNodes( This->node, outList );
237 static HRESULT WINAPI domcdata_get_firstChild(
238 IXMLDOMCDATASection *iface,
239 IXMLDOMNode** domNode)
241 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
242 return IXMLDOMNode_get_firstChild( This->node, domNode );
245 static HRESULT WINAPI domcdata_get_lastChild(
246 IXMLDOMCDATASection *iface,
247 IXMLDOMNode** domNode)
249 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
250 return IXMLDOMNode_get_lastChild( This->node, domNode );
253 static HRESULT WINAPI domcdata_get_previousSibling(
254 IXMLDOMCDATASection *iface,
255 IXMLDOMNode** domNode)
257 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
258 return IXMLDOMNode_get_previousSibling( This->node, domNode );
261 static HRESULT WINAPI domcdata_get_nextSibling(
262 IXMLDOMCDATASection *iface,
263 IXMLDOMNode** domNode)
265 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
266 return IXMLDOMNode_get_nextSibling( This->node, domNode );
269 static HRESULT WINAPI domcdata_get_attributes(
270 IXMLDOMCDATASection *iface,
271 IXMLDOMNamedNodeMap** attributeMap)
273 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
274 return IXMLDOMNode_get_attributes( This->node, attributeMap );
277 static HRESULT WINAPI domcdata_insertBefore(
278 IXMLDOMCDATASection *iface,
279 IXMLDOMNode* newNode, VARIANT var1,
280 IXMLDOMNode** outOldNode)
282 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
283 return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
286 static HRESULT WINAPI domcdata_replaceChild(
287 IXMLDOMCDATASection *iface,
288 IXMLDOMNode* newNode,
289 IXMLDOMNode* oldNode,
290 IXMLDOMNode** outOldNode)
292 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
293 return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
296 static HRESULT WINAPI domcdata_removeChild(
297 IXMLDOMCDATASection *iface,
298 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
300 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
301 return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
304 static HRESULT WINAPI domcdata_appendChild(
305 IXMLDOMCDATASection *iface,
306 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
308 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
309 return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
312 static HRESULT WINAPI domcdata_hasChildNodes(
313 IXMLDOMCDATASection *iface,
314 VARIANT_BOOL* pbool)
316 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
317 return IXMLDOMNode_hasChildNodes( This->node, pbool );
320 static HRESULT WINAPI domcdata_get_ownerDocument(
321 IXMLDOMCDATASection *iface,
322 IXMLDOMDocument** domDocument)
324 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
325 return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
328 static HRESULT WINAPI domcdata_cloneNode(
329 IXMLDOMCDATASection *iface,
330 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
332 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
333 return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
336 static HRESULT WINAPI domcdata_get_nodeTypeString(
337 IXMLDOMCDATASection *iface,
338 BSTR* p)
340 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
341 return IXMLDOMNode_get_nodeTypeString( This->node, p );
344 static HRESULT WINAPI domcdata_get_text(
345 IXMLDOMCDATASection *iface,
346 BSTR* p)
348 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
349 return IXMLDOMNode_get_text( This->node, p );
352 static HRESULT WINAPI domcdata_put_text(
353 IXMLDOMCDATASection *iface,
354 BSTR p)
356 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
357 return IXMLDOMNode_put_text( This->node, p );
360 static HRESULT WINAPI domcdata_get_specified(
361 IXMLDOMCDATASection *iface,
362 VARIANT_BOOL* pbool)
364 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
365 return IXMLDOMNode_get_specified( This->node, pbool );
368 static HRESULT WINAPI domcdata_get_definition(
369 IXMLDOMCDATASection *iface,
370 IXMLDOMNode** domNode)
372 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
373 return IXMLDOMNode_get_definition( This->node, domNode );
376 static HRESULT WINAPI domcdata_get_nodeTypedValue(
377 IXMLDOMCDATASection *iface,
378 VARIANT* var1)
380 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
381 return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
384 static HRESULT WINAPI domcdata_put_nodeTypedValue(
385 IXMLDOMCDATASection *iface,
386 VARIANT var1)
388 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
389 return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
392 static HRESULT WINAPI domcdata_get_dataType(
393 IXMLDOMCDATASection *iface,
394 VARIANT* var1)
396 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
397 return IXMLDOMNode_get_dataType( This->node, var1 );
400 static HRESULT WINAPI domcdata_put_dataType(
401 IXMLDOMCDATASection *iface,
402 BSTR p)
404 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
405 return IXMLDOMNode_put_dataType( This->node, p );
408 static HRESULT WINAPI domcdata_get_xml(
409 IXMLDOMCDATASection *iface,
410 BSTR* p)
412 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
413 return IXMLDOMNode_get_xml( This->node, p );
416 static HRESULT WINAPI domcdata_transformNode(
417 IXMLDOMCDATASection *iface,
418 IXMLDOMNode* domNode, BSTR* p)
420 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
421 return IXMLDOMNode_transformNode( This->node, domNode, p );
424 static HRESULT WINAPI domcdata_selectNodes(
425 IXMLDOMCDATASection *iface,
426 BSTR p, IXMLDOMNodeList** outList)
428 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
429 return IXMLDOMNode_selectNodes( This->node, p, outList );
432 static HRESULT WINAPI domcdata_selectSingleNode(
433 IXMLDOMCDATASection *iface,
434 BSTR p, IXMLDOMNode** outNode)
436 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
437 return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
440 static HRESULT WINAPI domcdata_get_parsed(
441 IXMLDOMCDATASection *iface,
442 VARIANT_BOOL* pbool)
444 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
445 return IXMLDOMNode_get_parsed( This->node, pbool );
448 static HRESULT WINAPI domcdata_get_namespaceURI(
449 IXMLDOMCDATASection *iface,
450 BSTR* p)
452 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
453 return IXMLDOMNode_get_namespaceURI( This->node, p );
456 static HRESULT WINAPI domcdata_get_prefix(
457 IXMLDOMCDATASection *iface,
458 BSTR* p)
460 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
461 return IXMLDOMNode_get_prefix( This->node, p );
464 static HRESULT WINAPI domcdata_get_baseName(
465 IXMLDOMCDATASection *iface,
466 BSTR* p)
468 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
469 return IXMLDOMNode_get_baseName( This->node, p );
472 static HRESULT WINAPI domcdata_transformNodeToObject(
473 IXMLDOMCDATASection *iface,
474 IXMLDOMNode* domNode, VARIANT var1)
476 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
477 return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
480 static HRESULT WINAPI domcdata_get_data(
481 IXMLDOMCDATASection *iface,
482 BSTR *p)
484 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
485 HRESULT hr = E_FAIL;
486 VARIANT vRet;
488 if(!p)
489 return E_INVALIDARG;
491 hr = IXMLDOMNode_get_nodeValue( This->node, &vRet );
492 if(hr == S_OK)
494 *p = V_BSTR(&vRet);
497 return hr;
500 static HRESULT WINAPI domcdata_put_data(
501 IXMLDOMCDATASection *iface,
502 BSTR data)
504 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
505 HRESULT hr = E_FAIL;
506 VARIANT val;
508 TRACE("%p %s\n", This, debugstr_w(data) );
510 V_VT(&val) = VT_BSTR;
511 V_BSTR(&val) = data;
513 hr = IXMLDOMNode_put_nodeValue( This->node, val );
515 return hr;
518 static HRESULT WINAPI domcdata_get_length(
519 IXMLDOMCDATASection *iface,
520 long *len)
522 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
523 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
524 xmlChar *pContent;
525 long nLength = 0;
527 TRACE("%p\n", iface);
529 if(!len)
530 return E_INVALIDARG;
532 pContent = xmlNodeGetContent(pDOMNode->node);
533 if(pContent)
535 nLength = xmlStrlen(pContent);
536 xmlFree(pContent);
539 *len = nLength;
541 return S_OK;
544 static HRESULT WINAPI domcdata_substringData(
545 IXMLDOMCDATASection *iface,
546 long offset, long count, BSTR *p)
548 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
549 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
550 xmlChar *pContent;
551 long nLength = 0;
552 HRESULT hr = S_FALSE;
554 TRACE("%p\n", iface);
556 if(!p)
557 return E_INVALIDARG;
559 *p = NULL;
560 if(offset < 0 || count < 0)
561 return E_INVALIDARG;
563 if(count == 0)
564 return hr;
566 pContent = xmlNodeGetContent(pDOMNode->node);
567 if(pContent)
569 nLength = xmlStrlen(pContent);
571 if( offset < nLength)
573 BSTR sContent = bstr_from_xmlChar(pContent);
574 if(offset + count > nLength)
575 *p = SysAllocString(&sContent[offset]);
576 else
577 *p = SysAllocStringLen(&sContent[offset], count);
579 SysFreeString(sContent);
580 hr = S_OK;
583 xmlFree(pContent);
586 return hr;
589 static HRESULT WINAPI domcdata_appendData(
590 IXMLDOMCDATASection *iface,
591 BSTR p)
593 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
594 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
595 xmlChar *pContent;
596 HRESULT hr = S_FALSE;
598 TRACE("%p\n", iface);
600 /* Nothing to do if NULL or an Empty string passed in. */
601 if(p == NULL || SysStringLen(p) == 0)
602 return S_OK;
604 pContent = xmlChar_from_wchar( p );
605 if(pContent)
607 if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
608 hr = S_OK;
609 else
610 hr = E_FAIL;
612 else
613 hr = E_FAIL;
614 HeapFree(GetProcessHeap(), 0, pContent);
616 return hr;
619 static HRESULT WINAPI domcdata_insertData(
620 IXMLDOMCDATASection *iface,
621 long offset, BSTR p)
623 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
624 xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node );
625 xmlChar *pXmlContent;
626 BSTR sNewString;
627 HRESULT hr = S_FALSE;
628 long nLength = 0, nLengthP = 0;
629 xmlChar *str = NULL;
631 TRACE("%p\n", This);
633 /* If have a NULL or empty string, don't do anything. */
634 if(SysStringLen(p) == 0)
635 return S_OK;
637 if(offset < 0)
639 return E_INVALIDARG;
642 pXmlContent = xmlNodeGetContent(pDOMNode->node);
643 if(pXmlContent)
645 BSTR sContent = bstr_from_xmlChar( pXmlContent );
646 nLength = SysStringLen(sContent);
647 nLengthP = SysStringLen(p);
649 if(nLength < offset)
651 SysFreeString(sContent);
652 xmlFree(pXmlContent);
654 return E_INVALIDARG;
657 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
658 if(sNewString)
660 if(offset > 0)
661 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
663 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
665 if(offset+nLengthP < nLength)
666 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
668 sNewString[nLengthP + nLength] = 0;
670 str = xmlChar_from_wchar(sNewString);
671 if(str)
673 xmlNodeSetContent(pDOMNode->node, str);
674 hr = S_OK;
676 HeapFree(GetProcessHeap(), 0, str);
678 SysFreeString(sNewString);
681 SysFreeString(sContent);
683 xmlFree(pXmlContent);
686 return hr;
689 static HRESULT WINAPI domcdata_deleteData(
690 IXMLDOMCDATASection *iface,
691 long offset, long count)
693 FIXME("\n");
694 return E_NOTIMPL;
697 static HRESULT WINAPI domcdata_replaceData(
698 IXMLDOMCDATASection *iface,
699 long offset, long count, BSTR p)
701 FIXME("\n");
702 return E_NOTIMPL;
705 static HRESULT WINAPI domcdata_splitText(
706 IXMLDOMCDATASection *iface,
707 long offset, IXMLDOMText **txtNode)
709 FIXME("\n");
710 return E_NOTIMPL;
714 static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
716 domcdata_QueryInterface,
717 domcdata_AddRef,
718 domcdata_Release,
719 domcdata_GetTypeInfoCount,
720 domcdata_GetTypeInfo,
721 domcdata_GetIDsOfNames,
722 domcdata_Invoke,
723 domcdata_get_nodeName,
724 domcdata_get_nodeValue,
725 domcdata_put_nodeValue,
726 domcdata_get_nodeType,
727 domcdata_get_parentNode,
728 domcdata_get_childNodes,
729 domcdata_get_firstChild,
730 domcdata_get_lastChild,
731 domcdata_get_previousSibling,
732 domcdata_get_nextSibling,
733 domcdata_get_attributes,
734 domcdata_insertBefore,
735 domcdata_replaceChild,
736 domcdata_removeChild,
737 domcdata_appendChild,
738 domcdata_hasChildNodes,
739 domcdata_get_ownerDocument,
740 domcdata_cloneNode,
741 domcdata_get_nodeTypeString,
742 domcdata_get_text,
743 domcdata_put_text,
744 domcdata_get_specified,
745 domcdata_get_definition,
746 domcdata_get_nodeTypedValue,
747 domcdata_put_nodeTypedValue,
748 domcdata_get_dataType,
749 domcdata_put_dataType,
750 domcdata_get_xml,
751 domcdata_transformNode,
752 domcdata_selectNodes,
753 domcdata_selectSingleNode,
754 domcdata_get_parsed,
755 domcdata_get_namespaceURI,
756 domcdata_get_prefix,
757 domcdata_get_baseName,
758 domcdata_transformNodeToObject,
759 domcdata_get_data,
760 domcdata_put_data,
761 domcdata_get_length,
762 domcdata_substringData,
763 domcdata_appendData,
764 domcdata_insertData,
765 domcdata_deleteData,
766 domcdata_replaceData,
767 domcdata_splitText
770 IUnknown* create_cdata( xmlNodePtr text )
772 domcdata *This;
773 HRESULT hr;
775 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
776 if ( !This )
777 return NULL;
779 This->lpVtbl = &domcdata_vtbl;
780 This->ref = 1;
782 This->node_unk = create_basic_node( text, (IUnknown*)&This->lpVtbl );
783 if(!This->node_unk)
785 HeapFree(GetProcessHeap(), 0, This);
786 return NULL;
789 hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
790 if(FAILED(hr))
792 IUnknown_Release(This->node_unk);
793 HeapFree( GetProcessHeap(), 0, This );
794 return NULL;
796 /* The ref on This->node is actually looped back into this object, so release it */
797 IXMLDOMNode_Release(This->node);
799 return (IUnknown*) &This->lpVtbl;
802 #endif