59int registerNamespaces(xmlXPathContextPtr ctxt);
60xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt,
xmlChar const* xslpat_str);
72 const struct enumvariant_funcs *
funcs;
78 IXMLDOMSelection IXMLDOMSelection_iface;
95 HRESULT hr = IXMLDOMSelection_nextNode((IXMLDOMSelection*)iface, &
node);
100static const struct enumvariant_funcs selection_enumvariant = {
105static inline domselection *impl_from_IXMLDOMSelection( IXMLDOMSelection *iface )
116 IXMLDOMSelection *iface,
120 domselection *
This = impl_from_IXMLDOMSelection( iface );
135 if (!
This->enumvariant)
141 return IEnumVARIANT_QueryInterface(
This->enumvariant, &IID_IEnumVARIANT,
ppvObject);
154 IXMLDOMSelection_AddRef( iface );
160 IXMLDOMSelection *iface )
162 domselection *
This = impl_from_IXMLDOMSelection( iface );
169 IXMLDOMSelection *iface )
171 domselection *
This = impl_from_IXMLDOMSelection( iface );
177 xmlXPathFreeObject(
This->result);
178 xmldoc_release(
This->node->doc);
179 if (
This->enumvariant) IEnumVARIANT_Release(
This->enumvariant);
187 IXMLDOMSelection *iface,
190 domselection *
This = impl_from_IXMLDOMSelection( iface );
191 return IDispatchEx_GetTypeInfoCount(&
This->dispex.IDispatchEx_iface, pctinfo);
195 IXMLDOMSelection *iface,
200 domselection *
This = impl_from_IXMLDOMSelection( iface );
201 return IDispatchEx_GetTypeInfo(&
This->dispex.IDispatchEx_iface,
202 iTInfo, lcid, ppTInfo);
206 IXMLDOMSelection *iface,
213 domselection *
This = impl_from_IXMLDOMSelection( iface );
214 return IDispatchEx_GetIDsOfNames(&
This->dispex.IDispatchEx_iface,
215 riid, rgszNames, cNames, lcid, rgDispId);
219 IXMLDOMSelection *iface,
224 DISPPARAMS* pDispParams,
226 EXCEPINFO* pExcepInfo,
229 domselection *
This = impl_from_IXMLDOMSelection( iface );
230 return IDispatchEx_Invoke(&
This->dispex.IDispatchEx_iface,
231 dispIdMember,
riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
235 IXMLDOMSelection* iface,
239 domselection *
This = impl_from_IXMLDOMSelection( iface );
248 if (index < 0 || index >= xmlXPathNodeSetGetLength(
This->result->nodesetval))
258 IXMLDOMSelection* iface,
261 domselection *
This = impl_from_IXMLDOMSelection( iface );
268 *listLength = xmlXPathNodeSetGetLength(
This->result->nodesetval);
273 IXMLDOMSelection* iface,
276 domselection *
This = impl_from_IXMLDOMSelection( iface );
285 if (
This->resultPos >= xmlXPathNodeSetGetLength(
This->result->nodesetval))
294 IXMLDOMSelection* iface)
296 domselection *
This = impl_from_IXMLDOMSelection( iface );
304 IXMLDOMSelection* iface,
307 domselection *
This = impl_from_IXMLDOMSelection( iface );
315 IXMLDOMSelection* iface,
318 domselection *
This = impl_from_IXMLDOMSelection( iface );
324 IXMLDOMSelection* iface,
327 domselection *
This = impl_from_IXMLDOMSelection( iface );
333 IXMLDOMSelection* iface,
336 domselection *
This = impl_from_IXMLDOMSelection( iface );
342 IXMLDOMSelection* iface,
345 domselection *
This = impl_from_IXMLDOMSelection( iface );
351 IXMLDOMSelection* iface,
354 domselection *
This = impl_from_IXMLDOMSelection( iface );
360 IXMLDOMSelection* iface,
364 domselection *
This = impl_from_IXMLDOMSelection( iface );
370 IXMLDOMSelection* iface,
373 domselection *
This = impl_from_IXMLDOMSelection( iface );
379 IXMLDOMSelection* iface)
381 domselection *
This = impl_from_IXMLDOMSelection( iface );
387 IXMLDOMSelection* iface,
388 IXMLDOMSelection **
node)
390 domselection *
This = impl_from_IXMLDOMSelection( iface );
396 IXMLDOMSelection* iface,
400 domselection *
This = impl_from_IXMLDOMSelection( iface );
406 IXMLDOMSelection* iface,
410 domselection *
This = impl_from_IXMLDOMSelection( iface );
415static const struct IXMLDOMSelectionVtbl domselection_vtbl =
417 domselection_QueryInterface,
419 domselection_Release,
420 domselection_GetTypeInfoCount,
421 domselection_GetTypeInfo,
422 domselection_GetIDsOfNames,
424 domselection_get_item,
425 domselection_get_length,
426 domselection_nextNode,
428 domselection_get__newEnum,
429 domselection_get_expr,
430 domselection_put_expr,
431 domselection_get_context,
432 domselection_putref_context,
433 domselection_peekNode,
434 domselection_matches,
435 domselection_removeNext,
436 domselection_removeAll,
438 domselection_getProperty,
439 domselection_setProperty
468 IEnumVARIANT_AddRef( iface );
489 if (
This->own) IUnknown_Release(
This->outer);
507 if (fetched) *fetched = 0;
511 for (; celt > 0; celt--,
var++,
This->pos++)
522 if (fetched) (*fetched)++;
527 if (
This->funcs->next)
554 FIXME(
"(%p)->(%p): stub\n",
This, ppenum);
584 IUnknown_AddRef(
This->outer);
586 *penum = &
This->IEnumVARIANT_iface;
587 IEnumVARIANT_AddRef(*penum);
602 TRACE(
"ret %x\n", *dispid);
609 domselection *
This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
621 case INVOKE_PROPERTYGET:
642 domselection_get_dispid,
646static const tid_t domselection_iface_tids[] = {
651 &domselection_dispex_vtbl,
654 domselection_iface_tids
657#define XSLPATTERN_CHECK_ARGS(n) \
659 FIXME("XSLPattern syntax error: Expected %i arguments, got %i\n", n, nargs); \
660 xmlXPathSetArityError(pctx); \
665static void XSLPattern_index(xmlXPathParserContextPtr pctx,
int nargs)
667 XSLPATTERN_CHECK_ARGS(0);
669 xmlXPathPositionFunction(pctx, 0);
670 xmlXPathReturnNumber(pctx, xmlXPathPopNumber(pctx) - 1.0);
673static void XSLPattern_end(xmlXPathParserContextPtr pctx,
int nargs)
676 XSLPATTERN_CHECK_ARGS(0);
678 xmlXPathPositionFunction(pctx, 0);
679 pos = xmlXPathPopNumber(pctx);
680 xmlXPathLastFunction(pctx, 0);
681 last = xmlXPathPopNumber(pctx);
682 xmlXPathReturnBoolean(pctx,
pos ==
last);
685static void XSLPattern_nodeType(xmlXPathParserContextPtr pctx,
int nargs)
687 XSLPATTERN_CHECK_ARGS(0);
688 xmlXPathReturnNumber(pctx, pctx->context->node->type);
691static void XSLPattern_OP_IEq(xmlXPathParserContextPtr pctx,
int nargs)
694 XSLPATTERN_CHECK_ARGS(2);
696 arg2 = xmlXPathPopString(pctx);
697 arg1 = xmlXPathPopString(pctx);
703static void XSLPattern_OP_INEq(xmlXPathParserContextPtr pctx,
int nargs)
706 XSLPATTERN_CHECK_ARGS(2);
708 arg2 = xmlXPathPopString(pctx);
709 arg1 = xmlXPathPopString(pctx);
715static void XSLPattern_OP_ILt(xmlXPathParserContextPtr pctx,
int nargs)
718 XSLPATTERN_CHECK_ARGS(2);
720 arg2 = xmlXPathPopString(pctx);
721 arg1 = xmlXPathPopString(pctx);
727static void XSLPattern_OP_ILEq(xmlXPathParserContextPtr pctx,
int nargs)
730 XSLPATTERN_CHECK_ARGS(2);
732 arg2 = xmlXPathPopString(pctx);
733 arg1 = xmlXPathPopString(pctx);
739static void XSLPattern_OP_IGt(xmlXPathParserContextPtr pctx,
int nargs)
742 XSLPATTERN_CHECK_ARGS(2);
744 arg2 = xmlXPathPopString(pctx);
745 arg1 = xmlXPathPopString(pctx);
751static void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx,
int nargs)
754 XSLPATTERN_CHECK_ARGS(2);
756 arg2 = xmlXPathPopString(pctx);
757 arg1 = xmlXPathPopString(pctx);
765 LIBXML2_CALLBACK_SERROR(domselection_create,
err);
771 xmlXPathContextPtr ctxt = xmlXPathNewContext(
node->doc);
779 xmlXPathFreeContext(ctxt);
784 This->IXMLDOMSelection_iface.lpVtbl = &domselection_vtbl;
790 xmldoc_add_ref(
This->node->doc);
792 ctxt->error = query_serror;
794 registerNamespaces(ctxt);
796 if (is_xpathmode(
This->node->doc))
798 xmlXPathRegisterAllFunctions(ctxt);
799 This->result = xmlXPathEvalExpression(
query, ctxt);
803 xmlChar* pattern_query = XSLPattern_to_XPath(ctxt,
query);
805 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"not", xmlXPathNotFunction);
806 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"boolean", xmlXPathBooleanFunction);
808 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"index", XSLPattern_index);
809 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"end", XSLPattern_end);
810 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"nodeType", XSLPattern_nodeType);
812 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_IEq", XSLPattern_OP_IEq);
813 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_INEq", XSLPattern_OP_INEq);
814 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_ILt", XSLPattern_OP_ILt);
815 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_ILEq", XSLPattern_OP_ILEq);
816 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_IGt", XSLPattern_OP_IGt);
817 xmlXPathRegisterFunc(ctxt, (
xmlChar const*)
"OP_IGEq", XSLPattern_OP_IGEq);
819 This->result = xmlXPathEvalExpression(pattern_query, ctxt);
823 if (!
This->result ||
This->result->type != XPATH_NODESET)
831 TRACE(
"found %d matches\n", xmlXPathNodeSetGetLength(
This->result->nodesetval));
835 IXMLDOMSelection_Release( &
This->IXMLDOMSelection_iface );
836 xmlXPathFreeContext(ctxt);
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void cleanup(void)
static HRESULT WINAPI enumvariant_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj)
static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface)
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLenum const GLfloat * params
static HTMLElementCollectionEnum * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
static HRESULT create_node(HTMLDocumentNode *, nsIDOMNode *, HTMLDOMNode **)
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
static const char * debugstr_variant(const VARIANT *var)
static VARIANTARG static DISPID
static const IEnumVARIANTVtbl EnumVARIANTVtbl
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
#define DISPID_DOM_COLLECTION_MAX
#define DISPID_DOM_COLLECTION_BASE
#define IsEqualGUID(rguid1, rguid2)
XMLPUBVAR xmlFreeFunc xmlFree
static struct __wine_debug_functions funcs
#define CONTAINING_RECORD(address, type, field)
_In_ DWORD _Out_ _In_ WORD wFlags
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
#define DISP_E_UNKNOWNNAME
XMLPUBFUN int XMLCALL xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2)