2005-08-03 12:58:47 +02:00
|
|
|
/*
|
|
|
|
* DOM Document implementation
|
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2005-08-03 12:58:47 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2005-08-03 12:58:47 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-08-03 12:58:47 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2006-06-12 02:34:28 +02:00
|
|
|
#include "winnls.h"
|
2005-08-03 12:58:47 +02:00
|
|
|
#include "ole2.h"
|
2010-08-29 23:31:49 +02:00
|
|
|
#include "msxml6.h"
|
2005-08-03 12:58:47 +02:00
|
|
|
|
|
|
|
#include "msxml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
2005-08-08 14:13:31 +02:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
|
2005-08-03 12:58:47 +02:00
|
|
|
typedef struct _domelem
|
|
|
|
{
|
2009-10-14 20:01:42 +02:00
|
|
|
xmlnode node;
|
2005-08-03 12:58:47 +02:00
|
|
|
const struct IXMLDOMElementVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
} domelem;
|
|
|
|
|
|
|
|
static inline domelem *impl_from_IXMLDOMElement( IXMLDOMElement *iface )
|
|
|
|
{
|
|
|
|
return (domelem *)((char*)iface - FIELD_OFFSET(domelem, lpVtbl));
|
|
|
|
}
|
|
|
|
|
2010-10-21 00:07:20 +02:00
|
|
|
static inline xmlNodePtr get_element( const domelem *This )
|
2005-08-18 12:48:13 +02:00
|
|
|
{
|
2009-10-14 20:01:42 +02:00
|
|
|
return This->node.node;
|
2005-08-18 12:48:13 +02:00
|
|
|
}
|
|
|
|
|
2005-08-03 12:58:47 +02:00
|
|
|
static HRESULT WINAPI domelem_QueryInterface(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
2005-12-01 18:46:42 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-08-22 19:51:45 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2009-08-22 19:51:45 +02:00
|
|
|
if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
|
2010-09-04 17:56:08 +02:00
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
|
2009-08-22 19:51:45 +02:00
|
|
|
IsEqualGUID( riid, &IID_IDispatch ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IUnknown ) )
|
|
|
|
{
|
|
|
|
*ppvObject = &This->lpVtbl;
|
|
|
|
}
|
2010-09-04 17:54:46 +02:00
|
|
|
else if(node_query_interface(&This->node, riid, ppvObject))
|
2009-08-31 07:18:00 +02:00
|
|
|
{
|
|
|
|
return *ppvObject ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
2009-08-22 19:51:45 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef( (IUnknown*)*ppvObject );
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI domelem_AddRef(
|
|
|
|
IXMLDOMElement *iface )
|
|
|
|
{
|
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-08-22 19:51:45 +02:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI domelem_Release(
|
|
|
|
IXMLDOMElement *iface )
|
|
|
|
{
|
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-08-22 19:51:45 +02:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref) {
|
2009-10-14 20:01:42 +02:00
|
|
|
destroy_xmlnode(&This->node);
|
2009-08-22 19:51:45 +02:00
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_GetTypeInfoCount(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2008-02-19 02:13:22 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_GetTypeInfo(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
UINT iTInfo, LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2008-02-19 02:13:22 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMElement_tid, ppTInfo);
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_GetIDsOfNames(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
REFIID riid, LPOLESTR* rgszNames,
|
|
|
|
UINT cNames, LCID lcid, DISPID* rgDispId )
|
|
|
|
{
|
2008-02-19 02:13:22 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
|
|
|
|
lcid, rgDispId);
|
|
|
|
|
|
|
|
if(!rgszNames || cNames == 0 || !rgDispId)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMElement_tid, &typeinfo);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_Invoke(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
DISPID dispIdMember, REFIID riid, LCID lcid,
|
|
|
|
WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo, UINT* puArgErr )
|
|
|
|
{
|
2008-02-19 02:13:22 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
hr = get_typeinfo(IXMLDOMElement_tid, &typeinfo);
|
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
|
|
|
pVarResult, pExcepInfo, puArgErr);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nodeName(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p )
|
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-04 17:56:25 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return node_get_nodeName(&This->node, p);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nodeValue(
|
|
|
|
IXMLDOMElement *iface,
|
2010-09-04 17:56:45 +02:00
|
|
|
VARIANT* value)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-04 17:56:45 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, value);
|
|
|
|
|
|
|
|
if(!value)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
V_VT(value) = VT_NULL;
|
|
|
|
V_BSTR(value) = NULL; /* tests show that we should do this */
|
|
|
|
return S_FALSE;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_put_nodeValue(
|
|
|
|
IXMLDOMElement *iface,
|
2010-09-07 15:27:31 +02:00
|
|
|
VARIANT value)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-07 15:27:31 +02:00
|
|
|
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
|
|
|
|
return E_FAIL;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nodeType(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
DOMNodeType* domNodeType )
|
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-07 15:28:21 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, domNodeType);
|
|
|
|
|
|
|
|
*domNodeType = NODE_ELEMENT;
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_parentNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode** parent )
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-07 15:28:21 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, parent);
|
|
|
|
|
|
|
|
return node_get_parent(&This->node, parent);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_childNodes(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNodeList** outList)
|
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-08 15:12:02 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, outList);
|
|
|
|
|
|
|
|
return node_get_child_nodes(&This->node, outList);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_firstChild(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode** domNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-08 15:12:14 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, domNode);
|
|
|
|
|
|
|
|
return node_get_first_child(&This->node, domNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_lastChild(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode** domNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-08 15:12:14 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, domNode);
|
|
|
|
|
2010-09-08 21:55:37 +02:00
|
|
|
return node_get_last_child(&This->node, domNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_previousSibling(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode** domNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-10 16:53:48 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, domNode);
|
|
|
|
|
|
|
|
return node_get_previous_sibling(&This->node, domNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nextSibling(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode** domNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-10 16:53:48 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, domNode);
|
|
|
|
|
|
|
|
return node_get_next_sibling(&This->node, domNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_attributes(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNamedNodeMap** attributeMap)
|
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-10 16:54:06 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, attributeMap);
|
|
|
|
|
|
|
|
*attributeMap = create_nodemap((IXMLDOMNode*)&This->lpVtbl);
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_insertBefore(
|
|
|
|
IXMLDOMElement *iface,
|
2010-09-10 16:55:14 +02:00
|
|
|
IXMLDOMNode* newNode, VARIANT refChild,
|
2005-08-03 12:58:47 +02:00
|
|
|
IXMLDOMNode** outOldNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-09-10 16:55:14 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p x%d %p)\n", This, newNode, V_VT(&refChild), outOldNode);
|
|
|
|
|
|
|
|
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_replaceChild(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode* newNode,
|
|
|
|
IXMLDOMNode* oldNode,
|
|
|
|
IXMLDOMNode** outOldNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-13 15:11:32 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p %p %p)\n", This, newNode, oldNode, outOldNode);
|
|
|
|
|
|
|
|
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_removeChild(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(&This->node), domNode, oldNode );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_appendChild(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(&This->node), newNode, outNewNode );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_hasChildNodes(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
VARIANT_BOOL* pbool)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(&This->node), pbool );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_ownerDocument(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMDocument** domDocument)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(&This->node), domDocument );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_cloneNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(&This->node), pbool, outNode );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nodeTypeString(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_text(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_put_text(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-19 01:27:48 +02:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(p));
|
|
|
|
return node_put_text( &This->node, p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_specified(
|
|
|
|
IXMLDOMElement *iface,
|
2010-10-24 22:55:04 +02:00
|
|
|
VARIANT_BOOL* isSpecified)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-24 22:55:04 +02:00
|
|
|
FIXME("(%p)->(%p) stub!\n", This, isSpecified);
|
|
|
|
*isSpecified = VARIANT_TRUE;
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_definition(
|
|
|
|
IXMLDOMElement *iface,
|
2010-10-24 22:55:04 +02:00
|
|
|
IXMLDOMNode** definitionNode)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-24 22:55:04 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, definitionNode);
|
|
|
|
return E_NOTIMPL;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_nodeTypedValue(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
VARIANT* var1)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_put_nodeTypedValue(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
VARIANT var1)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(&This->node), var1 );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_dataType(
|
|
|
|
IXMLDOMElement *iface,
|
2010-10-19 01:13:30 +02:00
|
|
|
VARIANT* typename)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-19 01:13:30 +02:00
|
|
|
xmlChar *pVal = xmlGetNsProp(get_element(This), (const xmlChar*)"dt",
|
|
|
|
(const xmlChar*)"urn:schemas-microsoft-com:datatypes");
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, typename);
|
|
|
|
|
|
|
|
V_VT(typename) = VT_NULL;
|
|
|
|
|
|
|
|
if (pVal)
|
|
|
|
{
|
|
|
|
V_VT(typename) = VT_BSTR;
|
|
|
|
V_BSTR(typename) = bstr_from_xmlChar( pVal );
|
|
|
|
xmlFree(pVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (V_VT(typename) != VT_NULL) ? S_OK : S_FALSE;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_put_dataType(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_xml(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_transformNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode* domNode, BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(&This->node), domNode, p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_selectNodes(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p, IXMLDOMNodeList** outList)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(&This->node), p, outList );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_selectSingleNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p, IXMLDOMNode** outNode)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(&This->node), p, outNode );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_parsed(
|
|
|
|
IXMLDOMElement *iface,
|
2010-10-24 22:55:04 +02:00
|
|
|
VARIANT_BOOL* isParsed)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-24 22:55:04 +02:00
|
|
|
FIXME("(%p)->(%p) stub!\n", This, isParsed);
|
|
|
|
*isParsed = VARIANT_TRUE;
|
|
|
|
return S_OK;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_namespaceURI(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_prefix(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_baseName(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-18 12:48:13 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(&This->node), p );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_transformNodeToObject(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMNode* domNode, VARIANT var1)
|
|
|
|
{
|
2005-08-22 11:23:52 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-10-14 20:01:42 +02:00
|
|
|
return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(&This->node), domNode, var1 );
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_get_tagName(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR* p)
|
|
|
|
{
|
2005-08-11 12:57:58 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
xmlNodePtr element;
|
2010-02-19 16:06:17 +01:00
|
|
|
const xmlChar *prefix;
|
|
|
|
xmlChar *qname;
|
2005-08-11 12:57:58 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, p );
|
2005-08-11 12:57:58 +02:00
|
|
|
|
2010-02-19 16:06:17 +01:00
|
|
|
if (!p) return E_INVALIDARG;
|
|
|
|
|
2005-08-18 12:48:13 +02:00
|
|
|
element = get_element( This );
|
2005-08-11 12:57:58 +02:00
|
|
|
if ( !element )
|
|
|
|
return E_FAIL;
|
|
|
|
|
2010-02-19 16:06:17 +01:00
|
|
|
prefix = element->ns ? element->ns->prefix : NULL;
|
|
|
|
qname = xmlBuildQName(element->name, prefix, NULL, 0);
|
2005-08-11 12:57:58 +02:00
|
|
|
|
2010-02-19 16:06:17 +01:00
|
|
|
*p = bstr_from_xmlChar(qname);
|
|
|
|
if (qname != element->name) xmlFree(qname);
|
|
|
|
|
|
|
|
return *p ? S_OK : E_OUTOFMEMORY;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_getAttribute(
|
|
|
|
IXMLDOMElement *iface,
|
2006-01-14 17:05:32 +01:00
|
|
|
BSTR name, VARIANT* value)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2006-01-14 17:05:32 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
xmlNodePtr element;
|
2008-02-01 10:45:02 +01:00
|
|
|
xmlChar *xml_name, *xml_value = NULL;
|
2008-01-14 11:13:01 +01:00
|
|
|
HRESULT hr = S_FALSE;
|
2006-01-14 17:05:32 +01:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
|
2006-01-14 17:05:32 +01:00
|
|
|
|
2008-01-14 11:13:01 +01:00
|
|
|
if(!value || !name)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2006-01-14 17:05:32 +01:00
|
|
|
element = get_element( This );
|
|
|
|
if ( !element )
|
|
|
|
return E_FAIL;
|
|
|
|
|
2008-01-14 11:13:01 +01:00
|
|
|
V_BSTR(value) = NULL;
|
|
|
|
V_VT(value) = VT_NULL;
|
|
|
|
|
2006-01-14 17:05:32 +01:00
|
|
|
xml_name = xmlChar_from_wchar( name );
|
2008-02-01 10:45:02 +01:00
|
|
|
|
|
|
|
if(!xmlValidateNameValue(xml_name))
|
|
|
|
hr = E_FAIL;
|
|
|
|
else
|
|
|
|
xml_value = xmlGetNsProp(element, xml_name, NULL);
|
|
|
|
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free(xml_name);
|
2006-01-14 17:05:32 +01:00
|
|
|
if(xml_value)
|
|
|
|
{
|
|
|
|
V_VT(value) = VT_BSTR;
|
|
|
|
V_BSTR(value) = bstr_from_xmlChar( xml_value );
|
|
|
|
xmlFree(xml_value);
|
|
|
|
hr = S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_setAttribute(
|
|
|
|
IXMLDOMElement *iface,
|
2006-01-16 20:42:39 +01:00
|
|
|
BSTR name, VARIANT value)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2006-01-16 20:42:39 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
xmlNodePtr element;
|
|
|
|
xmlChar *xml_name, *xml_value;
|
|
|
|
HRESULT hr;
|
|
|
|
VARIANT var;
|
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s var)\n", This, debugstr_w(name));
|
2006-01-16 20:42:39 +01:00
|
|
|
|
|
|
|
element = get_element( This );
|
|
|
|
if ( !element )
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
VariantInit(&var);
|
|
|
|
hr = VariantChangeType(&var, &value, 0, VT_BSTR);
|
|
|
|
if(hr != S_OK)
|
|
|
|
{
|
|
|
|
FIXME("VariantChangeType failed\n");
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
xml_name = xmlChar_from_wchar( name );
|
|
|
|
xml_value = xmlChar_from_wchar( V_BSTR(&var) );
|
|
|
|
|
|
|
|
if(!xmlSetNsProp(element, NULL, xml_name, xml_value))
|
|
|
|
hr = E_FAIL;
|
|
|
|
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free(xml_value);
|
|
|
|
heap_free(xml_name);
|
2006-01-16 20:42:39 +01:00
|
|
|
VariantClear(&var);
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_removeAttribute(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p)
|
|
|
|
{
|
2010-01-18 21:29:21 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
IXMLDOMNamedNodeMap *attr;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2010-03-20 15:24:04 +01:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(p));
|
2010-01-18 21:29:21 +01:00
|
|
|
|
|
|
|
hr = IXMLDOMElement_get_attributes(iface, &attr);
|
|
|
|
if (hr != S_OK) return hr;
|
|
|
|
|
|
|
|
hr = IXMLDOMNamedNodeMap_removeNamedItem(attr, p, NULL);
|
|
|
|
IXMLDOMNamedNodeMap_Release(attr);
|
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_getAttributeNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
BSTR p, IXMLDOMAttribute** attributeNode )
|
|
|
|
{
|
2008-07-01 19:47:08 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
xmlChar *xml_name;
|
|
|
|
xmlNodePtr element;
|
|
|
|
xmlAttrPtr attr;
|
|
|
|
IUnknown *unk;
|
2008-12-13 10:12:02 +01:00
|
|
|
HRESULT hr = S_FALSE;
|
2008-07-01 19:47:08 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), attributeNode);
|
|
|
|
|
2008-12-13 10:12:02 +01:00
|
|
|
if(!attributeNode)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
*attributeNode = NULL;
|
|
|
|
|
2008-07-01 19:47:08 +02:00
|
|
|
element = get_element( This );
|
|
|
|
if ( !element )
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
xml_name = xmlChar_from_wchar(p);
|
|
|
|
|
2008-12-13 10:12:02 +01:00
|
|
|
if(!xmlValidateNameValue(xml_name))
|
|
|
|
{
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free(xml_name);
|
2008-12-13 10:12:02 +01:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2008-07-01 19:47:08 +02:00
|
|
|
attr = xmlHasProp(element, xml_name);
|
|
|
|
if(attr) {
|
|
|
|
unk = create_attribute((xmlNodePtr)attr);
|
|
|
|
hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode);
|
|
|
|
IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
2010-02-03 20:47:53 +01:00
|
|
|
heap_free(xml_name);
|
2008-07-01 19:47:08 +02:00
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_setAttributeNode(
|
|
|
|
IXMLDOMElement *iface,
|
2010-10-21 00:07:20 +02:00
|
|
|
IXMLDOMAttribute* attribute,
|
|
|
|
IXMLDOMAttribute** old)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2010-10-21 00:07:20 +02:00
|
|
|
xmlChar *name, *value;
|
|
|
|
BSTR nameW, prefix;
|
|
|
|
xmlAttrPtr attr;
|
|
|
|
VARIANT valueW;
|
|
|
|
HRESULT hr;
|
2010-09-06 21:26:39 +02:00
|
|
|
|
2010-10-21 00:07:20 +02:00
|
|
|
FIXME("(%p)->(%p %p): semi-stub\n", This, attribute, old);
|
2010-09-06 21:26:39 +02:00
|
|
|
|
2010-10-21 00:07:20 +02:00
|
|
|
if (!attribute) return E_INVALIDARG;
|
2010-09-06 21:26:39 +02:00
|
|
|
|
2010-10-21 00:07:20 +02:00
|
|
|
if (old) *old = NULL;
|
|
|
|
|
|
|
|
hr = IXMLDOMAttribute_get_nodeName(attribute, &nameW);
|
|
|
|
if (hr != S_OK) return hr;
|
|
|
|
|
|
|
|
hr = IXMLDOMAttribute_get_nodeValue(attribute, &valueW);
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
|
|
|
SysFreeString(nameW);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("attribute: %s=%s\n", debugstr_w(nameW), debugstr_w(V_BSTR(&valueW)));
|
|
|
|
|
|
|
|
hr = IXMLDOMAttribute_get_prefix(attribute, &prefix);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
FIXME("namespaces not supported: %s\n", debugstr_w(prefix));
|
|
|
|
SysFreeString(prefix);
|
|
|
|
}
|
|
|
|
|
|
|
|
name = xmlChar_from_wchar(nameW);
|
|
|
|
value = xmlChar_from_wchar(V_BSTR(&valueW));
|
|
|
|
|
|
|
|
if (!name || !value)
|
|
|
|
{
|
|
|
|
SysFreeString(nameW);
|
|
|
|
VariantClear(&valueW);
|
|
|
|
heap_free(name);
|
|
|
|
heap_free(value);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
attr = xmlSetNsProp(get_element(This), NULL, name, value);
|
|
|
|
|
|
|
|
SysFreeString(nameW);
|
|
|
|
VariantClear(&valueW);
|
|
|
|
heap_free(name);
|
|
|
|
heap_free(value);
|
|
|
|
|
|
|
|
return attr ? S_OK : E_FAIL;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_removeAttributeNode(
|
|
|
|
IXMLDOMElement *iface,
|
|
|
|
IXMLDOMAttribute* domAttribute,
|
|
|
|
IXMLDOMAttribute** attributeNode)
|
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, domAttribute, attributeNode);
|
2005-08-03 12:58:47 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_getElementsByTagName(
|
|
|
|
IXMLDOMElement *iface,
|
2010-09-02 20:49:56 +02:00
|
|
|
BSTR tagName, IXMLDOMNodeList** resultList)
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2007-05-12 10:09:10 +02:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
2009-01-28 23:25:16 +01:00
|
|
|
xmlNodePtr element;
|
2007-05-12 10:09:10 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2010-09-02 20:49:56 +02:00
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(tagName), resultList);
|
2007-05-12 10:09:10 +02:00
|
|
|
|
2010-09-02 20:49:56 +02:00
|
|
|
if (!tagName || !resultList) return E_INVALIDARG;
|
|
|
|
if (!(element = get_element(This))) return E_FAIL;
|
|
|
|
|
|
|
|
if (tagName[0] == '*' && tagName[1] == 0)
|
2010-01-16 22:17:36 +01:00
|
|
|
{
|
2010-09-02 20:49:56 +02:00
|
|
|
static const WCHAR formatallW[] = {'/','/','*',0};
|
|
|
|
hr = queryresult_create(element, formatallW, resultList);
|
2010-01-16 22:17:36 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-02 20:49:56 +02:00
|
|
|
static const WCHAR xpathformat[] =
|
|
|
|
{ '/','/','*','[','l','o','c','a','l','-','n','a','m','e','(',')','=','\'' };
|
|
|
|
static const WCHAR closeW[] = { '\'',']',0 };
|
2007-05-12 10:09:10 +02:00
|
|
|
|
2010-09-02 20:49:56 +02:00
|
|
|
LPWSTR pattern;
|
|
|
|
WCHAR *ptr;
|
|
|
|
INT length;
|
|
|
|
|
|
|
|
length = lstrlenW(tagName);
|
|
|
|
|
|
|
|
/* without two WCHARs from format specifier */
|
|
|
|
ptr = pattern = heap_alloc(sizeof(xpathformat) + length*sizeof(WCHAR) + sizeof(closeW));
|
|
|
|
|
|
|
|
memcpy(ptr, xpathformat, sizeof(xpathformat));
|
|
|
|
ptr += sizeof(xpathformat)/sizeof(WCHAR);
|
|
|
|
memcpy(ptr, tagName, length*sizeof(WCHAR));
|
|
|
|
ptr += length;
|
|
|
|
memcpy(ptr, closeW, sizeof(closeW));
|
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w(pattern));
|
|
|
|
hr = queryresult_create(element, pattern, resultList);
|
|
|
|
heap_free(pattern);
|
|
|
|
}
|
2007-05-12 10:09:10 +02:00
|
|
|
|
|
|
|
return hr;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domelem_normalize(
|
|
|
|
IXMLDOMElement *iface )
|
|
|
|
{
|
2010-02-17 07:40:40 +01:00
|
|
|
domelem *This = impl_from_IXMLDOMElement( iface );
|
|
|
|
FIXME("%p\n", This);
|
2005-08-03 12:58:47 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-08-08 17:04:00 +02:00
|
|
|
static const struct IXMLDOMElementVtbl domelem_vtbl =
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
|
|
|
domelem_QueryInterface,
|
|
|
|
domelem_AddRef,
|
|
|
|
domelem_Release,
|
|
|
|
domelem_GetTypeInfoCount,
|
|
|
|
domelem_GetTypeInfo,
|
|
|
|
domelem_GetIDsOfNames,
|
|
|
|
domelem_Invoke,
|
|
|
|
domelem_get_nodeName,
|
|
|
|
domelem_get_nodeValue,
|
|
|
|
domelem_put_nodeValue,
|
|
|
|
domelem_get_nodeType,
|
|
|
|
domelem_get_parentNode,
|
|
|
|
domelem_get_childNodes,
|
|
|
|
domelem_get_firstChild,
|
|
|
|
domelem_get_lastChild,
|
|
|
|
domelem_get_previousSibling,
|
|
|
|
domelem_get_nextSibling,
|
|
|
|
domelem_get_attributes,
|
|
|
|
domelem_insertBefore,
|
|
|
|
domelem_replaceChild,
|
|
|
|
domelem_removeChild,
|
|
|
|
domelem_appendChild,
|
|
|
|
domelem_hasChildNodes,
|
|
|
|
domelem_get_ownerDocument,
|
|
|
|
domelem_cloneNode,
|
|
|
|
domelem_get_nodeTypeString,
|
|
|
|
domelem_get_text,
|
|
|
|
domelem_put_text,
|
|
|
|
domelem_get_specified,
|
|
|
|
domelem_get_definition,
|
|
|
|
domelem_get_nodeTypedValue,
|
|
|
|
domelem_put_nodeTypedValue,
|
|
|
|
domelem_get_dataType,
|
|
|
|
domelem_put_dataType,
|
|
|
|
domelem_get_xml,
|
|
|
|
domelem_transformNode,
|
|
|
|
domelem_selectNodes,
|
|
|
|
domelem_selectSingleNode,
|
|
|
|
domelem_get_parsed,
|
|
|
|
domelem_get_namespaceURI,
|
|
|
|
domelem_get_prefix,
|
|
|
|
domelem_get_baseName,
|
|
|
|
domelem_transformNodeToObject,
|
|
|
|
domelem_get_tagName,
|
|
|
|
domelem_getAttribute,
|
|
|
|
domelem_setAttribute,
|
|
|
|
domelem_removeAttribute,
|
|
|
|
domelem_getAttributeNode,
|
|
|
|
domelem_setAttributeNode,
|
|
|
|
domelem_removeAttributeNode,
|
|
|
|
domelem_getElementsByTagName,
|
|
|
|
domelem_normalize,
|
|
|
|
};
|
|
|
|
|
2009-08-31 07:18:00 +02:00
|
|
|
static const tid_t domelem_iface_tids[] = {
|
|
|
|
IXMLDOMElement_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t domelem_dispex = {
|
|
|
|
NULL,
|
|
|
|
IXMLDOMElement_tid,
|
|
|
|
NULL,
|
|
|
|
domelem_iface_tids
|
|
|
|
};
|
|
|
|
|
2009-08-22 19:51:45 +02:00
|
|
|
IUnknown* create_element( xmlNodePtr element )
|
2005-08-03 12:58:47 +02:00
|
|
|
{
|
2005-08-10 11:54:22 +02:00
|
|
|
domelem *This;
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2010-02-03 20:47:53 +01:00
|
|
|
This = heap_alloc( sizeof *This );
|
2005-08-10 11:54:22 +02:00
|
|
|
if ( !This )
|
|
|
|
return NULL;
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
This->lpVtbl = &domelem_vtbl;
|
|
|
|
This->ref = 1;
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2010-09-04 17:54:13 +02:00
|
|
|
init_xmlnode(&This->node, element, (IXMLDOMNode*)&This->lpVtbl, &domelem_dispex);
|
2005-12-01 18:46:42 +01:00
|
|
|
|
2009-08-22 19:51:45 +02:00
|
|
|
return (IUnknown*) &This->lpVtbl;
|
2005-08-03 12:58:47 +02:00
|
|
|
}
|
2005-08-08 14:13:31 +02:00
|
|
|
|
|
|
|
#endif
|