2007-05-11 17:03:13 +02:00
|
|
|
/*
|
2010-09-30 22:06:01 +02:00
|
|
|
* XPath/XSLPattern query result node list implementation
|
2007-05-11 17:03:13 +02:00
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
* Copyright 2007 Mikolaj Zalewski
|
2010-09-30 22:06:01 +02:00
|
|
|
* Copyright 2010 Adam Martinson for CodeWeavers
|
2007-05-11 17:03:13 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2011-02-24 13:11:53 +01:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
# include <libxml/parser.h>
|
|
|
|
# include <libxml/xmlerror.h>
|
|
|
|
# include <libxml/xpath.h>
|
|
|
|
# include <libxml/xpathInternals.h>
|
|
|
|
#endif
|
|
|
|
|
2007-05-11 17:03:13 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2010-08-29 23:31:49 +02:00
|
|
|
#include "msxml6.h"
|
2011-11-04 16:59:05 +01:00
|
|
|
#include "msxml2did.h"
|
2007-05-11 17:03:13 +02:00
|
|
|
|
|
|
|
#include "msxml_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
/* This file implements the object returned by a XPath query. Note that this is
|
|
|
|
* not the IXMLDOMNodeList returned by childNodes - it's implemented in nodelist.c.
|
|
|
|
* They are different because the list returned by XPath queries:
|
|
|
|
* - is static - gives the results for the XML tree as it existed during the
|
|
|
|
* execution of the query
|
2011-03-13 00:54:47 +01:00
|
|
|
* - supports IXMLDOMSelection
|
2007-05-11 17:03:13 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
|
2010-09-28 21:35:48 +02:00
|
|
|
int registerNamespaces(xmlXPathContextPtr ctxt);
|
2010-10-29 03:14:58 +02:00
|
|
|
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str);
|
2010-09-28 21:35:48 +02:00
|
|
|
|
2011-10-23 20:54:20 +02:00
|
|
|
typedef struct _enumvariant
|
|
|
|
{
|
|
|
|
IEnumVARIANT IEnumVARIANT_iface;
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
IXMLDOMSelection *selection;
|
|
|
|
BOOL own;
|
2011-10-30 08:57:09 +01:00
|
|
|
|
|
|
|
LONG pos;
|
2011-10-23 20:54:20 +02:00
|
|
|
} enumvariant;
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
typedef struct _domselection
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2008-08-21 23:37:48 +02:00
|
|
|
DispatchEx dispex;
|
2011-03-13 00:54:47 +01:00
|
|
|
IXMLDOMSelection IXMLDOMSelection_iface;
|
2007-05-11 17:03:13 +02:00
|
|
|
LONG ref;
|
|
|
|
xmlNodePtr node;
|
|
|
|
xmlXPathObjectPtr result;
|
|
|
|
int resultPos;
|
2011-10-23 20:54:20 +02:00
|
|
|
IEnumVARIANT *enumvariant;
|
2011-03-13 00:54:47 +01:00
|
|
|
} domselection;
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static inline domselection *impl_from_IXMLDOMSelection( IXMLDOMSelection *iface )
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
return CONTAINING_RECORD(iface, domselection, IXMLDOMSelection_iface);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-10-23 20:54:20 +02:00
|
|
|
static inline enumvariant *impl_from_IEnumVARIANT( IEnumVARIANT *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, enumvariant, IEnumVARIANT_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT create_enumvariant(IXMLDOMSelection*, BOOL, IUnknown**);
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_QueryInterface(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-08-21 23:37:48 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2008-07-02 08:15:55 +02:00
|
|
|
if(!ppvObject)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 17:03:13 +02:00
|
|
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
2011-03-13 00:54:47 +01:00
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMNodeList ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMSelection ))
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
*ppvObject = &This->IXMLDOMSelection_iface;
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
2011-10-23 20:54:20 +02:00
|
|
|
else if (IsEqualGUID( riid, &IID_IEnumVARIANT ))
|
|
|
|
{
|
|
|
|
if (!This->enumvariant)
|
|
|
|
{
|
|
|
|
HRESULT hr = create_enumvariant(iface, FALSE, (IUnknown**)&This->enumvariant);
|
|
|
|
if (FAILED(hr)) return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IEnumVARIANT_QueryInterface(This->enumvariant, &IID_IEnumVARIANT, ppvObject);
|
|
|
|
}
|
|
|
|
else if (dispex_query_interface(&This->dispex, riid, ppvObject))
|
2008-08-21 23:37:48 +02:00
|
|
|
{
|
|
|
|
return *ppvObject ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
2007-05-11 17:03:13 +02:00
|
|
|
else
|
|
|
|
{
|
2011-03-13 14:40:26 +01:00
|
|
|
TRACE("interface %s not implemented\n", debugstr_guid(riid));
|
2007-05-11 17:03:13 +02:00
|
|
|
*ppvObject = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
IXMLDOMSelection_AddRef( iface );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static ULONG WINAPI domselection_AddRef(
|
|
|
|
IXMLDOMSelection *iface )
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
|
|
|
return ref;
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static ULONG WINAPI domselection_Release(
|
|
|
|
IXMLDOMSelection *iface )
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
2007-05-11 17:03:13 +02:00
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
|
|
|
xmlXPathFreeObject(This->result);
|
|
|
|
xmldoc_release(This->node->doc);
|
2011-10-23 20:54:20 +02:00
|
|
|
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
|
2011-10-29 23:27:50 +02:00
|
|
|
release_dispex(&This->dispex);
|
2008-08-21 23:37:48 +02:00
|
|
|
heap_free(This);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_GetTypeInfoCount(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_GetTypeInfo(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface,
|
|
|
|
iTInfo, lcid, ppTInfo);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_GetIDsOfNames(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId )
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface,
|
|
|
|
riid, rgszNames, cNames, lcid, rgDispId);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_Invoke(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr )
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-11-19 17:32:23 +01:00
|
|
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface,
|
|
|
|
dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_get_item(
|
|
|
|
IXMLDOMSelection* iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG index,
|
2007-05-11 17:03:13 +02:00
|
|
|
IXMLDOMNode** listItem)
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%d %p)\n", This, index, listItem);
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2008-07-02 08:15:55 +02:00
|
|
|
if(!listItem)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 17:03:13 +02:00
|
|
|
*listItem = NULL;
|
|
|
|
|
2008-07-02 02:22:36 +02:00
|
|
|
if (index < 0 || index >= xmlXPathNodeSetGetLength(This->result->nodesetval))
|
2007-05-11 17:03:13 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2010-06-12 23:45:52 +02:00
|
|
|
*listItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, index));
|
2007-05-11 17:04:43 +02:00
|
|
|
This->resultPos = index + 1;
|
2007-05-11 17:03:13 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_get_length(
|
|
|
|
IXMLDOMSelection* iface,
|
2009-03-09 23:28:16 +01:00
|
|
|
LONG* listLength)
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, listLength);
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2008-07-02 08:15:55 +02:00
|
|
|
if(!listLength)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2008-07-02 02:22:36 +02:00
|
|
|
*listLength = xmlXPathNodeSetGetLength(This->result->nodesetval);
|
2007-05-11 17:03:13 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_nextNode(
|
|
|
|
IXMLDOMSelection* iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
IXMLDOMNode** nextItem)
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2010-02-17 07:40:40 +01:00
|
|
|
TRACE("(%p)->(%p)\n", This, nextItem );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2008-07-02 08:15:55 +02:00
|
|
|
if(!nextItem)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 17:03:13 +02:00
|
|
|
*nextItem = NULL;
|
|
|
|
|
2008-07-02 02:22:36 +02:00
|
|
|
if (This->resultPos >= xmlXPathNodeSetGetLength(This->result->nodesetval))
|
2007-05-11 17:03:13 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2010-06-12 23:45:52 +02:00
|
|
|
*nextItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, This->resultPos));
|
2007-05-11 17:03:13 +02:00
|
|
|
This->resultPos++;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_reset(
|
|
|
|
IXMLDOMSelection* iface)
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", This);
|
|
|
|
This->resultPos = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_get__newEnum(
|
|
|
|
IXMLDOMSelection* iface,
|
2007-05-11 17:03:13 +02:00
|
|
|
IUnknown** ppUnk)
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-10-23 20:54:20 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppUnk);
|
|
|
|
|
|
|
|
return create_enumvariant(iface, TRUE, ppUnk);
|
2007-05-11 17:03:13 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_get_expr(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
BSTR *p)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_put_expr(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
BSTR p)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(p));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_get_context(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMNode **node)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_putref_context(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMNode *node)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_peekNode(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMNode **node)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_matches(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMNode *node,
|
|
|
|
IXMLDOMNode **out_node)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p %p)\n", This, node, out_node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_removeNext(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMNode **node)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_removeAll(
|
|
|
|
IXMLDOMSelection* iface)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2007-05-11 17:03:13 +02:00
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT WINAPI domselection_clone(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMSelection **node)
|
2007-05-11 17:03:13 +02:00
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%p)\n", This, node);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_getProperty(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
BSTR p,
|
|
|
|
VARIANT *var)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(p), var);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domselection_setProperty(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
BSTR p,
|
|
|
|
VARIANT var)
|
|
|
|
{
|
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
FIXME("(%p)->(%s %s)\n", This, debugstr_w(p), debugstr_variant(&var));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IXMLDOMSelectionVtbl domselection_vtbl =
|
|
|
|
{
|
|
|
|
domselection_QueryInterface,
|
|
|
|
domselection_AddRef,
|
|
|
|
domselection_Release,
|
|
|
|
domselection_GetTypeInfoCount,
|
|
|
|
domselection_GetTypeInfo,
|
|
|
|
domselection_GetIDsOfNames,
|
|
|
|
domselection_Invoke,
|
|
|
|
domselection_get_item,
|
|
|
|
domselection_get_length,
|
|
|
|
domselection_nextNode,
|
|
|
|
domselection_reset,
|
|
|
|
domselection_get__newEnum,
|
|
|
|
domselection_get_expr,
|
|
|
|
domselection_put_expr,
|
|
|
|
domselection_get_context,
|
|
|
|
domselection_putref_context,
|
|
|
|
domselection_peekNode,
|
|
|
|
domselection_matches,
|
|
|
|
domselection_removeNext,
|
|
|
|
domselection_removeAll,
|
|
|
|
domselection_clone,
|
|
|
|
domselection_getProperty,
|
|
|
|
domselection_setProperty
|
2007-05-11 17:03:13 +02:00
|
|
|
};
|
|
|
|
|
2011-10-23 20:54:20 +02:00
|
|
|
/* IEnumVARIANT support */
|
|
|
|
static HRESULT WINAPI enumvariant_QueryInterface(
|
|
|
|
IEnumVARIANT *iface,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
|
|
|
|
|
|
|
|
*ppvObject = NULL;
|
|
|
|
|
|
|
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IEnumVARIANT ))
|
|
|
|
{
|
|
|
|
*ppvObject = &This->IEnumVARIANT_iface;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return IXMLDOMSelection_QueryInterface(This->selection, riid, ppvObject);
|
|
|
|
|
|
|
|
IEnumVARIANT_AddRef( iface );
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface )
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI enumvariant_Release(IEnumVARIANT *iface )
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
|
|
|
if (This->own) IXMLDOMSelection_Release(This->selection);
|
|
|
|
heap_free(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI enumvariant_Next(
|
|
|
|
IEnumVARIANT *iface,
|
|
|
|
ULONG celt,
|
2011-10-30 08:57:09 +01:00
|
|
|
VARIANT *var,
|
|
|
|
ULONG *fetched)
|
2011-10-23 20:54:20 +02:00
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
2011-10-30 08:57:09 +01:00
|
|
|
IXMLDOMNode *node;
|
|
|
|
ULONG ret_count = 0;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%u %p %p)\n", This, celt, var, fetched);
|
|
|
|
|
|
|
|
if (fetched) *fetched = 0;
|
|
|
|
|
|
|
|
if (celt && !var) return E_INVALIDARG;
|
|
|
|
|
|
|
|
for (; celt > 0; celt--, var++, This->pos++)
|
|
|
|
{
|
|
|
|
IDispatch *disp = NULL;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
node = NULL;
|
|
|
|
hr = IXMLDOMSelection_get_item(This->selection, This->pos, &node);
|
|
|
|
if (hr != S_OK) break;
|
|
|
|
|
|
|
|
IXMLDOMNode_QueryInterface(node, &IID_IDispatch, (void**)&disp);
|
|
|
|
IXMLDOMNode_Release(node);
|
|
|
|
|
|
|
|
V_VT(var) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(var) = disp;
|
|
|
|
|
|
|
|
ret_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fetched) (*fetched)++;
|
|
|
|
|
|
|
|
/* we need to advance one step more for some reason */
|
|
|
|
if (ret_count)
|
|
|
|
IXMLDOMSelection_nextNode(This->selection, &node);
|
|
|
|
|
|
|
|
return celt == 0 ? S_OK : S_FALSE;
|
2011-10-23 20:54:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI enumvariant_Skip(
|
|
|
|
IEnumVARIANT *iface,
|
|
|
|
ULONG celt)
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
FIXME("(%p)->(%u): stub\n", This, celt);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI enumvariant_Reset(IEnumVARIANT *iface)
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
FIXME("(%p): stub\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI enumvariant_Clone(
|
|
|
|
IEnumVARIANT *iface, IEnumVARIANT **ppenum)
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
FIXME("(%p)->(%p): stub\n", This, ppenum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IEnumVARIANTVtbl EnumVARIANTVtbl =
|
|
|
|
{
|
|
|
|
enumvariant_QueryInterface,
|
|
|
|
enumvariant_AddRef,
|
|
|
|
enumvariant_Release,
|
|
|
|
enumvariant_Next,
|
|
|
|
enumvariant_Skip,
|
|
|
|
enumvariant_Reset,
|
|
|
|
enumvariant_Clone
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT create_enumvariant(IXMLDOMSelection *selection, BOOL own, IUnknown **penum)
|
|
|
|
{
|
|
|
|
enumvariant *This;
|
|
|
|
|
|
|
|
This = heap_alloc(sizeof(enumvariant));
|
|
|
|
if (!This) return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
This->IEnumVARIANT_iface.lpVtbl = &EnumVARIANTVtbl;
|
|
|
|
This->ref = 0;
|
|
|
|
This->selection = selection;
|
|
|
|
This->own = own;
|
2011-10-30 08:57:09 +01:00
|
|
|
This->pos = 0;
|
2011-10-23 20:54:20 +02:00
|
|
|
|
|
|
|
if (This->own)
|
|
|
|
IXMLDOMSelection_AddRef(selection);
|
|
|
|
|
|
|
|
return IEnumVARIANT_QueryInterface(&This->IEnumVARIANT_iface, &IID_IUnknown, (void**)penum);
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT domselection_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
|
2008-08-24 03:36:46 +02:00
|
|
|
{
|
|
|
|
WCHAR *ptr;
|
2008-10-22 22:43:50 +02:00
|
|
|
int idx = 0;
|
2008-08-24 03:36:46 +02:00
|
|
|
|
|
|
|
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
|
|
|
|
idx = idx*10 + (*ptr-'0');
|
|
|
|
if(*ptr)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
2011-11-04 16:59:05 +01:00
|
|
|
*dispid = DISPID_DOM_COLLECTION_BASE + idx;
|
2008-08-24 03:36:46 +02:00
|
|
|
TRACE("ret %x\n", *dispid);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
2008-08-24 03:36:46 +02:00
|
|
|
VARIANT *res, EXCEPINFO *ei)
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
|
2008-08-24 03:36:46 +02:00
|
|
|
|
2008-09-17 12:14:24 +02:00
|
|
|
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
|
2008-08-24 03:36:46 +02:00
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
2008-09-17 12:14:24 +02:00
|
|
|
V_DISPATCH(res) = NULL;
|
|
|
|
|
2011-11-04 16:59:05 +01:00
|
|
|
if (id < DISPID_DOM_COLLECTION_BASE || id > DISPID_DOM_COLLECTION_MAX)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
2008-09-17 12:14:24 +02:00
|
|
|
switch(flags)
|
|
|
|
{
|
|
|
|
case INVOKE_PROPERTYGET:
|
|
|
|
{
|
|
|
|
IXMLDOMNode *disp = NULL;
|
|
|
|
|
2011-11-19 18:55:30 +01:00
|
|
|
IXMLDOMSelection_get_item(&This->IXMLDOMSelection_iface, id - DISPID_DOM_COLLECTION_BASE, &disp);
|
2008-10-01 06:23:05 +02:00
|
|
|
V_DISPATCH(res) = (IDispatch*)disp;
|
2008-09-17 12:14:24 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
FIXME("unimplemented flags %x\n", flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-01 06:23:05 +02:00
|
|
|
TRACE("ret %p\n", V_DISPATCH(res));
|
|
|
|
|
2008-08-24 03:36:46 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static const dispex_static_data_vtbl_t domselection_dispex_vtbl = {
|
|
|
|
domselection_get_dispid,
|
|
|
|
domselection_invoke
|
2008-08-24 03:36:46 +02:00
|
|
|
};
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
static const tid_t domselection_iface_tids[] = {
|
|
|
|
IXMLDOMSelection_tid,
|
2008-08-21 23:37:48 +02:00
|
|
|
0
|
|
|
|
};
|
2011-03-13 00:54:47 +01:00
|
|
|
static dispex_static_data_t domselection_dispex = {
|
|
|
|
&domselection_dispex_vtbl,
|
2009-08-29 15:02:19 +02:00
|
|
|
IXMLDOMSelection_tid,
|
2008-08-21 23:37:48 +02:00
|
|
|
NULL,
|
2011-03-13 00:54:47 +01:00
|
|
|
domselection_iface_tids
|
2008-08-21 23:37:48 +02:00
|
|
|
};
|
|
|
|
|
2010-09-30 22:06:01 +02:00
|
|
|
#define XSLPATTERN_CHECK_ARGS(n) \
|
|
|
|
if (nargs != n) { \
|
2010-10-29 03:14:58 +02:00
|
|
|
FIXME("XSLPattern syntax error: Expected %i arguments, got %i\n", n, nargs); \
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathSetArityError(pctx); \
|
2010-09-30 22:06:01 +02:00
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_index(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
|
|
|
|
xmlXPathPositionFunction(pctx, 0);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnNumber(pctx, xmlXPathPopNumber(pctx) - 1.0);
|
2010-09-30 22:06:01 +02:00
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_end(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
double pos, last;
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
|
|
|
|
xmlXPathPositionFunction(pctx, 0);
|
|
|
|
pos = xmlXPathPopNumber(pctx);
|
|
|
|
xmlXPathLastFunction(pctx, 0);
|
|
|
|
last = xmlXPathPopNumber(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, pos == last);
|
2010-09-30 22:06:01 +02:00
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_nodeType(xmlXPathParserContextPtr pctx, int nargs)
|
2010-11-02 22:11:49 +01:00
|
|
|
{
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
xmlXPathReturnNumber(pctx, pctx->context->node->type);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_IEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) == 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_INEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) != 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_ILt(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) < 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_ILEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) <= 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_IGt(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) > 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-03 00:35:31 +02:00
|
|
|
static void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 22:06:01 +02:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 22:11:27 +01:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) >= 0);
|
2010-09-30 22:06:01 +02:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2010-10-27 16:35:56 +02:00
|
|
|
static void query_serror(void* ctx, xmlErrorPtr err)
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
LIBXML2_CALLBACK_SERROR(domselection_create, err);
|
2010-10-27 16:35:56 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
|
2008-08-21 23:36:40 +02:00
|
|
|
{
|
2011-03-13 01:00:54 +01:00
|
|
|
domselection *This = heap_alloc(sizeof(domselection));
|
2008-08-21 23:36:40 +02:00
|
|
|
xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
|
|
|
|
HRESULT hr;
|
|
|
|
|
2012-01-20 02:00:47 +01:00
|
|
|
TRACE("(%p, %s, %p)\n", node, debugstr_a((char const*)query), out);
|
2008-08-21 23:36:40 +02:00
|
|
|
|
|
|
|
*out = NULL;
|
2011-03-13 00:54:47 +01:00
|
|
|
if (!This || !ctxt || !query)
|
2008-08-21 23:36:40 +02:00
|
|
|
{
|
2011-10-29 23:27:50 +02:00
|
|
|
xmlXPathFreeContext(ctxt);
|
|
|
|
heap_free(This);
|
|
|
|
return E_OUTOFMEMORY;
|
2008-08-21 23:36:40 +02:00
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
This->IXMLDOMSelection_iface.lpVtbl = &domselection_vtbl;
|
2008-08-21 23:36:40 +02:00
|
|
|
This->ref = 1;
|
|
|
|
This->resultPos = 0;
|
|
|
|
This->node = node;
|
2011-10-23 20:54:20 +02:00
|
|
|
This->enumvariant = NULL;
|
2011-10-29 23:27:50 +02:00
|
|
|
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSelection_iface, &domselection_dispex);
|
2008-08-21 23:36:40 +02:00
|
|
|
xmldoc_add_ref(This->node->doc);
|
|
|
|
|
2010-10-27 16:35:56 +02:00
|
|
|
ctxt->error = query_serror;
|
2008-08-21 23:36:40 +02:00
|
|
|
ctxt->node = node;
|
2010-09-28 21:35:48 +02:00
|
|
|
registerNamespaces(ctxt);
|
|
|
|
|
2010-09-30 22:06:01 +02:00
|
|
|
if (is_xpathmode(This->node->doc))
|
|
|
|
{
|
|
|
|
xmlXPathRegisterAllFunctions(ctxt);
|
2011-03-13 00:54:47 +01:00
|
|
|
This->result = xmlXPathEvalExpression(query, ctxt);
|
2010-09-30 22:06:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-13 00:54:47 +01:00
|
|
|
xmlChar* pattern_query = XSLPattern_to_XPath(ctxt, query);
|
2010-09-30 22:06:01 +02:00
|
|
|
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"not", xmlXPathNotFunction);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"boolean", xmlXPathBooleanFunction);
|
|
|
|
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"index", XSLPattern_index);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"end", XSLPattern_end);
|
2010-11-02 22:11:49 +01:00
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"nodeType", XSLPattern_nodeType);
|
2010-09-30 22:06:01 +02:00
|
|
|
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IEq", XSLPattern_OP_IEq);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_INEq", XSLPattern_OP_INEq);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_ILt", XSLPattern_OP_ILt);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_ILEq", XSLPattern_OP_ILEq);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGt", XSLPattern_OP_IGt);
|
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGEq", XSLPattern_OP_IGEq);
|
2010-11-23 03:59:20 +01:00
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
This->result = xmlXPathEvalExpression(pattern_query, ctxt);
|
|
|
|
xmlFree(pattern_query);
|
2010-09-30 22:06:01 +02:00
|
|
|
}
|
|
|
|
|
2008-08-21 23:36:40 +02:00
|
|
|
if (!This->result || This->result->type != XPATH_NODESET)
|
|
|
|
{
|
|
|
|
hr = E_FAIL;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2011-03-13 00:54:47 +01:00
|
|
|
*out = (IXMLDOMNodeList*)&This->IXMLDOMSelection_iface;
|
2008-08-21 23:36:40 +02:00
|
|
|
hr = S_OK;
|
|
|
|
TRACE("found %d matches\n", xmlXPathNodeSetGetLength(This->result->nodesetval));
|
|
|
|
|
|
|
|
cleanup:
|
2011-03-13 00:54:47 +01:00
|
|
|
if (This && FAILED(hr))
|
|
|
|
IXMLDOMSelection_Release( &This->IXMLDOMSelection_iface );
|
2010-06-12 23:45:52 +02:00
|
|
|
xmlXPathFreeContext(ctxt);
|
2008-08-21 23:36:40 +02:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2007-05-11 17:03:13 +02:00
|
|
|
#endif
|