Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / msxml3 / text.c
blob9b25008e3016b11a8d5b6b8ee3c98927b0acb88e
1 /*
2 * DOM text node implementation
4 * Copyright 2006 Huw Davies
5 * Copyright 2007-2008 Alistair Leslie-Hughes
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define COBJMACROS
24 #include "config.h"
26 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "msxml6.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 #ifdef HAVE_LIBXML2
41 typedef struct _domtext
43 xmlnode node;
44 const struct IXMLDOMTextVtbl *lpVtbl;
45 LONG ref;
46 } domtext;
48 static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface )
50 return (domtext *)((char*)iface - FIELD_OFFSET(domtext, lpVtbl));
53 static HRESULT WINAPI domtext_QueryInterface(
54 IXMLDOMText *iface,
55 REFIID riid,
56 void** ppvObject )
58 domtext *This = impl_from_IXMLDOMText( iface );
59 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
61 if ( IsEqualGUID( riid, &IID_IXMLDOMText ) ||
62 IsEqualGUID( riid, &IID_IXMLDOMCharacterData) ||
63 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
64 IsEqualGUID( riid, &IID_IDispatch ) ||
65 IsEqualGUID( riid, &IID_IUnknown ) )
67 *ppvObject = iface;
69 else if(node_query_interface(&This->node, riid, ppvObject))
71 return *ppvObject ? S_OK : E_NOINTERFACE;
73 else if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
74 IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) )
76 /* IXMLDOMText is known to be correct in not implementing these */
77 TRACE("Unsupported interface\n");
78 return E_NOINTERFACE;
80 else
82 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
83 return E_NOINTERFACE;
86 IXMLDOMText_AddRef((IUnknown*)*ppvObject);
87 return S_OK;
90 static ULONG WINAPI domtext_AddRef(
91 IXMLDOMText *iface )
93 domtext *This = impl_from_IXMLDOMText( iface );
94 return InterlockedIncrement( &This->ref );
97 static ULONG WINAPI domtext_Release(
98 IXMLDOMText *iface )
100 domtext *This = impl_from_IXMLDOMText( iface );
101 ULONG ref;
103 ref = InterlockedDecrement( &This->ref );
104 if ( ref == 0 )
106 destroy_xmlnode(&This->node);
107 heap_free( This );
110 return ref;
113 static HRESULT WINAPI domtext_GetTypeInfoCount(
114 IXMLDOMText *iface,
115 UINT* pctinfo )
117 domtext *This = impl_from_IXMLDOMText( iface );
119 TRACE("(%p)->(%p)\n", This, pctinfo);
121 *pctinfo = 1;
123 return S_OK;
126 static HRESULT WINAPI domtext_GetTypeInfo(
127 IXMLDOMText *iface,
128 UINT iTInfo, LCID lcid,
129 ITypeInfo** ppTInfo )
131 domtext *This = impl_from_IXMLDOMText( iface );
132 HRESULT hr;
134 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
136 hr = get_typeinfo(IXMLDOMText_tid, ppTInfo);
138 return hr;
141 static HRESULT WINAPI domtext_GetIDsOfNames(
142 IXMLDOMText *iface,
143 REFIID riid, LPOLESTR* rgszNames,
144 UINT cNames, LCID lcid, DISPID* rgDispId )
146 domtext *This = impl_from_IXMLDOMText( iface );
147 ITypeInfo *typeinfo;
148 HRESULT hr;
150 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
151 lcid, rgDispId);
153 if(!rgszNames || cNames == 0 || !rgDispId)
154 return E_INVALIDARG;
156 hr = get_typeinfo(IXMLDOMText_tid, &typeinfo);
157 if(SUCCEEDED(hr))
159 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
160 ITypeInfo_Release(typeinfo);
163 return hr;
166 static HRESULT WINAPI domtext_Invoke(
167 IXMLDOMText *iface,
168 DISPID dispIdMember, REFIID riid, LCID lcid,
169 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
170 EXCEPINFO* pExcepInfo, UINT* puArgErr )
172 domtext *This = impl_from_IXMLDOMText( iface );
173 ITypeInfo *typeinfo;
174 HRESULT hr;
176 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
177 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
179 hr = get_typeinfo(IXMLDOMText_tid, &typeinfo);
180 if(SUCCEEDED(hr))
182 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
183 pVarResult, pExcepInfo, puArgErr);
184 ITypeInfo_Release(typeinfo);
187 return hr;
190 static HRESULT WINAPI domtext_get_nodeName(
191 IXMLDOMText *iface,
192 BSTR* p )
194 domtext *This = impl_from_IXMLDOMText( iface );
196 static const WCHAR textW[] = {'#','t','e','x','t',0};
198 TRACE("(%p)->(%p)\n", This, p);
200 return return_bstr(textW, p);
203 static HRESULT WINAPI domtext_get_nodeValue(
204 IXMLDOMText *iface,
205 VARIANT* value )
207 domtext *This = impl_from_IXMLDOMText( iface );
209 TRACE("(%p)->(%p)\n", This, value);
211 if(!value)
212 return E_INVALIDARG;
214 V_VT(value) = VT_BSTR;
215 V_BSTR(value) = bstr_from_xmlChar(This->node.node->content);
216 return S_OK;
219 static HRESULT WINAPI domtext_put_nodeValue(
220 IXMLDOMText *iface,
221 VARIANT value)
223 domtext *This = impl_from_IXMLDOMText( iface );
225 TRACE("(%p)->(v%d)\n", This, V_VT(&value));
227 return node_put_value(&This->node, &value);
230 static HRESULT WINAPI domtext_get_nodeType(
231 IXMLDOMText *iface,
232 DOMNodeType* domNodeType )
234 domtext *This = impl_from_IXMLDOMText( iface );
236 TRACE("(%p)->(%p)\n", This, domNodeType);
238 *domNodeType = NODE_TEXT;
239 return S_OK;
242 static HRESULT WINAPI domtext_get_parentNode(
243 IXMLDOMText *iface,
244 IXMLDOMNode** parent )
246 domtext *This = impl_from_IXMLDOMText( iface );
248 TRACE("(%p)->(%p)\n", This, parent);
250 return node_get_parent(&This->node, parent);
253 static HRESULT WINAPI domtext_get_childNodes(
254 IXMLDOMText *iface,
255 IXMLDOMNodeList** outList)
257 domtext *This = impl_from_IXMLDOMText( iface );
259 TRACE("(%p)->(%p)\n", This, outList);
261 return node_get_child_nodes(&This->node, outList);
264 static HRESULT WINAPI domtext_get_firstChild(
265 IXMLDOMText *iface,
266 IXMLDOMNode** domNode)
268 domtext *This = impl_from_IXMLDOMText( iface );
270 TRACE("(%p)->(%p)\n", This, domNode);
272 return return_null_node(domNode);
275 static HRESULT WINAPI domtext_get_lastChild(
276 IXMLDOMText *iface,
277 IXMLDOMNode** domNode)
279 domtext *This = impl_from_IXMLDOMText( iface );
281 TRACE("(%p)->(%p)\n", This, domNode);
283 return return_null_node(domNode);
286 static HRESULT WINAPI domtext_get_previousSibling(
287 IXMLDOMText *iface,
288 IXMLDOMNode** domNode)
290 domtext *This = impl_from_IXMLDOMText( iface );
292 TRACE("(%p)->(%p)\n", This, domNode);
294 return node_get_previous_sibling(&This->node, domNode);
297 static HRESULT WINAPI domtext_get_nextSibling(
298 IXMLDOMText *iface,
299 IXMLDOMNode** domNode)
301 domtext *This = impl_from_IXMLDOMText( iface );
303 TRACE("(%p)->(%p)\n", This, domNode);
305 return node_get_next_sibling(&This->node, domNode);
308 static HRESULT WINAPI domtext_get_attributes(
309 IXMLDOMText *iface,
310 IXMLDOMNamedNodeMap** attributeMap)
312 domtext *This = impl_from_IXMLDOMText( iface );
314 TRACE("(%p)->(%p)\n", This, attributeMap);
316 return return_null_ptr((void**)attributeMap);
319 static HRESULT WINAPI domtext_insertBefore(
320 IXMLDOMText *iface,
321 IXMLDOMNode* newNode, VARIANT refChild,
322 IXMLDOMNode** outOldNode)
324 domtext *This = impl_from_IXMLDOMText( iface );
326 FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
328 return node_insert_before(&This->node, newNode, &refChild, outOldNode);
331 static HRESULT WINAPI domtext_replaceChild(
332 IXMLDOMText *iface,
333 IXMLDOMNode* newNode,
334 IXMLDOMNode* oldNode,
335 IXMLDOMNode** outOldNode)
337 domtext *This = impl_from_IXMLDOMText( iface );
339 FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
341 return node_replace_child(&This->node, newNode, oldNode, outOldNode);
344 static HRESULT WINAPI domtext_removeChild(
345 IXMLDOMText *iface,
346 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
348 domtext *This = impl_from_IXMLDOMText( iface );
349 return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(&This->node), domNode, oldNode );
352 static HRESULT WINAPI domtext_appendChild(
353 IXMLDOMText *iface,
354 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
356 domtext *This = impl_from_IXMLDOMText( iface );
357 return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(&This->node), newNode, outNewNode );
360 static HRESULT WINAPI domtext_hasChildNodes(
361 IXMLDOMText *iface,
362 VARIANT_BOOL* pbool)
364 domtext *This = impl_from_IXMLDOMText( iface );
365 return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(&This->node), pbool );
368 static HRESULT WINAPI domtext_get_ownerDocument(
369 IXMLDOMText *iface,
370 IXMLDOMDocument** domDocument)
372 domtext *This = impl_from_IXMLDOMText( iface );
373 return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(&This->node), domDocument );
376 static HRESULT WINAPI domtext_cloneNode(
377 IXMLDOMText *iface,
378 VARIANT_BOOL deep, IXMLDOMNode** outNode)
380 domtext *This = impl_from_IXMLDOMText( iface );
381 TRACE("(%p)->(%d %p)\n", This, deep, outNode);
382 return node_clone( &This->node, deep, outNode );
385 static HRESULT WINAPI domtext_get_nodeTypeString(
386 IXMLDOMText *iface,
387 BSTR* p)
389 domtext *This = impl_from_IXMLDOMText( iface );
390 static const WCHAR textW[] = {'t','e','x','t',0};
392 TRACE("(%p)->(%p)\n", This, p);
394 return return_bstr(textW, p);
397 static HRESULT WINAPI domtext_get_text(
398 IXMLDOMText *iface,
399 BSTR* p)
401 domtext *This = impl_from_IXMLDOMText( iface );
402 return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(&This->node), p );
405 static HRESULT WINAPI domtext_put_text(
406 IXMLDOMText *iface,
407 BSTR p)
409 domtext *This = impl_from_IXMLDOMText( iface );
410 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
411 return node_put_text( &This->node, p );
414 static HRESULT WINAPI domtext_get_specified(
415 IXMLDOMText *iface,
416 VARIANT_BOOL* isSpecified)
418 domtext *This = impl_from_IXMLDOMText( iface );
419 FIXME("(%p)->(%p) stub!\n", This, isSpecified);
420 *isSpecified = VARIANT_TRUE;
421 return S_OK;
424 static HRESULT WINAPI domtext_get_definition(
425 IXMLDOMText *iface,
426 IXMLDOMNode** definitionNode)
428 domtext *This = impl_from_IXMLDOMText( iface );
429 FIXME("(%p)->(%p)\n", This, definitionNode);
430 return E_NOTIMPL;
433 static HRESULT WINAPI domtext_get_nodeTypedValue(
434 IXMLDOMText *iface,
435 VARIANT* var1)
437 domtext *This = impl_from_IXMLDOMText( iface );
438 return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
441 static HRESULT WINAPI domtext_put_nodeTypedValue(
442 IXMLDOMText *iface,
443 VARIANT var1)
445 domtext *This = impl_from_IXMLDOMText( iface );
446 return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
449 static HRESULT WINAPI domtext_get_dataType(
450 IXMLDOMText *iface,
451 VARIANT* typename)
453 domtext *This = impl_from_IXMLDOMText( iface );
454 TRACE("(%p)->(%p)\n", This, typename);
455 return return_null_var( typename );
458 static HRESULT WINAPI domtext_put_dataType(
459 IXMLDOMText *iface,
460 BSTR p)
462 domtext *This = impl_from_IXMLDOMText( iface );
463 return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(&This->node), p );
466 static HRESULT WINAPI domtext_get_xml(
467 IXMLDOMText *iface,
468 BSTR* p)
470 domtext *This = impl_from_IXMLDOMText( iface );
472 TRACE("(%p)->(%p)\n", This, p);
474 return node_get_xml(&This->node, FALSE, FALSE, p);
477 static HRESULT WINAPI domtext_transformNode(
478 IXMLDOMText *iface,
479 IXMLDOMNode* domNode, BSTR* p)
481 domtext *This = impl_from_IXMLDOMText( iface );
482 return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(&This->node), domNode, p );
485 static HRESULT WINAPI domtext_selectNodes(
486 IXMLDOMText *iface,
487 BSTR p, IXMLDOMNodeList** outList)
489 domtext *This = impl_from_IXMLDOMText( iface );
490 return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(&This->node), p, outList );
493 static HRESULT WINAPI domtext_selectSingleNode(
494 IXMLDOMText *iface,
495 BSTR p, IXMLDOMNode** outNode)
497 domtext *This = impl_from_IXMLDOMText( iface );
498 return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(&This->node), p, outNode );
501 static HRESULT WINAPI domtext_get_parsed(
502 IXMLDOMText *iface,
503 VARIANT_BOOL* isParsed)
505 domtext *This = impl_from_IXMLDOMText( iface );
506 FIXME("(%p)->(%p) stub!\n", This, isParsed);
507 *isParsed = VARIANT_TRUE;
508 return S_OK;
511 static HRESULT WINAPI domtext_get_namespaceURI(
512 IXMLDOMText *iface,
513 BSTR* p)
515 domtext *This = impl_from_IXMLDOMText( iface );
516 return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(&This->node), p );
519 static HRESULT WINAPI domtext_get_prefix(
520 IXMLDOMText *iface,
521 BSTR* prefix)
523 domtext *This = impl_from_IXMLDOMText( iface );
524 TRACE("(%p)->(%p)\n", This, prefix);
525 return return_null_bstr( prefix );
528 static HRESULT WINAPI domtext_get_baseName(
529 IXMLDOMText *iface,
530 BSTR* name)
532 domtext *This = impl_from_IXMLDOMText( iface );
533 TRACE("(%p)->(%p)\n", This, name);
534 return return_null_bstr( name );
537 static HRESULT WINAPI domtext_transformNodeToObject(
538 IXMLDOMText *iface,
539 IXMLDOMNode* domNode, VARIANT var1)
541 domtext *This = impl_from_IXMLDOMText( iface );
542 return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(&This->node), domNode, var1 );
545 static HRESULT WINAPI domtext_get_data(
546 IXMLDOMText *iface,
547 BSTR *p)
549 domtext *This = impl_from_IXMLDOMText( iface );
551 if(!p)
552 return E_INVALIDARG;
554 *p = bstr_from_xmlChar(This->node.node->content);
555 return S_OK;
558 static HRESULT WINAPI domtext_put_data(
559 IXMLDOMText *iface,
560 BSTR data)
562 domtext *This = impl_from_IXMLDOMText( iface );
563 VARIANT val;
565 TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
567 V_VT(&val) = VT_BSTR;
568 V_BSTR(&val) = data;
569 return node_put_value(&This->node, &val);
572 static HRESULT WINAPI domtext_get_length(
573 IXMLDOMText *iface,
574 LONG *len)
576 domtext *This = impl_from_IXMLDOMText( iface );
577 HRESULT hr;
578 BSTR data;
580 TRACE("(%p)->(%p)\n", This, len);
582 if(!len)
583 return E_INVALIDARG;
585 hr = IXMLDOMText_get_data(iface, &data);
586 if(hr == S_OK)
588 *len = SysStringLen(data);
589 SysFreeString(data);
592 return hr;
595 static HRESULT WINAPI domtext_substringData(
596 IXMLDOMText *iface,
597 LONG offset, LONG count, BSTR *p)
599 domtext *This = impl_from_IXMLDOMText( iface );
600 HRESULT hr;
601 BSTR data;
603 TRACE("(%p)->(%d %d %p)\n", This, offset, count, p);
605 if(!p)
606 return E_INVALIDARG;
608 *p = NULL;
609 if(offset < 0 || count < 0)
610 return E_INVALIDARG;
612 if(count == 0)
613 return S_FALSE;
615 hr = IXMLDOMText_get_data(iface, &data);
616 if(hr == S_OK)
618 LONG len = SysStringLen(data);
620 if(offset < len)
622 if(offset + count > len)
623 *p = SysAllocString(&data[offset]);
624 else
625 *p = SysAllocStringLen(&data[offset], count);
627 else
628 hr = S_FALSE;
630 SysFreeString(data);
633 return hr;
636 static HRESULT WINAPI domtext_appendData(
637 IXMLDOMText *iface,
638 BSTR p)
640 domtext *This = impl_from_IXMLDOMText( iface );
641 HRESULT hr;
642 BSTR data;
643 LONG p_len;
645 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
647 /* Nothing to do if NULL or an Empty string passed in. */
648 if((p_len = SysStringLen(p)) == 0) return S_OK;
650 hr = IXMLDOMText_get_data(iface, &data);
651 if(hr == S_OK)
653 LONG len = SysStringLen(data);
654 BSTR str = SysAllocStringLen(NULL, p_len + len);
656 memcpy(str, data, len*sizeof(WCHAR));
657 memcpy(&str[len], p, p_len*sizeof(WCHAR));
658 str[len+p_len] = 0;
660 hr = IXMLDOMText_put_data(iface, str);
662 SysFreeString(str);
663 SysFreeString(data);
666 return hr;
669 static HRESULT WINAPI domtext_insertData(
670 IXMLDOMText *iface,
671 LONG offset, BSTR p)
673 domtext *This = impl_from_IXMLDOMText( iface );
674 HRESULT hr;
675 BSTR data;
676 LONG p_len;
678 TRACE("(%p)->(%d %s)\n", This, offset, debugstr_w(p));
680 /* If have a NULL or empty string, don't do anything. */
681 if((p_len = SysStringLen(p)) == 0)
682 return S_OK;
684 if(offset < 0)
686 return E_INVALIDARG;
689 hr = IXMLDOMText_get_data(iface, &data);
690 if(hr == S_OK)
692 LONG len = SysStringLen(data);
693 BSTR str;
695 if(len < offset)
697 SysFreeString(data);
698 return E_INVALIDARG;
701 str = SysAllocStringLen(NULL, len + p_len);
702 /* start part, supplied string and end part */
703 memcpy(str, data, offset*sizeof(WCHAR));
704 memcpy(&str[offset], p, p_len*sizeof(WCHAR));
705 memcpy(&str[offset+p_len], &data[offset], (len-offset)*sizeof(WCHAR));
706 str[len+p_len] = 0;
708 hr = IXMLDOMText_put_data(iface, str);
710 SysFreeString(str);
711 SysFreeString(data);
714 return hr;
717 static HRESULT WINAPI domtext_deleteData(
718 IXMLDOMText *iface,
719 LONG offset, LONG count)
721 HRESULT hr;
722 LONG len = -1;
723 BSTR str;
725 TRACE("(%p)->(%d %d)\n", iface, offset, count);
727 hr = IXMLDOMText_get_length(iface, &len);
728 if(hr != S_OK) return hr;
730 if((offset < 0) || (offset > len) || (count < 0))
731 return E_INVALIDARG;
733 if(len == 0) return S_OK;
735 /* cutting start or end */
736 if((offset == 0) || ((count + offset) >= len))
738 if(offset == 0)
739 IXMLDOMText_substringData(iface, count, len - count, &str);
740 else
741 IXMLDOMText_substringData(iface, 0, offset, &str);
742 hr = IXMLDOMText_put_data(iface, str);
744 else
745 /* cutting from the inside */
747 BSTR str_end;
749 IXMLDOMText_substringData(iface, 0, offset, &str);
750 IXMLDOMText_substringData(iface, offset + count, len - count, &str_end);
752 hr = IXMLDOMText_put_data(iface, str);
753 if(hr == S_OK)
754 hr = IXMLDOMText_appendData(iface, str_end);
756 SysFreeString(str_end);
759 SysFreeString(str);
761 return hr;
764 static HRESULT WINAPI domtext_replaceData(
765 IXMLDOMText *iface,
766 LONG offset, LONG count, BSTR p)
768 domtext *This = impl_from_IXMLDOMText( iface );
769 HRESULT hr;
771 TRACE("(%p)->(%d %d %s)\n", This, offset, count, debugstr_w(p));
773 hr = IXMLDOMText_deleteData(iface, offset, count);
775 if (hr == S_OK)
776 hr = IXMLDOMText_insertData(iface, offset, p);
778 return hr;
781 static HRESULT WINAPI domtext_splitText(
782 IXMLDOMText *iface,
783 LONG offset, IXMLDOMText **txtNode)
785 domtext *This = impl_from_IXMLDOMText( iface );
786 LONG length = 0;
788 TRACE("(%p)->(%d %p)\n", This, offset, txtNode);
790 if (!txtNode || offset < 0) return E_INVALIDARG;
792 *txtNode = NULL;
794 IXMLDOMText_get_length(iface, &length);
796 if (offset > length) return E_INVALIDARG;
797 if (offset == length) return S_FALSE;
799 FIXME("adjacent text nodes are not supported\n");
801 return E_NOTIMPL;
804 static const struct IXMLDOMTextVtbl domtext_vtbl =
806 domtext_QueryInterface,
807 domtext_AddRef,
808 domtext_Release,
809 domtext_GetTypeInfoCount,
810 domtext_GetTypeInfo,
811 domtext_GetIDsOfNames,
812 domtext_Invoke,
813 domtext_get_nodeName,
814 domtext_get_nodeValue,
815 domtext_put_nodeValue,
816 domtext_get_nodeType,
817 domtext_get_parentNode,
818 domtext_get_childNodes,
819 domtext_get_firstChild,
820 domtext_get_lastChild,
821 domtext_get_previousSibling,
822 domtext_get_nextSibling,
823 domtext_get_attributes,
824 domtext_insertBefore,
825 domtext_replaceChild,
826 domtext_removeChild,
827 domtext_appendChild,
828 domtext_hasChildNodes,
829 domtext_get_ownerDocument,
830 domtext_cloneNode,
831 domtext_get_nodeTypeString,
832 domtext_get_text,
833 domtext_put_text,
834 domtext_get_specified,
835 domtext_get_definition,
836 domtext_get_nodeTypedValue,
837 domtext_put_nodeTypedValue,
838 domtext_get_dataType,
839 domtext_put_dataType,
840 domtext_get_xml,
841 domtext_transformNode,
842 domtext_selectNodes,
843 domtext_selectSingleNode,
844 domtext_get_parsed,
845 domtext_get_namespaceURI,
846 domtext_get_prefix,
847 domtext_get_baseName,
848 domtext_transformNodeToObject,
849 domtext_get_data,
850 domtext_put_data,
851 domtext_get_length,
852 domtext_substringData,
853 domtext_appendData,
854 domtext_insertData,
855 domtext_deleteData,
856 domtext_replaceData,
857 domtext_splitText
860 IUnknown* create_text( xmlNodePtr text )
862 domtext *This;
864 This = heap_alloc( sizeof *This );
865 if ( !This )
866 return NULL;
868 This->lpVtbl = &domtext_vtbl;
869 This->ref = 1;
871 init_xmlnode(&This->node, text, (IXMLDOMNode*)&This->lpVtbl, NULL);
873 return (IUnknown*) &This->lpVtbl;
876 #endif