2007-05-11 15:03:13 +00:00
|
|
|
/*
|
2010-09-30 20:06:01 +00:00
|
|
|
* XPath/XSLPattern query result node list implementation
|
2007-05-11 15:03:13 +00:00
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
* Copyright 2007 Mikolaj Zalewski
|
2010-09-30 20:06:01 +00:00
|
|
|
* Copyright 2010 Adam Martinson for CodeWeavers
|
2007-05-11 15:03:13 +00: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 12:11:53 +00:00
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
# include <libxml/parser.h>
|
|
|
|
# include <libxml/xmlerror.h>
|
|
|
|
# include <libxml/xpath.h>
|
|
|
|
# include <libxml/xpathInternals.h>
|
|
|
|
#endif
|
|
|
|
|
2007-05-11 15:03:13 +00:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
2010-08-29 21:31:49 +00:00
|
|
|
#include "msxml6.h"
|
2007-05-11 15:03:13 +00: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-12 23:54:47 +00:00
|
|
|
* - supports IXMLDOMSelection
|
2007-05-11 15:03:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
|
2010-09-28 19:35:48 +00:00
|
|
|
int registerNamespaces(xmlXPathContextPtr ctxt);
|
2010-10-29 01:14:58 +00:00
|
|
|
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str);
|
2010-09-28 19:35:48 +00:00
|
|
|
|
2011-10-23 18:54:20 +00:00
|
|
|
typedef struct _enumvariant
|
|
|
|
{
|
|
|
|
IEnumVARIANT IEnumVARIANT_iface;
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
IXMLDOMSelection *selection;
|
|
|
|
BOOL own;
|
|
|
|
} enumvariant;
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
typedef struct _domselection
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2008-08-21 21:37:48 +00:00
|
|
|
DispatchEx dispex;
|
2011-03-12 23:54:47 +00:00
|
|
|
IXMLDOMSelection IXMLDOMSelection_iface;
|
2007-05-11 15:03:13 +00:00
|
|
|
LONG ref;
|
|
|
|
xmlNodePtr node;
|
|
|
|
xmlXPathObjectPtr result;
|
|
|
|
int resultPos;
|
2011-10-23 18:54:20 +00:00
|
|
|
IEnumVARIANT *enumvariant;
|
2011-03-12 23:54:47 +00:00
|
|
|
} domselection;
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static inline domselection *impl_from_IXMLDOMSelection( IXMLDOMSelection *iface )
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
return CONTAINING_RECORD(iface, domselection, IXMLDOMSelection_iface);
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-10-23 18:54:20 +00: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-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_QueryInterface(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject )
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-08-21 21:37:48 +00:00
|
|
|
|
2010-02-17 06:40:40 +00:00
|
|
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2008-07-02 06:15:55 +00:00
|
|
|
if(!ppvObject)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 15:03:13 +00:00
|
|
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
2011-03-12 23:54:47 +00:00
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMNodeList ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IXMLDOMSelection ))
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
*ppvObject = &This->IXMLDOMSelection_iface;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
2011-10-23 18:54:20 +00: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 21:37:48 +00:00
|
|
|
{
|
|
|
|
return *ppvObject ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
2007-05-11 15:03:13 +00:00
|
|
|
else
|
|
|
|
{
|
2011-03-13 13:40:26 +00:00
|
|
|
TRACE("interface %s not implemented\n", debugstr_guid(riid));
|
2007-05-11 15:03:13 +00:00
|
|
|
*ppvObject = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
IXMLDOMSelection_AddRef( iface );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static ULONG WINAPI domselection_AddRef(
|
|
|
|
IXMLDOMSelection *iface )
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
ULONG ref = InterlockedIncrement( &This->ref );
|
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
|
|
|
return ref;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static ULONG WINAPI domselection_Release(
|
|
|
|
IXMLDOMSelection *iface )
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
TRACE("(%p)->(%d)\n", This, ref);
|
2007-05-11 15:03:13 +00:00
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
|
|
|
xmlXPathFreeObject(This->result);
|
|
|
|
xmldoc_release(This->node->doc);
|
2011-10-23 18:54:20 +00:00
|
|
|
if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant);
|
2011-10-29 21:27:50 +00:00
|
|
|
release_dispex(&This->dispex);
|
2008-08-21 21:37:48 +00:00
|
|
|
heap_free(This);
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_GetTypeInfoCount(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
UINT* pctinfo )
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-02-19 01:32:36 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
|
|
|
|
|
|
|
*pctinfo = 1;
|
|
|
|
|
|
|
|
return S_OK;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_GetTypeInfo(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo** ppTInfo )
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-02-19 01:32:36 +00:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
hr = get_typeinfo(IXMLDOMSelection_tid, ppTInfo);
|
2008-02-19 01:32:36 +00:00
|
|
|
|
|
|
|
return hr;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_GetIDsOfNames(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId )
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-02-19 01:32:36 +00:00
|
|
|
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;
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
hr = get_typeinfo(IXMLDOMSelection_tid, &typeinfo);
|
2008-02-19 01:32:36 +00:00
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_Invoke(
|
|
|
|
IXMLDOMSelection *iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr )
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2008-02-19 01:32:36 +00:00
|
|
|
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);
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
hr = get_typeinfo(IXMLDOMSelection_tid, &typeinfo);
|
2008-02-19 01:32:36 +00:00
|
|
|
if(SUCCEEDED(hr))
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMSelection_iface, dispIdMember, wFlags, pDispParams,
|
2008-02-19 01:32:36 +00:00
|
|
|
pVarResult, pExcepInfo, puArgErr);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_get_item(
|
|
|
|
IXMLDOMSelection* iface,
|
2009-03-09 22:28:16 +00:00
|
|
|
LONG index,
|
2007-05-11 15:03:13 +00:00
|
|
|
IXMLDOMNode** listItem)
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2010-02-17 06:40:40 +00:00
|
|
|
TRACE("(%p)->(%d %p)\n", This, index, listItem);
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2008-07-02 06:15:55 +00:00
|
|
|
if(!listItem)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 15:03:13 +00:00
|
|
|
*listItem = NULL;
|
|
|
|
|
2008-07-02 00:22:36 +00:00
|
|
|
if (index < 0 || index >= xmlXPathNodeSetGetLength(This->result->nodesetval))
|
2007-05-11 15:03:13 +00:00
|
|
|
return S_FALSE;
|
|
|
|
|
2010-06-12 21:45:52 +00:00
|
|
|
*listItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, index));
|
2007-05-11 15:04:43 +00:00
|
|
|
This->resultPos = index + 1;
|
2007-05-11 15:03:13 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_get_length(
|
|
|
|
IXMLDOMSelection* iface,
|
2009-03-09 22:28:16 +00:00
|
|
|
LONG* listLength)
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2010-02-17 06:40:40 +00:00
|
|
|
TRACE("(%p)->(%p)\n", This, listLength);
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2008-07-02 06:15:55 +00:00
|
|
|
if(!listLength)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2008-07-02 00:22:36 +00:00
|
|
|
*listLength = xmlXPathNodeSetGetLength(This->result->nodesetval);
|
2007-05-11 15:03:13 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_nextNode(
|
|
|
|
IXMLDOMSelection* iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
IXMLDOMNode** nextItem)
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2010-02-17 06:40:40 +00:00
|
|
|
TRACE("(%p)->(%p)\n", This, nextItem );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
2008-07-02 06:15:55 +00:00
|
|
|
if(!nextItem)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2007-05-11 15:03:13 +00:00
|
|
|
*nextItem = NULL;
|
|
|
|
|
2008-07-02 00:22:36 +00:00
|
|
|
if (This->resultPos >= xmlXPathNodeSetGetLength(This->result->nodesetval))
|
2007-05-11 15:03:13 +00:00
|
|
|
return S_FALSE;
|
|
|
|
|
2010-06-12 21:45:52 +00:00
|
|
|
*nextItem = create_node(xmlXPathNodeSetItem(This->result->nodesetval, This->resultPos));
|
2007-05-11 15:03:13 +00:00
|
|
|
This->resultPos++;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_reset(
|
|
|
|
IXMLDOMSelection* iface)
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2007-05-11 15:03:13 +00:00
|
|
|
|
|
|
|
TRACE("%p\n", This);
|
|
|
|
This->resultPos = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_get__newEnum(
|
|
|
|
IXMLDOMSelection* iface,
|
2007-05-11 15:03:13 +00:00
|
|
|
IUnknown** ppUnk)
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
2011-10-23 18:54:20 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppUnk);
|
|
|
|
|
|
|
|
return create_enumvariant(iface, TRUE, ppUnk);
|
2007-05-11 15:03:13 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00: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 15:03:13 +00:00
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT WINAPI domselection_clone(
|
|
|
|
IXMLDOMSelection* iface,
|
|
|
|
IXMLDOMSelection **node)
|
2007-05-11 15:03:13 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00: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 15:03:13 +00:00
|
|
|
};
|
|
|
|
|
2011-10-23 18:54:20 +00: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,
|
|
|
|
VARIANT *rgvar,
|
|
|
|
ULONG *pceltFetched)
|
|
|
|
{
|
|
|
|
enumvariant *This = impl_from_IEnumVARIANT( iface );
|
|
|
|
FIXME("(%p)->(%u %p %p): stub\n", This, celt, rgvar, pceltFetched);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (This->own)
|
|
|
|
IXMLDOMSelection_AddRef(selection);
|
|
|
|
|
|
|
|
return IEnumVARIANT_QueryInterface(&This->IEnumVARIANT_iface, &IID_IUnknown, (void**)penum);
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT domselection_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
|
2008-08-24 01:36:46 +00:00
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
|
2008-08-24 01:36:46 +00:00
|
|
|
WCHAR *ptr;
|
2008-10-22 20:43:50 +00:00
|
|
|
int idx = 0;
|
2008-08-24 01:36:46 +00:00
|
|
|
|
|
|
|
for(ptr = name; *ptr && isdigitW(*ptr); ptr++)
|
|
|
|
idx = idx*10 + (*ptr-'0');
|
|
|
|
if(*ptr)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
if(idx >= xmlXPathNodeSetGetLength(This->result->nodesetval))
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
*dispid = MSXML_DISPID_CUSTOM_MIN + idx;
|
|
|
|
TRACE("ret %x\n", *dispid);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
2008-08-24 01:36:46 +00:00
|
|
|
VARIANT *res, EXCEPINFO *ei)
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
|
2008-08-24 01:36:46 +00:00
|
|
|
|
2008-09-17 10:14:24 +00:00
|
|
|
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
|
2008-08-24 01:36:46 +00:00
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
2008-09-17 10:14:24 +00:00
|
|
|
V_DISPATCH(res) = NULL;
|
|
|
|
|
|
|
|
switch(flags)
|
|
|
|
{
|
|
|
|
case INVOKE_PROPERTYGET:
|
|
|
|
{
|
|
|
|
IXMLDOMNode *disp = NULL;
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection_get_item(&This->IXMLDOMSelection_iface, id - MSXML_DISPID_CUSTOM_MIN, &disp);
|
2008-10-01 04:23:05 +00:00
|
|
|
V_DISPATCH(res) = (IDispatch*)disp;
|
2008-09-17 10:14:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
FIXME("unimplemented flags %x\n", flags);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-01 04:23:05 +00:00
|
|
|
TRACE("ret %p\n", V_DISPATCH(res));
|
|
|
|
|
2008-08-24 01:36:46 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static const dispex_static_data_vtbl_t domselection_dispex_vtbl = {
|
|
|
|
domselection_get_dispid,
|
|
|
|
domselection_invoke
|
2008-08-24 01:36:46 +00:00
|
|
|
};
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
static const tid_t domselection_iface_tids[] = {
|
|
|
|
IXMLDOMSelection_tid,
|
2008-08-21 21:37:48 +00:00
|
|
|
0
|
|
|
|
};
|
2011-03-12 23:54:47 +00:00
|
|
|
static dispex_static_data_t domselection_dispex = {
|
|
|
|
&domselection_dispex_vtbl,
|
2009-08-29 13:02:19 +00:00
|
|
|
IXMLDOMSelection_tid,
|
2008-08-21 21:37:48 +00:00
|
|
|
NULL,
|
2011-03-12 23:54:47 +00:00
|
|
|
domselection_iface_tids
|
2008-08-21 21:37:48 +00:00
|
|
|
};
|
|
|
|
|
2010-09-30 20:06:01 +00:00
|
|
|
#define XSLPATTERN_CHECK_ARGS(n) \
|
|
|
|
if (nargs != n) { \
|
2010-10-29 01:14:58 +00:00
|
|
|
FIXME("XSLPattern syntax error: Expected %i arguments, got %i\n", n, nargs); \
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathSetArityError(pctx); \
|
2010-09-30 20:06:01 +00:00
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_index(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
|
|
|
|
xmlXPathPositionFunction(pctx, 0);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnNumber(pctx, xmlXPathPopNumber(pctx) - 1.0);
|
2010-09-30 20:06:01 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_end(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
double pos, last;
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
|
|
|
|
xmlXPathPositionFunction(pctx, 0);
|
|
|
|
pos = xmlXPathPopNumber(pctx);
|
|
|
|
xmlXPathLastFunction(pctx, 0);
|
|
|
|
last = xmlXPathPopNumber(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, pos == last);
|
2010-09-30 20:06:01 +00:00
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_nodeType(xmlXPathParserContextPtr pctx, int nargs)
|
2010-11-02 21:11:49 +00:00
|
|
|
{
|
|
|
|
XSLPATTERN_CHECK_ARGS(0);
|
|
|
|
xmlXPathReturnNumber(pctx, pctx->context->node->type);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_IEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) == 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_INEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) != 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_ILt(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) < 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_ILEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) <= 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_IGt(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) > 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2011-05-02 22:35:31 +00:00
|
|
|
static void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx, int nargs)
|
2010-09-30 20:06:01 +00:00
|
|
|
{
|
|
|
|
xmlChar *arg1, *arg2;
|
|
|
|
XSLPATTERN_CHECK_ARGS(2);
|
|
|
|
|
|
|
|
arg2 = xmlXPathPopString(pctx);
|
|
|
|
arg1 = xmlXPathPopString(pctx);
|
2010-11-02 21:11:27 +00:00
|
|
|
xmlXPathReturnBoolean(pctx, xmlStrcasecmp(arg1, arg2) >= 0);
|
2010-09-30 20:06:01 +00:00
|
|
|
xmlFree(arg1);
|
|
|
|
xmlFree(arg2);
|
|
|
|
}
|
|
|
|
|
2010-10-27 14:35:56 +00:00
|
|
|
static void query_serror(void* ctx, xmlErrorPtr err)
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
LIBXML2_CALLBACK_SERROR(domselection_create, err);
|
2010-10-27 14:35:56 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
|
2008-08-21 21:36:40 +00:00
|
|
|
{
|
2011-03-13 00:00:54 +00:00
|
|
|
domselection *This = heap_alloc(sizeof(domselection));
|
2008-08-21 21:36:40 +00:00
|
|
|
xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
|
|
|
|
HRESULT hr;
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
TRACE("(%p, %s, %p)\n", node, wine_dbgstr_a((char const*)query), out);
|
2008-08-21 21:36:40 +00:00
|
|
|
|
|
|
|
*out = NULL;
|
2011-03-12 23:54:47 +00:00
|
|
|
if (!This || !ctxt || !query)
|
2008-08-21 21:36:40 +00:00
|
|
|
{
|
2011-10-29 21:27:50 +00:00
|
|
|
xmlXPathFreeContext(ctxt);
|
|
|
|
heap_free(This);
|
|
|
|
return E_OUTOFMEMORY;
|
2008-08-21 21:36:40 +00:00
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
This->IXMLDOMSelection_iface.lpVtbl = &domselection_vtbl;
|
2008-08-21 21:36:40 +00:00
|
|
|
This->ref = 1;
|
|
|
|
This->resultPos = 0;
|
|
|
|
This->node = node;
|
2011-10-23 18:54:20 +00:00
|
|
|
This->enumvariant = NULL;
|
2011-10-29 21:27:50 +00:00
|
|
|
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSelection_iface, &domselection_dispex);
|
2008-08-21 21:36:40 +00:00
|
|
|
xmldoc_add_ref(This->node->doc);
|
|
|
|
|
2010-10-27 14:35:56 +00:00
|
|
|
ctxt->error = query_serror;
|
2008-08-21 21:36:40 +00:00
|
|
|
ctxt->node = node;
|
2010-09-28 19:35:48 +00:00
|
|
|
registerNamespaces(ctxt);
|
|
|
|
|
2010-09-30 20:06:01 +00:00
|
|
|
if (is_xpathmode(This->node->doc))
|
|
|
|
{
|
|
|
|
xmlXPathRegisterAllFunctions(ctxt);
|
2011-03-12 23:54:47 +00:00
|
|
|
This->result = xmlXPathEvalExpression(query, ctxt);
|
2010-09-30 20:06:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-03-12 23:54:47 +00:00
|
|
|
xmlChar* pattern_query = XSLPattern_to_XPath(ctxt, query);
|
2010-09-30 20:06:01 +00: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 21:11:49 +00:00
|
|
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"nodeType", XSLPattern_nodeType);
|
2010-09-30 20:06:01 +00: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 02:59:20 +00:00
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
This->result = xmlXPathEvalExpression(pattern_query, ctxt);
|
|
|
|
xmlFree(pattern_query);
|
2010-09-30 20:06:01 +00:00
|
|
|
}
|
|
|
|
|
2008-08-21 21:36:40 +00:00
|
|
|
if (!This->result || This->result->type != XPATH_NODESET)
|
|
|
|
{
|
|
|
|
hr = E_FAIL;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2011-03-12 23:54:47 +00:00
|
|
|
*out = (IXMLDOMNodeList*)&This->IXMLDOMSelection_iface;
|
2008-08-21 21:36:40 +00:00
|
|
|
hr = S_OK;
|
|
|
|
TRACE("found %d matches\n", xmlXPathNodeSetGetLength(This->result->nodesetval));
|
|
|
|
|
|
|
|
cleanup:
|
2011-03-12 23:54:47 +00:00
|
|
|
if (This && FAILED(hr))
|
|
|
|
IXMLDOMSelection_Release( &This->IXMLDOMSelection_iface );
|
2010-06-12 21:45:52 +00:00
|
|
|
xmlXPathFreeContext(ctxt);
|
2008-08-21 21:36:40 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2007-05-11 15:03:13 +00:00
|
|
|
#endif
|