mountmgr: Add a Wine-specific ioctl to define a drive for a Unix path.
[wine/multimedia.git] / dlls / msxml3 / cdata.c
blob368b731fb8aca8c4a9da5582306538a3ae7ea95f
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_IXMLDOMCharacterData) ||
63 IsEqualGUID( riid, &IID_IDispatch ) ||
64 IsEqualGUID( riid, &IID_IUnknown ) )
66 *ppvObject = iface;
68 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
69 IsEqualGUID( riid, &IID_IXMLDOMElement ) )
71 return IUnknown_QueryInterface(This->element_unk, riid, ppvObject);
73 else
75 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
76 return E_NOINTERFACE;
79 IXMLDOMCDATASection_AddRef( iface );
81 return S_OK;
84 static ULONG WINAPI domcdata_AddRef(
85 IXMLDOMCDATASection *iface )
87 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
88 return InterlockedIncrement( &This->ref );
91 static ULONG WINAPI domcdata_Release(
92 IXMLDOMCDATASection *iface )
94 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
95 ULONG ref;
97 ref = InterlockedDecrement( &This->ref );
98 if ( ref == 0 )
100 IUnknown_Release( This->element_unk );
101 HeapFree( GetProcessHeap(), 0, This );
104 return ref;
107 static HRESULT WINAPI domcdata_GetTypeInfoCount(
108 IXMLDOMCDATASection *iface,
109 UINT* pctinfo )
111 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
113 TRACE("(%p)->(%p)\n", This, pctinfo);
115 *pctinfo = 1;
117 return S_OK;
120 static HRESULT WINAPI domcdata_GetTypeInfo(
121 IXMLDOMCDATASection *iface,
122 UINT iTInfo, LCID lcid,
123 ITypeInfo** ppTInfo )
125 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
126 HRESULT hr;
128 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
130 hr = get_typeinfo(IXMLDOMCDATASection_tid, ppTInfo);
132 return hr;
135 static HRESULT WINAPI domcdata_GetIDsOfNames(
136 IXMLDOMCDATASection *iface,
137 REFIID riid, LPOLESTR* rgszNames,
138 UINT cNames, LCID lcid, DISPID* rgDispId )
140 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
141 ITypeInfo *typeinfo;
142 HRESULT hr;
144 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
145 lcid, rgDispId);
147 if(!rgszNames || cNames == 0 || !rgDispId)
148 return E_INVALIDARG;
150 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
151 if(SUCCEEDED(hr))
153 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
154 ITypeInfo_Release(typeinfo);
157 return hr;
160 static HRESULT WINAPI domcdata_Invoke(
161 IXMLDOMCDATASection *iface,
162 DISPID dispIdMember, REFIID riid, LCID lcid,
163 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
164 EXCEPINFO* pExcepInfo, UINT* puArgErr )
166 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
167 ITypeInfo *typeinfo;
168 HRESULT hr;
170 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
171 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
173 hr = get_typeinfo(IXMLDOMCDATASection_tid, &typeinfo);
174 if(SUCCEEDED(hr))
176 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
177 pVarResult, pExcepInfo, puArgErr);
178 ITypeInfo_Release(typeinfo);
181 return hr;
184 static HRESULT WINAPI domcdata_get_nodeName(
185 IXMLDOMCDATASection *iface,
186 BSTR* p )
188 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
189 return IXMLDOMNode_get_nodeName( This->element, p );
192 static HRESULT WINAPI domcdata_get_nodeValue(
193 IXMLDOMCDATASection *iface,
194 VARIANT* var1 )
196 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
197 return IXMLDOMNode_get_nodeValue( This->element, var1 );
200 static HRESULT WINAPI domcdata_put_nodeValue(
201 IXMLDOMCDATASection *iface,
202 VARIANT var1 )
204 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
205 return IXMLDOMNode_put_nodeValue( This->element, var1 );
208 static HRESULT WINAPI domcdata_get_nodeType(
209 IXMLDOMCDATASection *iface,
210 DOMNodeType* domNodeType )
212 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
213 return IXMLDOMNode_get_nodeType( This->element, domNodeType );
216 static HRESULT WINAPI domcdata_get_parentNode(
217 IXMLDOMCDATASection *iface,
218 IXMLDOMNode** parent )
220 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
221 return IXMLDOMNode_get_parentNode( This->element, parent );
224 static HRESULT WINAPI domcdata_get_childNodes(
225 IXMLDOMCDATASection *iface,
226 IXMLDOMNodeList** outList)
228 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
229 return IXMLDOMNode_get_childNodes( This->element, outList );
232 static HRESULT WINAPI domcdata_get_firstChild(
233 IXMLDOMCDATASection *iface,
234 IXMLDOMNode** domNode)
236 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
237 return IXMLDOMNode_get_firstChild( This->element, domNode );
240 static HRESULT WINAPI domcdata_get_lastChild(
241 IXMLDOMCDATASection *iface,
242 IXMLDOMNode** domNode)
244 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
245 return IXMLDOMNode_get_lastChild( This->element, domNode );
248 static HRESULT WINAPI domcdata_get_previousSibling(
249 IXMLDOMCDATASection *iface,
250 IXMLDOMNode** domNode)
252 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
253 return IXMLDOMNode_get_previousSibling( This->element, domNode );
256 static HRESULT WINAPI domcdata_get_nextSibling(
257 IXMLDOMCDATASection *iface,
258 IXMLDOMNode** domNode)
260 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
261 return IXMLDOMNode_get_nextSibling( This->element, domNode );
264 static HRESULT WINAPI domcdata_get_attributes(
265 IXMLDOMCDATASection *iface,
266 IXMLDOMNamedNodeMap** attributeMap)
268 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
269 return IXMLDOMNode_get_attributes( This->element, attributeMap );
272 static HRESULT WINAPI domcdata_insertBefore(
273 IXMLDOMCDATASection *iface,
274 IXMLDOMNode* newNode, VARIANT var1,
275 IXMLDOMNode** outOldNode)
277 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
278 return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode );
281 static HRESULT WINAPI domcdata_replaceChild(
282 IXMLDOMCDATASection *iface,
283 IXMLDOMNode* newNode,
284 IXMLDOMNode* oldNode,
285 IXMLDOMNode** outOldNode)
287 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
288 return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode );
291 static HRESULT WINAPI domcdata_removeChild(
292 IXMLDOMCDATASection *iface,
293 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
295 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
296 return IXMLDOMNode_removeChild( This->element, domNode, oldNode );
299 static HRESULT WINAPI domcdata_appendChild(
300 IXMLDOMCDATASection *iface,
301 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
303 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
304 return IXMLDOMNode_appendChild( This->element, newNode, outNewNode );
307 static HRESULT WINAPI domcdata_hasChildNodes(
308 IXMLDOMCDATASection *iface,
309 VARIANT_BOOL* pbool)
311 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
312 return IXMLDOMNode_hasChildNodes( This->element, pbool );
315 static HRESULT WINAPI domcdata_get_ownerDocument(
316 IXMLDOMCDATASection *iface,
317 IXMLDOMDocument** domDocument)
319 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
320 return IXMLDOMNode_get_ownerDocument( This->element, domDocument );
323 static HRESULT WINAPI domcdata_cloneNode(
324 IXMLDOMCDATASection *iface,
325 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
327 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
328 return IXMLDOMNode_cloneNode( This->element, pbool, outNode );
331 static HRESULT WINAPI domcdata_get_nodeTypeString(
332 IXMLDOMCDATASection *iface,
333 BSTR* p)
335 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
336 return IXMLDOMNode_get_nodeTypeString( This->element, p );
339 static HRESULT WINAPI domcdata_get_text(
340 IXMLDOMCDATASection *iface,
341 BSTR* p)
343 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
344 return IXMLDOMNode_get_text( This->element, p );
347 static HRESULT WINAPI domcdata_put_text(
348 IXMLDOMCDATASection *iface,
349 BSTR p)
351 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
352 return IXMLDOMNode_put_text( This->element, p );
355 static HRESULT WINAPI domcdata_get_specified(
356 IXMLDOMCDATASection *iface,
357 VARIANT_BOOL* pbool)
359 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
360 return IXMLDOMNode_get_specified( This->element, pbool );
363 static HRESULT WINAPI domcdata_get_definition(
364 IXMLDOMCDATASection *iface,
365 IXMLDOMNode** domNode)
367 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
368 return IXMLDOMNode_get_definition( This->element, domNode );
371 static HRESULT WINAPI domcdata_get_nodeTypedValue(
372 IXMLDOMCDATASection *iface,
373 VARIANT* var1)
375 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
376 return IXMLDOMNode_get_nodeTypedValue( This->element, var1 );
379 static HRESULT WINAPI domcdata_put_nodeTypedValue(
380 IXMLDOMCDATASection *iface,
381 VARIANT var1)
383 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
384 return IXMLDOMNode_put_nodeTypedValue( This->element, var1 );
387 static HRESULT WINAPI domcdata_get_dataType(
388 IXMLDOMCDATASection *iface,
389 VARIANT* var1)
391 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
392 return IXMLDOMNode_get_dataType( This->element, var1 );
395 static HRESULT WINAPI domcdata_put_dataType(
396 IXMLDOMCDATASection *iface,
397 BSTR p)
399 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
400 return IXMLDOMNode_put_dataType( This->element, p );
403 static HRESULT WINAPI domcdata_get_xml(
404 IXMLDOMCDATASection *iface,
405 BSTR* p)
407 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
408 return IXMLDOMNode_get_xml( This->element, p );
411 static HRESULT WINAPI domcdata_transformNode(
412 IXMLDOMCDATASection *iface,
413 IXMLDOMNode* domNode, BSTR* p)
415 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
416 return IXMLDOMNode_transformNode( This->element, domNode, p );
419 static HRESULT WINAPI domcdata_selectNodes(
420 IXMLDOMCDATASection *iface,
421 BSTR p, IXMLDOMNodeList** outList)
423 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
424 return IXMLDOMNode_selectNodes( This->element, p, outList );
427 static HRESULT WINAPI domcdata_selectSingleNode(
428 IXMLDOMCDATASection *iface,
429 BSTR p, IXMLDOMNode** outNode)
431 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
432 return IXMLDOMNode_selectSingleNode( This->element, p, outNode );
435 static HRESULT WINAPI domcdata_get_parsed(
436 IXMLDOMCDATASection *iface,
437 VARIANT_BOOL* pbool)
439 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
440 return IXMLDOMNode_get_parsed( This->element, pbool );
443 static HRESULT WINAPI domcdata_get_namespaceURI(
444 IXMLDOMCDATASection *iface,
445 BSTR* p)
447 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
448 return IXMLDOMNode_get_namespaceURI( This->element, p );
451 static HRESULT WINAPI domcdata_get_prefix(
452 IXMLDOMCDATASection *iface,
453 BSTR* p)
455 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
456 return IXMLDOMNode_get_prefix( This->element, p );
459 static HRESULT WINAPI domcdata_get_baseName(
460 IXMLDOMCDATASection *iface,
461 BSTR* p)
463 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
464 return IXMLDOMNode_get_baseName( This->element, p );
467 static HRESULT WINAPI domcdata_transformNodeToObject(
468 IXMLDOMCDATASection *iface,
469 IXMLDOMNode* domNode, VARIANT var1)
471 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
472 return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 );
475 static HRESULT WINAPI domcdata_get_data(
476 IXMLDOMCDATASection *iface,
477 BSTR *p)
479 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
480 HRESULT hr = E_FAIL;
481 VARIANT vRet;
483 if(!p)
484 return E_INVALIDARG;
486 hr = IXMLDOMNode_get_nodeValue( This->element, &vRet );
487 if(hr == S_OK)
489 *p = V_BSTR(&vRet);
492 return hr;
495 static HRESULT WINAPI domcdata_put_data(
496 IXMLDOMCDATASection *iface,
497 BSTR data)
499 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
500 HRESULT hr = E_FAIL;
501 VARIANT val;
503 TRACE("%p %s\n", This, debugstr_w(data) );
505 V_VT(&val) = VT_BSTR;
506 V_BSTR(&val) = data;
508 hr = IXMLDOMNode_put_nodeValue( This->element, val );
510 return hr;
513 static HRESULT WINAPI domcdata_get_length(
514 IXMLDOMCDATASection *iface,
515 long *len)
517 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
518 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
519 xmlChar *pContent;
520 long nLength = 0;
522 TRACE("%p\n", iface);
524 if(!len)
525 return E_INVALIDARG;
527 pContent = xmlNodeGetContent(pDOMNode->node);
528 if(pContent)
530 nLength = xmlStrlen(pContent);
531 xmlFree(pContent);
534 *len = nLength;
536 return S_OK;
539 static HRESULT WINAPI domcdata_substringData(
540 IXMLDOMCDATASection *iface,
541 long offset, long count, BSTR *p)
543 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
544 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
545 xmlChar *pContent;
546 long nLength = 0;
547 HRESULT hr = S_FALSE;
549 TRACE("%p\n", iface);
551 if(!p)
552 return E_INVALIDARG;
554 *p = NULL;
555 if(offset < 0 || count < 0)
556 return E_INVALIDARG;
558 if(count == 0)
559 return hr;
561 pContent = xmlNodeGetContent(pDOMNode->node);
562 if(pContent)
564 nLength = xmlStrlen(pContent);
566 if( offset < nLength)
568 BSTR sContent = bstr_from_xmlChar(pContent);
569 if(offset + count > nLength)
570 *p = SysAllocString(&sContent[offset]);
571 else
572 *p = SysAllocStringLen(&sContent[offset], count);
574 SysFreeString(sContent);
575 hr = S_OK;
578 xmlFree(pContent);
581 return hr;
584 static HRESULT WINAPI domcdata_appendData(
585 IXMLDOMCDATASection *iface,
586 BSTR p)
588 domcdata *This = impl_from_IXMLDOMCDATASection( iface );
589 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
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( (WCHAR*)p );
600 if(pContent)
602 if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0)
603 hr = S_OK;
604 else
605 hr = E_FAIL;
607 else
608 hr = E_FAIL;
609 HeapFree(GetProcessHeap(), 0, 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 xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
620 xmlChar *pXmlContent;
621 BSTR sNewString;
622 HRESULT hr = S_FALSE;
623 long nLength = 0, nLengthP = 0;
624 xmlChar *str = NULL;
626 TRACE("%p\n", This);
628 /* If have a NULL or empty string, don't do anything. */
629 if(SysStringLen(p) == 0)
630 return S_OK;
632 if(offset < 0)
634 return E_INVALIDARG;
637 pXmlContent = xmlNodeGetContent(pDOMNode->node);
638 if(pXmlContent)
640 BSTR sContent = bstr_from_xmlChar( pXmlContent );
641 nLength = SysStringLen(sContent);
642 nLengthP = SysStringLen(p);
644 if(nLength < offset)
646 SysFreeString(sContent);
647 xmlFree(pXmlContent);
649 return E_INVALIDARG;
652 sNewString = SysAllocStringLen(NULL, nLength + nLengthP + 1);
653 if(sNewString)
655 if(offset > 0)
656 memcpy(sNewString, sContent, offset * sizeof(WCHAR));
658 memcpy(&sNewString[offset], p, nLengthP * sizeof(WCHAR));
660 if(offset+nLengthP < nLength)
661 memcpy(&sNewString[offset+nLengthP], &sContent[offset], (nLength-offset) * sizeof(WCHAR));
663 sNewString[nLengthP + nLength] = 0;
665 str = xmlChar_from_wchar((WCHAR*)sNewString);
666 if(str)
668 xmlNodeSetContent(pDOMNode->node, str);
669 hr = S_OK;
671 HeapFree(GetProcessHeap(), 0, str);
673 SysFreeString(sNewString);
676 SysFreeString(sContent);
678 xmlFree(pXmlContent);
681 return hr;
684 static HRESULT WINAPI domcdata_deleteData(
685 IXMLDOMCDATASection *iface,
686 long offset, long count)
688 FIXME("\n");
689 return E_NOTIMPL;
692 static HRESULT WINAPI domcdata_replaceData(
693 IXMLDOMCDATASection *iface,
694 long offset, long count, BSTR p)
696 FIXME("\n");
697 return E_NOTIMPL;
700 static HRESULT WINAPI domcdata_splitText(
701 IXMLDOMCDATASection *iface,
702 long offset, IXMLDOMText **txtNode)
704 FIXME("\n");
705 return E_NOTIMPL;
709 static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl =
711 domcdata_QueryInterface,
712 domcdata_AddRef,
713 domcdata_Release,
714 domcdata_GetTypeInfoCount,
715 domcdata_GetTypeInfo,
716 domcdata_GetIDsOfNames,
717 domcdata_Invoke,
718 domcdata_get_nodeName,
719 domcdata_get_nodeValue,
720 domcdata_put_nodeValue,
721 domcdata_get_nodeType,
722 domcdata_get_parentNode,
723 domcdata_get_childNodes,
724 domcdata_get_firstChild,
725 domcdata_get_lastChild,
726 domcdata_get_previousSibling,
727 domcdata_get_nextSibling,
728 domcdata_get_attributes,
729 domcdata_insertBefore,
730 domcdata_replaceChild,
731 domcdata_removeChild,
732 domcdata_appendChild,
733 domcdata_hasChildNodes,
734 domcdata_get_ownerDocument,
735 domcdata_cloneNode,
736 domcdata_get_nodeTypeString,
737 domcdata_get_text,
738 domcdata_put_text,
739 domcdata_get_specified,
740 domcdata_get_definition,
741 domcdata_get_nodeTypedValue,
742 domcdata_put_nodeTypedValue,
743 domcdata_get_dataType,
744 domcdata_put_dataType,
745 domcdata_get_xml,
746 domcdata_transformNode,
747 domcdata_selectNodes,
748 domcdata_selectSingleNode,
749 domcdata_get_parsed,
750 domcdata_get_namespaceURI,
751 domcdata_get_prefix,
752 domcdata_get_baseName,
753 domcdata_transformNodeToObject,
754 domcdata_get_data,
755 domcdata_put_data,
756 domcdata_get_length,
757 domcdata_substringData,
758 domcdata_appendData,
759 domcdata_insertData,
760 domcdata_deleteData,
761 domcdata_replaceData,
762 domcdata_splitText
765 IUnknown* create_cdata( xmlNodePtr text )
767 domcdata *This;
768 HRESULT hr;
770 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
771 if ( !This )
772 return NULL;
774 This->lpVtbl = &domcdata_vtbl;
775 This->ref = 1;
777 This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl );
778 if(!This->element_unk)
780 HeapFree(GetProcessHeap(), 0, This);
781 return NULL;
784 hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element);
785 if(FAILED(hr))
787 IUnknown_Release(This->element_unk);
788 HeapFree( GetProcessHeap(), 0, This );
789 return NULL;
791 /* The ref on This->element is actually looped back into this object, so release it */
792 IXMLDOMNode_Release(This->element);
794 return (IUnknown*) &This->lpVtbl;
797 #endif