Release 1.1.37.
[wine/gsoc-2012-control.git] / dlls / msxml3 / element.c
blobe6f2f763dfb280c7a6f36c0e486ab2e43f3970e0
1 /*
2 * DOM Document implementation
4 * Copyright 2005 Mike McCormack
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 "winnls.h"
30 #include "ole2.h"
31 #include "msxml2.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 #ifdef HAVE_LIBXML2
41 typedef struct _domelem
43 xmlnode node;
44 const struct IXMLDOMElementVtbl *lpVtbl;
45 LONG ref;
46 } domelem;
48 static inline domelem *impl_from_IXMLDOMElement( IXMLDOMElement *iface )
50 return (domelem *)((char*)iface - FIELD_OFFSET(domelem, lpVtbl));
53 static inline xmlNodePtr get_element( domelem *This )
55 return This->node.node;
58 static HRESULT WINAPI domelem_QueryInterface(
59 IXMLDOMElement *iface,
60 REFIID riid,
61 void** ppvObject )
63 domelem *This = impl_from_IXMLDOMElement( iface );
65 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
67 if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
68 IsEqualGUID( riid, &IID_IDispatch ) ||
69 IsEqualGUID( riid, &IID_IUnknown ) )
71 *ppvObject = &This->lpVtbl;
73 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
75 *ppvObject = IXMLDOMNode_from_impl(&This->node);
77 else if(dispex_query_interface(&This->node.dispex, riid, ppvObject))
79 return *ppvObject ? S_OK : E_NOINTERFACE;
81 else
83 FIXME("interface %s not implemented\n", debugstr_guid(riid));
84 return E_NOINTERFACE;
87 IUnknown_AddRef( (IUnknown*)*ppvObject );
88 return S_OK;
91 static ULONG WINAPI domelem_AddRef(
92 IXMLDOMElement *iface )
94 domelem *This = impl_from_IXMLDOMElement( iface );
95 LONG ref = InterlockedIncrement(&This->ref);
97 TRACE("(%p) ref=%d\n", This, ref);
99 return ref;
102 static ULONG WINAPI domelem_Release(
103 IXMLDOMElement *iface )
105 domelem *This = impl_from_IXMLDOMElement( iface );
106 ULONG ref = InterlockedDecrement(&This->ref);
108 TRACE("(%p) ref=%d\n", This, ref);
110 if(!ref) {
111 destroy_xmlnode(&This->node);
112 heap_free(This);
115 return ref;
118 static HRESULT WINAPI domelem_GetTypeInfoCount(
119 IXMLDOMElement *iface,
120 UINT* pctinfo )
122 domelem *This = impl_from_IXMLDOMElement( iface );
124 TRACE("(%p)->(%p)\n", This, pctinfo);
126 *pctinfo = 1;
128 return S_OK;
131 static HRESULT WINAPI domelem_GetTypeInfo(
132 IXMLDOMElement *iface,
133 UINT iTInfo, LCID lcid,
134 ITypeInfo** ppTInfo )
136 domelem *This = impl_from_IXMLDOMElement( iface );
137 HRESULT hr;
139 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
141 hr = get_typeinfo(IXMLDOMElement_tid, ppTInfo);
143 return hr;
146 static HRESULT WINAPI domelem_GetIDsOfNames(
147 IXMLDOMElement *iface,
148 REFIID riid, LPOLESTR* rgszNames,
149 UINT cNames, LCID lcid, DISPID* rgDispId )
151 domelem *This = impl_from_IXMLDOMElement( iface );
152 ITypeInfo *typeinfo;
153 HRESULT hr;
155 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
156 lcid, rgDispId);
158 if(!rgszNames || cNames == 0 || !rgDispId)
159 return E_INVALIDARG;
161 hr = get_typeinfo(IXMLDOMElement_tid, &typeinfo);
162 if(SUCCEEDED(hr))
164 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
165 ITypeInfo_Release(typeinfo);
168 return hr;
171 static HRESULT WINAPI domelem_Invoke(
172 IXMLDOMElement *iface,
173 DISPID dispIdMember, REFIID riid, LCID lcid,
174 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
175 EXCEPINFO* pExcepInfo, UINT* puArgErr )
177 domelem *This = impl_from_IXMLDOMElement( iface );
178 ITypeInfo *typeinfo;
179 HRESULT hr;
181 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
182 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
184 hr = get_typeinfo(IXMLDOMElement_tid, &typeinfo);
185 if(SUCCEEDED(hr))
187 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
188 pVarResult, pExcepInfo, puArgErr);
189 ITypeInfo_Release(typeinfo);
192 return hr;
195 static HRESULT WINAPI domelem_get_nodeName(
196 IXMLDOMElement *iface,
197 BSTR* p )
199 domelem *This = impl_from_IXMLDOMElement( iface );
200 return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
203 static HRESULT WINAPI domelem_get_nodeValue(
204 IXMLDOMElement *iface,
205 VARIANT* var1 )
207 domelem *This = impl_from_IXMLDOMElement( iface );
208 return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
211 static HRESULT WINAPI domelem_put_nodeValue(
212 IXMLDOMElement *iface,
213 VARIANT var1 )
215 domelem *This = impl_from_IXMLDOMElement( iface );
216 return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
219 static HRESULT WINAPI domelem_get_nodeType(
220 IXMLDOMElement *iface,
221 DOMNodeType* domNodeType )
223 domelem *This = impl_from_IXMLDOMElement( iface );
224 return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(&This->node), domNodeType );
227 static HRESULT WINAPI domelem_get_parentNode(
228 IXMLDOMElement *iface,
229 IXMLDOMNode** parent )
231 domelem *This = impl_from_IXMLDOMElement( iface );
232 return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(&This->node), parent );
235 static HRESULT WINAPI domelem_get_childNodes(
236 IXMLDOMElement *iface,
237 IXMLDOMNodeList** outList)
239 domelem *This = impl_from_IXMLDOMElement( iface );
240 return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(&This->node), outList );
243 static HRESULT WINAPI domelem_get_firstChild(
244 IXMLDOMElement *iface,
245 IXMLDOMNode** domNode)
247 domelem *This = impl_from_IXMLDOMElement( iface );
248 return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
251 static HRESULT WINAPI domelem_get_lastChild(
252 IXMLDOMElement *iface,
253 IXMLDOMNode** domNode)
255 domelem *This = impl_from_IXMLDOMElement( iface );
256 return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
259 static HRESULT WINAPI domelem_get_previousSibling(
260 IXMLDOMElement *iface,
261 IXMLDOMNode** domNode)
263 domelem *This = impl_from_IXMLDOMElement( iface );
264 return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(&This->node), domNode );
267 static HRESULT WINAPI domelem_get_nextSibling(
268 IXMLDOMElement *iface,
269 IXMLDOMNode** domNode)
271 domelem *This = impl_from_IXMLDOMElement( iface );
272 return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(&This->node), domNode );
275 static HRESULT WINAPI domelem_get_attributes(
276 IXMLDOMElement *iface,
277 IXMLDOMNamedNodeMap** attributeMap)
279 domelem *This = impl_from_IXMLDOMElement( iface );
280 return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
283 static HRESULT WINAPI domelem_insertBefore(
284 IXMLDOMElement *iface,
285 IXMLDOMNode* newNode, VARIANT var1,
286 IXMLDOMNode** outOldNode)
288 domelem *This = impl_from_IXMLDOMElement( iface );
289 return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
292 static HRESULT WINAPI domelem_replaceChild(
293 IXMLDOMElement *iface,
294 IXMLDOMNode* newNode,
295 IXMLDOMNode* oldNode,
296 IXMLDOMNode** outOldNode)
298 domelem *This = impl_from_IXMLDOMElement( iface );
299 return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
302 static HRESULT WINAPI domelem_removeChild(
303 IXMLDOMElement *iface,
304 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
306 domelem *This = impl_from_IXMLDOMElement( iface );
307 return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(&This->node), domNode, oldNode );
310 static HRESULT WINAPI domelem_appendChild(
311 IXMLDOMElement *iface,
312 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
314 domelem *This = impl_from_IXMLDOMElement( iface );
315 return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(&This->node), newNode, outNewNode );
318 static HRESULT WINAPI domelem_hasChildNodes(
319 IXMLDOMElement *iface,
320 VARIANT_BOOL* pbool)
322 domelem *This = impl_from_IXMLDOMElement( iface );
323 return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(&This->node), pbool );
326 static HRESULT WINAPI domelem_get_ownerDocument(
327 IXMLDOMElement *iface,
328 IXMLDOMDocument** domDocument)
330 domelem *This = impl_from_IXMLDOMElement( iface );
331 return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(&This->node), domDocument );
334 static HRESULT WINAPI domelem_cloneNode(
335 IXMLDOMElement *iface,
336 VARIANT_BOOL pbool, IXMLDOMNode** outNode)
338 domelem *This = impl_from_IXMLDOMElement( iface );
339 return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(&This->node), pbool, outNode );
342 static HRESULT WINAPI domelem_get_nodeTypeString(
343 IXMLDOMElement *iface,
344 BSTR* p)
346 domelem *This = impl_from_IXMLDOMElement( iface );
347 return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
350 static HRESULT WINAPI domelem_get_text(
351 IXMLDOMElement *iface,
352 BSTR* p)
354 domelem *This = impl_from_IXMLDOMElement( iface );
355 return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(&This->node), p );
358 static HRESULT WINAPI domelem_put_text(
359 IXMLDOMElement *iface,
360 BSTR p)
362 domelem *This = impl_from_IXMLDOMElement( iface );
363 return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(&This->node), p );
366 static HRESULT WINAPI domelem_get_specified(
367 IXMLDOMElement *iface,
368 VARIANT_BOOL* pbool)
370 domelem *This = impl_from_IXMLDOMElement( iface );
371 return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(&This->node), pbool );
374 static HRESULT WINAPI domelem_get_definition(
375 IXMLDOMElement *iface,
376 IXMLDOMNode** domNode)
378 domelem *This = impl_from_IXMLDOMElement( iface );
379 return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(&This->node), domNode );
382 static HRESULT WINAPI domelem_get_nodeTypedValue(
383 IXMLDOMElement *iface,
384 VARIANT* var1)
386 domelem *This = impl_from_IXMLDOMElement( iface );
387 return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
390 static HRESULT WINAPI domelem_put_nodeTypedValue(
391 IXMLDOMElement *iface,
392 VARIANT var1)
394 domelem *This = impl_from_IXMLDOMElement( iface );
395 return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
398 static HRESULT WINAPI domelem_get_dataType(
399 IXMLDOMElement *iface,
400 VARIANT* var1)
402 domelem *This = impl_from_IXMLDOMElement( iface );
403 return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(&This->node), var1 );
406 static HRESULT WINAPI domelem_put_dataType(
407 IXMLDOMElement *iface,
408 BSTR p)
410 domelem *This = impl_from_IXMLDOMElement( iface );
411 return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(&This->node), p );
414 static HRESULT WINAPI domelem_get_xml(
415 IXMLDOMElement *iface,
416 BSTR* p)
418 domelem *This = impl_from_IXMLDOMElement( iface );
419 return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), p );
422 static HRESULT WINAPI domelem_transformNode(
423 IXMLDOMElement *iface,
424 IXMLDOMNode* domNode, BSTR* p)
426 domelem *This = impl_from_IXMLDOMElement( iface );
427 return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(&This->node), domNode, p );
430 static HRESULT WINAPI domelem_selectNodes(
431 IXMLDOMElement *iface,
432 BSTR p, IXMLDOMNodeList** outList)
434 domelem *This = impl_from_IXMLDOMElement( iface );
435 return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(&This->node), p, outList );
438 static HRESULT WINAPI domelem_selectSingleNode(
439 IXMLDOMElement *iface,
440 BSTR p, IXMLDOMNode** outNode)
442 domelem *This = impl_from_IXMLDOMElement( iface );
443 return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(&This->node), p, outNode );
446 static HRESULT WINAPI domelem_get_parsed(
447 IXMLDOMElement *iface,
448 VARIANT_BOOL* pbool)
450 domelem *This = impl_from_IXMLDOMElement( iface );
451 return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(&This->node), pbool );
454 static HRESULT WINAPI domelem_get_namespaceURI(
455 IXMLDOMElement *iface,
456 BSTR* p)
458 domelem *This = impl_from_IXMLDOMElement( iface );
459 return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(&This->node), p );
462 static HRESULT WINAPI domelem_get_prefix(
463 IXMLDOMElement *iface,
464 BSTR* p)
466 domelem *This = impl_from_IXMLDOMElement( iface );
467 return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p );
470 static HRESULT WINAPI domelem_get_baseName(
471 IXMLDOMElement *iface,
472 BSTR* p)
474 domelem *This = impl_from_IXMLDOMElement( iface );
475 return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(&This->node), p );
478 static HRESULT WINAPI domelem_transformNodeToObject(
479 IXMLDOMElement *iface,
480 IXMLDOMNode* domNode, VARIANT var1)
482 domelem *This = impl_from_IXMLDOMElement( iface );
483 return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(&This->node), domNode, var1 );
486 static HRESULT WINAPI domelem_get_tagName(
487 IXMLDOMElement *iface,
488 BSTR* p)
490 domelem *This = impl_from_IXMLDOMElement( iface );
491 xmlNodePtr element;
492 DWORD len;
493 DWORD offset = 0;
494 LPWSTR str;
496 TRACE("%p\n", This );
498 element = get_element( This );
499 if ( !element )
500 return E_FAIL;
502 len = MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->name, -1, NULL, 0 );
503 if (element->ns)
504 len += MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->ns->prefix, -1, NULL, 0 );
505 str = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
506 if ( !str )
507 return E_OUTOFMEMORY;
508 if (element->ns)
510 offset = MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->ns->prefix, -1, str, len );
511 str[offset - 1] = ':';
513 MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->name, -1, str + offset, len - offset );
514 *p = SysAllocString( str );
515 HeapFree( GetProcessHeap(), 0, str );
517 return S_OK;
520 static HRESULT WINAPI domelem_getAttribute(
521 IXMLDOMElement *iface,
522 BSTR name, VARIANT* value)
524 domelem *This = impl_from_IXMLDOMElement( iface );
525 xmlNodePtr element;
526 xmlChar *xml_name, *xml_value = NULL;
527 HRESULT hr = S_FALSE;
529 TRACE("(%p)->(%s,%p)\n", This, debugstr_w(name), value);
531 if(!value || !name)
532 return E_INVALIDARG;
534 element = get_element( This );
535 if ( !element )
536 return E_FAIL;
538 V_BSTR(value) = NULL;
539 V_VT(value) = VT_NULL;
541 xml_name = xmlChar_from_wchar( name );
543 if(!xmlValidateNameValue(xml_name))
544 hr = E_FAIL;
545 else
546 xml_value = xmlGetNsProp(element, xml_name, NULL);
548 HeapFree(GetProcessHeap(), 0, xml_name);
549 if(xml_value)
551 V_VT(value) = VT_BSTR;
552 V_BSTR(value) = bstr_from_xmlChar( xml_value );
553 xmlFree(xml_value);
554 hr = S_OK;
557 return hr;
560 static HRESULT WINAPI domelem_setAttribute(
561 IXMLDOMElement *iface,
562 BSTR name, VARIANT value)
564 domelem *This = impl_from_IXMLDOMElement( iface );
565 xmlNodePtr element;
566 xmlChar *xml_name, *xml_value;
567 HRESULT hr;
568 VARIANT var;
570 TRACE("(%p)->(%s, var)\n", This, debugstr_w(name));
572 element = get_element( This );
573 if ( !element )
574 return E_FAIL;
576 VariantInit(&var);
577 hr = VariantChangeType(&var, &value, 0, VT_BSTR);
578 if(hr != S_OK)
580 FIXME("VariantChangeType failed\n");
581 return hr;
584 xml_name = xmlChar_from_wchar( name );
585 xml_value = xmlChar_from_wchar( V_BSTR(&var) );
587 if(!xmlSetNsProp(element, NULL, xml_name, xml_value))
588 hr = E_FAIL;
590 HeapFree(GetProcessHeap(), 0, xml_value);
591 HeapFree(GetProcessHeap(), 0, xml_name);
592 VariantClear(&var);
594 return hr;
597 static HRESULT WINAPI domelem_removeAttribute(
598 IXMLDOMElement *iface,
599 BSTR p)
601 domelem *This = impl_from_IXMLDOMElement( iface );
602 IXMLDOMNamedNodeMap *attr;
603 HRESULT hr;
605 TRACE("(%p)->(%s)", This, debugstr_w(p));
607 hr = IXMLDOMElement_get_attributes(iface, &attr);
608 if (hr != S_OK) return hr;
610 hr = IXMLDOMNamedNodeMap_removeNamedItem(attr, p, NULL);
611 IXMLDOMNamedNodeMap_Release(attr);
613 return hr;
616 static HRESULT WINAPI domelem_getAttributeNode(
617 IXMLDOMElement *iface,
618 BSTR p, IXMLDOMAttribute** attributeNode )
620 domelem *This = impl_from_IXMLDOMElement( iface );
621 xmlChar *xml_name;
622 xmlNodePtr element;
623 xmlAttrPtr attr;
624 IUnknown *unk;
625 HRESULT hr = S_FALSE;
627 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), attributeNode);
629 if(!attributeNode)
630 return E_FAIL;
632 *attributeNode = NULL;
634 element = get_element( This );
635 if ( !element )
636 return E_FAIL;
638 xml_name = xmlChar_from_wchar(p);
640 if(!xmlValidateNameValue(xml_name))
642 HeapFree(GetProcessHeap(), 0, xml_name);
643 return E_FAIL;
646 attr = xmlHasProp(element, xml_name);
647 if(attr) {
648 unk = create_attribute((xmlNodePtr)attr);
649 hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode);
650 IUnknown_Release(unk);
653 HeapFree(GetProcessHeap(), 0, xml_name);
655 return hr;
658 static HRESULT WINAPI domelem_setAttributeNode(
659 IXMLDOMElement *iface,
660 IXMLDOMAttribute* domAttribute,
661 IXMLDOMAttribute** attributeNode)
663 FIXME("\n");
664 return E_NOTIMPL;
667 static HRESULT WINAPI domelem_removeAttributeNode(
668 IXMLDOMElement *iface,
669 IXMLDOMAttribute* domAttribute,
670 IXMLDOMAttribute** attributeNode)
672 FIXME("\n");
673 return E_NOTIMPL;
676 static HRESULT WINAPI domelem_getElementsByTagName(
677 IXMLDOMElement *iface,
678 BSTR bstrName, IXMLDOMNodeList** resultList)
680 static const WCHAR xpathformat[] =
681 { '.','/','/','*','[','l','o','c','a','l','-','n','a','m','e','(',')','=','\'','%','s','\'',']',0 };
682 domelem *This = impl_from_IXMLDOMElement( iface );
683 LPWSTR szPattern;
684 xmlNodePtr element;
685 HRESULT hr;
687 TRACE("(%p)->(%s,%p)\n", This, debugstr_w(bstrName), resultList);
689 if (bstrName[0] == '*' && bstrName[1] == 0)
691 szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*5);
692 szPattern[0] = '.';
693 szPattern[1] = szPattern[2] = '/';
694 szPattern[3] = '*';
695 szPattern[4] = 0;
697 else
699 szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(21+lstrlenW(bstrName)+1));
700 wsprintfW(szPattern, xpathformat, bstrName);
702 TRACE("%s\n", debugstr_w(szPattern));
704 element = get_element(This);
705 if (!element)
706 hr = E_FAIL;
707 else
708 hr = queryresult_create(element, szPattern, resultList);
709 HeapFree(GetProcessHeap(), 0, szPattern);
711 return hr;
714 static HRESULT WINAPI domelem_normalize(
715 IXMLDOMElement *iface )
717 FIXME("\n");
718 return E_NOTIMPL;
721 static const struct IXMLDOMElementVtbl domelem_vtbl =
723 domelem_QueryInterface,
724 domelem_AddRef,
725 domelem_Release,
726 domelem_GetTypeInfoCount,
727 domelem_GetTypeInfo,
728 domelem_GetIDsOfNames,
729 domelem_Invoke,
730 domelem_get_nodeName,
731 domelem_get_nodeValue,
732 domelem_put_nodeValue,
733 domelem_get_nodeType,
734 domelem_get_parentNode,
735 domelem_get_childNodes,
736 domelem_get_firstChild,
737 domelem_get_lastChild,
738 domelem_get_previousSibling,
739 domelem_get_nextSibling,
740 domelem_get_attributes,
741 domelem_insertBefore,
742 domelem_replaceChild,
743 domelem_removeChild,
744 domelem_appendChild,
745 domelem_hasChildNodes,
746 domelem_get_ownerDocument,
747 domelem_cloneNode,
748 domelem_get_nodeTypeString,
749 domelem_get_text,
750 domelem_put_text,
751 domelem_get_specified,
752 domelem_get_definition,
753 domelem_get_nodeTypedValue,
754 domelem_put_nodeTypedValue,
755 domelem_get_dataType,
756 domelem_put_dataType,
757 domelem_get_xml,
758 domelem_transformNode,
759 domelem_selectNodes,
760 domelem_selectSingleNode,
761 domelem_get_parsed,
762 domelem_get_namespaceURI,
763 domelem_get_prefix,
764 domelem_get_baseName,
765 domelem_transformNodeToObject,
766 domelem_get_tagName,
767 domelem_getAttribute,
768 domelem_setAttribute,
769 domelem_removeAttribute,
770 domelem_getAttributeNode,
771 domelem_setAttributeNode,
772 domelem_removeAttributeNode,
773 domelem_getElementsByTagName,
774 domelem_normalize,
777 static const tid_t domelem_iface_tids[] = {
778 IXMLDOMElement_tid,
782 static dispex_static_data_t domelem_dispex = {
783 NULL,
784 IXMLDOMElement_tid,
785 NULL,
786 domelem_iface_tids
789 IUnknown* create_element( xmlNodePtr element )
791 domelem *This;
793 This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
794 if ( !This )
795 return NULL;
797 This->lpVtbl = &domelem_vtbl;
798 This->ref = 1;
800 init_xmlnode(&This->node, element, (IUnknown*)&This->lpVtbl, &domelem_dispex);
802 return (IUnknown*) &This->lpVtbl;
805 #endif