msxml3: Add IXMLDOMSelection stub.
This commit is contained in:
parent
c48b7566bd
commit
c26c55995a
|
@ -24,9 +24,9 @@ C_SRCS = \
|
||||||
nodemap.c \
|
nodemap.c \
|
||||||
parseerror.c \
|
parseerror.c \
|
||||||
pi.c \
|
pi.c \
|
||||||
queryresult.c \
|
|
||||||
saxreader.c \
|
saxreader.c \
|
||||||
schema.c \
|
schema.c \
|
||||||
|
selection.c \
|
||||||
stylesheet.c \
|
stylesheet.c \
|
||||||
text.c \
|
text.c \
|
||||||
uuid.c \
|
uuid.c \
|
||||||
|
|
|
@ -1926,7 +1926,7 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
|
||||||
XPath = This->properties->XPath;
|
XPath = This->properties->XPath;
|
||||||
This->properties->XPath = TRUE;
|
This->properties->XPath = TRUE;
|
||||||
query = tagName_to_XPath(tagName);
|
query = tagName_to_XPath(tagName);
|
||||||
hr = queryresult_create((xmlNodePtr)get_doc(This), query, resultList);
|
hr = create_selection((xmlNodePtr)get_doc(This), query, resultList);
|
||||||
xmlFree(query);
|
xmlFree(query);
|
||||||
This->properties->XPath = XPath;
|
This->properties->XPath = XPath;
|
||||||
|
|
||||||
|
|
|
@ -1278,7 +1278,7 @@ static HRESULT WINAPI domelem_getElementsByTagName(
|
||||||
XPath = is_xpathmode(get_element(This)->doc);
|
XPath = is_xpathmode(get_element(This)->doc);
|
||||||
set_xpathmode(get_element(This)->doc, TRUE);
|
set_xpathmode(get_element(This)->doc, TRUE);
|
||||||
query = tagName_to_XPath(tagName);
|
query = tagName_to_XPath(tagName);
|
||||||
hr = queryresult_create(get_element(This), query, resultList);
|
hr = create_selection(get_element(This), query, resultList);
|
||||||
xmlFree(query);
|
xmlFree(query);
|
||||||
set_xpathmode(get_element(This)->doc, XPath);
|
set_xpathmode(get_element(This)->doc, XPath);
|
||||||
|
|
||||||
|
|
|
@ -213,23 +213,22 @@ static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* constructors */
|
/* constructors */
|
||||||
extern IUnknown *create_domdoc( xmlNodePtr document );
|
extern IUnknown *create_domdoc( xmlNodePtr );
|
||||||
extern IUnknown *create_xmldoc( void );
|
extern IUnknown *create_xmldoc( void );
|
||||||
extern IXMLDOMNode *create_node( xmlNodePtr node );
|
extern IXMLDOMNode *create_node( xmlNodePtr );
|
||||||
extern IUnknown *create_element( xmlNodePtr element );
|
extern IUnknown *create_element( xmlNodePtr );
|
||||||
extern IUnknown *create_attribute( xmlNodePtr attribute );
|
extern IUnknown *create_attribute( xmlNodePtr );
|
||||||
extern IUnknown *create_text( xmlNodePtr text );
|
extern IUnknown *create_text( xmlNodePtr );
|
||||||
extern IUnknown *create_pi( xmlNodePtr pi );
|
extern IUnknown *create_pi( xmlNodePtr );
|
||||||
extern IUnknown *create_comment( xmlNodePtr comment );
|
extern IUnknown *create_comment( xmlNodePtr );
|
||||||
extern IUnknown *create_cdata( xmlNodePtr text );
|
extern IUnknown *create_cdata( xmlNodePtr );
|
||||||
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
|
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
|
||||||
extern IXMLDOMNamedNodeMap *create_nodemap( const xmlNodePtr );
|
extern IXMLDOMNamedNodeMap *create_nodemap( const xmlNodePtr );
|
||||||
extern IUnknown *create_doc_Implementation(void);
|
extern IUnknown *create_doc_Implementation(void);
|
||||||
extern IUnknown *create_doc_fragment( xmlNodePtr fragment );
|
extern IUnknown *create_doc_fragment( xmlNodePtr );
|
||||||
extern IUnknown *create_doc_entity_ref( xmlNodePtr entity );
|
extern IUnknown *create_doc_entity_ref( xmlNodePtr );
|
||||||
extern IUnknown *create_doc_type( xmlNodePtr doctype );
|
extern IUnknown *create_doc_type( xmlNodePtr );
|
||||||
|
extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** );
|
||||||
extern HRESULT queryresult_create( xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList** out );
|
|
||||||
|
|
||||||
/* data accessors */
|
/* data accessors */
|
||||||
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
|
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
|
||||||
|
|
|
@ -1032,7 +1032,7 @@ HRESULT node_select_nodes(const xmlnode *This, BSTR query, IXMLDOMNodeList **nod
|
||||||
if (!query || !nodes) return E_INVALIDARG;
|
if (!query || !nodes) return E_INVALIDARG;
|
||||||
|
|
||||||
str = xmlchar_from_wchar(query);
|
str = xmlchar_from_wchar(query);
|
||||||
hr = queryresult_create(This->node, str, nodes);
|
hr = create_selection(This->node, str, nodes);
|
||||||
heap_free(str);
|
heap_free(str);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
* They are different because the list returned by XPath queries:
|
* They are different because the list returned by XPath queries:
|
||||||
* - is static - gives the results for the XML tree as it existed during the
|
* - is static - gives the results for the XML tree as it existed during the
|
||||||
* execution of the query
|
* execution of the query
|
||||||
* - supports IXMLDOMSelection (TODO)
|
* - supports IXMLDOMSelection
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -58,29 +58,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||||
int registerNamespaces(xmlXPathContextPtr ctxt);
|
int registerNamespaces(xmlXPathContextPtr ctxt);
|
||||||
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str);
|
xmlChar* XSLPattern_to_XPath(xmlXPathContextPtr ctxt, xmlChar const* xslpat_str);
|
||||||
|
|
||||||
typedef struct _queryresult
|
typedef struct _domselection
|
||||||
{
|
{
|
||||||
DispatchEx dispex;
|
DispatchEx dispex;
|
||||||
const struct IXMLDOMNodeListVtbl *lpVtbl;
|
IXMLDOMSelection IXMLDOMSelection_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result;
|
||||||
int resultPos;
|
int resultPos;
|
||||||
} queryresult;
|
} domselection;
|
||||||
|
|
||||||
static inline queryresult *impl_from_IXMLDOMNodeList( IXMLDOMNodeList *iface )
|
static inline domselection *impl_from_IXMLDOMSelection( IXMLDOMSelection *iface )
|
||||||
{
|
{
|
||||||
return (queryresult *)((char*)iface - FIELD_OFFSET(queryresult, lpVtbl));
|
return CONTAINING_RECORD(iface, domselection, IXMLDOMSelection_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XMLQUERYRES(x) ((IXMLDOMNodeList*)&(x)->lpVtbl)
|
static HRESULT WINAPI domselection_QueryInterface(
|
||||||
|
IXMLDOMSelection *iface,
|
||||||
static HRESULT WINAPI queryresult_QueryInterface(
|
|
||||||
IXMLDOMNodeList *iface,
|
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
void** ppvObject )
|
void** ppvObject )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
|
@ -88,9 +86,10 @@ static HRESULT WINAPI queryresult_QueryInterface(
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
|
||||||
IsEqualGUID( riid, &IID_IXMLDOMNodeList ) )
|
IsEqualGUID( riid, &IID_IXMLDOMNodeList ) ||
|
||||||
|
IsEqualGUID( riid, &IID_IXMLDOMSelection ))
|
||||||
{
|
{
|
||||||
*ppvObject = iface;
|
*ppvObject = &This->IXMLDOMSelection_iface;
|
||||||
}
|
}
|
||||||
else if(dispex_query_interface(&This->dispex, riid, ppvObject))
|
else if(dispex_query_interface(&This->dispex, riid, ppvObject))
|
||||||
{
|
{
|
||||||
|
@ -103,25 +102,27 @@ static HRESULT WINAPI queryresult_QueryInterface(
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IXMLDOMNodeList_AddRef( iface );
|
IXMLDOMSelection_AddRef( iface );
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI queryresult_AddRef(
|
static ULONG WINAPI domselection_AddRef(
|
||||||
IXMLDOMNodeList *iface )
|
IXMLDOMSelection *iface )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
return InterlockedIncrement( &This->ref );
|
ULONG ref = InterlockedIncrement( &This->ref );
|
||||||
|
TRACE("(%p)->(%d)\n", This, ref);
|
||||||
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI queryresult_Release(
|
static ULONG WINAPI domselection_Release(
|
||||||
IXMLDOMNodeList *iface )
|
IXMLDOMSelection *iface )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
ULONG ref;
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->ref);
|
TRACE("(%p)->(%d)\n", This, ref);
|
||||||
if ( ref == 0 )
|
if ( ref == 0 )
|
||||||
{
|
{
|
||||||
xmlXPathFreeObject(This->result);
|
xmlXPathFreeObject(This->result);
|
||||||
|
@ -132,11 +133,11 @@ static ULONG WINAPI queryresult_Release(
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_GetTypeInfoCount(
|
static HRESULT WINAPI domselection_GetTypeInfoCount(
|
||||||
IXMLDOMNodeList *iface,
|
IXMLDOMSelection *iface,
|
||||||
UINT* pctinfo )
|
UINT* pctinfo )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||||
|
|
||||||
|
@ -145,31 +146,31 @@ static HRESULT WINAPI queryresult_GetTypeInfoCount(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_GetTypeInfo(
|
static HRESULT WINAPI domselection_GetTypeInfo(
|
||||||
IXMLDOMNodeList *iface,
|
IXMLDOMSelection *iface,
|
||||||
UINT iTInfo,
|
UINT iTInfo,
|
||||||
LCID lcid,
|
LCID lcid,
|
||||||
ITypeInfo** ppTInfo )
|
ITypeInfo** ppTInfo )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
|
||||||
|
|
||||||
hr = get_typeinfo(IXMLDOMNodeList_tid, ppTInfo);
|
hr = get_typeinfo(IXMLDOMSelection_tid, ppTInfo);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_GetIDsOfNames(
|
static HRESULT WINAPI domselection_GetIDsOfNames(
|
||||||
IXMLDOMNodeList *iface,
|
IXMLDOMSelection *iface,
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPOLESTR* rgszNames,
|
LPOLESTR* rgszNames,
|
||||||
UINT cNames,
|
UINT cNames,
|
||||||
LCID lcid,
|
LCID lcid,
|
||||||
DISPID* rgDispId )
|
DISPID* rgDispId )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
ITypeInfo *typeinfo;
|
ITypeInfo *typeinfo;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ static HRESULT WINAPI queryresult_GetIDsOfNames(
|
||||||
if(!rgszNames || cNames == 0 || !rgDispId)
|
if(!rgszNames || cNames == 0 || !rgDispId)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
hr = get_typeinfo(IXMLDOMNodeList_tid, &typeinfo);
|
hr = get_typeinfo(IXMLDOMSelection_tid, &typeinfo);
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
|
||||||
|
@ -189,8 +190,8 @@ static HRESULT WINAPI queryresult_GetIDsOfNames(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_Invoke(
|
static HRESULT WINAPI domselection_Invoke(
|
||||||
IXMLDOMNodeList *iface,
|
IXMLDOMSelection *iface,
|
||||||
DISPID dispIdMember,
|
DISPID dispIdMember,
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LCID lcid,
|
LCID lcid,
|
||||||
|
@ -200,17 +201,17 @@ static HRESULT WINAPI queryresult_Invoke(
|
||||||
EXCEPINFO* pExcepInfo,
|
EXCEPINFO* pExcepInfo,
|
||||||
UINT* puArgErr )
|
UINT* puArgErr )
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
ITypeInfo *typeinfo;
|
ITypeInfo *typeinfo;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||||
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
|
|
||||||
hr = get_typeinfo(IXMLDOMNodeList_tid, &typeinfo);
|
hr = get_typeinfo(IXMLDOMSelection_tid, &typeinfo);
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
|
hr = ITypeInfo_Invoke(typeinfo, &This->IXMLDOMSelection_iface, dispIdMember, wFlags, pDispParams,
|
||||||
pVarResult, pExcepInfo, puArgErr);
|
pVarResult, pExcepInfo, puArgErr);
|
||||||
ITypeInfo_Release(typeinfo);
|
ITypeInfo_Release(typeinfo);
|
||||||
}
|
}
|
||||||
|
@ -218,12 +219,12 @@ static HRESULT WINAPI queryresult_Invoke(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_get_item(
|
static HRESULT WINAPI domselection_get_item(
|
||||||
IXMLDOMNodeList* iface,
|
IXMLDOMSelection* iface,
|
||||||
LONG index,
|
LONG index,
|
||||||
IXMLDOMNode** listItem)
|
IXMLDOMNode** listItem)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%d %p)\n", This, index, listItem);
|
TRACE("(%p)->(%d %p)\n", This, index, listItem);
|
||||||
|
|
||||||
|
@ -241,11 +242,11 @@ static HRESULT WINAPI queryresult_get_item(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_get_length(
|
static HRESULT WINAPI domselection_get_length(
|
||||||
IXMLDOMNodeList* iface,
|
IXMLDOMSelection* iface,
|
||||||
LONG* listLength)
|
LONG* listLength)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, listLength);
|
TRACE("(%p)->(%p)\n", This, listLength);
|
||||||
|
|
||||||
|
@ -256,11 +257,11 @@ static HRESULT WINAPI queryresult_get_length(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_nextNode(
|
static HRESULT WINAPI domselection_nextNode(
|
||||||
IXMLDOMNodeList* iface,
|
IXMLDOMSelection* iface,
|
||||||
IXMLDOMNode** nextItem)
|
IXMLDOMNode** nextItem)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, nextItem );
|
TRACE("(%p)->(%p)\n", This, nextItem );
|
||||||
|
|
||||||
|
@ -277,45 +278,156 @@ static HRESULT WINAPI queryresult_nextNode(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult_reset(
|
static HRESULT WINAPI domselection_reset(
|
||||||
IXMLDOMNodeList* iface)
|
IXMLDOMSelection* iface)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
|
|
||||||
TRACE("%p\n", This);
|
TRACE("%p\n", This);
|
||||||
This->resultPos = 0;
|
This->resultPos = 0;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI queryresult__newEnum(
|
static HRESULT WINAPI domselection_get__newEnum(
|
||||||
IXMLDOMNodeList* iface,
|
IXMLDOMSelection* iface,
|
||||||
IUnknown** ppUnk)
|
IUnknown** ppUnk)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( iface );
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
FIXME("(%p)->(%p)\n", This, ppUnk);
|
FIXME("(%p)->(%p)\n", This, ppUnk);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI domselection_get_expr(
|
||||||
static const struct IXMLDOMNodeListVtbl queryresult_vtbl =
|
IXMLDOMSelection* iface,
|
||||||
|
BSTR *p)
|
||||||
{
|
{
|
||||||
queryresult_QueryInterface,
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
queryresult_AddRef,
|
FIXME("(%p)->(%p)\n", This, p);
|
||||||
queryresult_Release,
|
return E_NOTIMPL;
|
||||||
queryresult_GetTypeInfoCount,
|
}
|
||||||
queryresult_GetTypeInfo,
|
|
||||||
queryresult_GetIDsOfNames,
|
static HRESULT WINAPI domselection_put_expr(
|
||||||
queryresult_Invoke,
|
IXMLDOMSelection* iface,
|
||||||
queryresult_get_item,
|
BSTR p)
|
||||||
queryresult_get_length,
|
{
|
||||||
queryresult_nextNode,
|
domselection *This = impl_from_IXMLDOMSelection( iface );
|
||||||
queryresult_reset,
|
FIXME("(%p)->(%s)\n", This, debugstr_w(p));
|
||||||
queryresult__newEnum,
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI domselection_clone(
|
||||||
|
IXMLDOMSelection* iface,
|
||||||
|
IXMLDOMSelection **node)
|
||||||
|
{
|
||||||
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT queryresult_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
|
static HRESULT domselection_get_dispid(IUnknown *iface, BSTR name, DWORD flags, DISPID *dispid)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( (IXMLDOMNodeList*)iface );
|
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
|
||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
@ -332,10 +444,10 @@ static HRESULT queryresult_get_dispid(IUnknown *iface, BSTR name, DWORD flags, D
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT queryresult_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
static HRESULT domselection_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
||||||
VARIANT *res, EXCEPINFO *ei)
|
VARIANT *res, EXCEPINFO *ei)
|
||||||
{
|
{
|
||||||
queryresult *This = impl_from_IXMLDOMNodeList( (IXMLDOMNodeList*)iface );
|
domselection *This = impl_from_IXMLDOMSelection( (IXMLDOMSelection*)iface );
|
||||||
|
|
||||||
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
|
TRACE("(%p)->(%x %x %x %p %p %p)\n", This, id, lcid, flags, params, res, ei);
|
||||||
|
|
||||||
|
@ -348,7 +460,7 @@ static HRESULT queryresult_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
|
||||||
{
|
{
|
||||||
IXMLDOMNode *disp = NULL;
|
IXMLDOMNode *disp = NULL;
|
||||||
|
|
||||||
queryresult_get_item(XMLQUERYRES(This), id - MSXML_DISPID_CUSTOM_MIN, &disp);
|
domselection_get_item(&This->IXMLDOMSelection_iface, id - MSXML_DISPID_CUSTOM_MIN, &disp);
|
||||||
V_DISPATCH(res) = (IDispatch*)disp;
|
V_DISPATCH(res) = (IDispatch*)disp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -364,20 +476,20 @@ static HRESULT queryresult_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const dispex_static_data_vtbl_t queryresult_dispex_vtbl = {
|
static const dispex_static_data_vtbl_t domselection_dispex_vtbl = {
|
||||||
queryresult_get_dispid,
|
domselection_get_dispid,
|
||||||
queryresult_invoke
|
domselection_invoke
|
||||||
};
|
};
|
||||||
|
|
||||||
static const tid_t queryresult_iface_tids[] = {
|
static const tid_t domselection_iface_tids[] = {
|
||||||
IXMLDOMNodeList_tid,
|
IXMLDOMSelection_tid,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
static dispex_static_data_t queryresult_dispex = {
|
static dispex_static_data_t domselection_dispex = {
|
||||||
&queryresult_dispex_vtbl,
|
&domselection_dispex_vtbl,
|
||||||
IXMLDOMSelection_tid,
|
IXMLDOMSelection_tid,
|
||||||
NULL,
|
NULL,
|
||||||
queryresult_iface_tids
|
domselection_iface_tids
|
||||||
};
|
};
|
||||||
|
|
||||||
#define XSLPATTERN_CHECK_ARGS(n) \
|
#define XSLPATTERN_CHECK_ARGS(n) \
|
||||||
|
@ -488,25 +600,25 @@ void XSLPattern_OP_IGEq(xmlXPathParserContextPtr pctx, int nargs)
|
||||||
|
|
||||||
static void query_serror(void* ctx, xmlErrorPtr err)
|
static void query_serror(void* ctx, xmlErrorPtr err)
|
||||||
{
|
{
|
||||||
LIBXML2_CALLBACK_SERROR(queryresult_create, err);
|
LIBXML2_CALLBACK_SERROR(domselection_create, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **out)
|
HRESULT create_selection(xmlNodePtr node, xmlChar* query, IXMLDOMNodeList **out)
|
||||||
{
|
{
|
||||||
queryresult *This = heap_alloc_zero(sizeof(queryresult));
|
domselection *This = heap_alloc_zero(sizeof(domselection));
|
||||||
xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
|
xmlXPathContextPtr ctxt = xmlXPathNewContext(node->doc);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p, %s, %p)\n", node, wine_dbgstr_a((char const*)szQuery), out);
|
TRACE("(%p, %s, %p)\n", node, wine_dbgstr_a((char const*)query), out);
|
||||||
|
|
||||||
*out = NULL;
|
*out = NULL;
|
||||||
if (This == NULL || ctxt == NULL || szQuery == NULL)
|
if (!This || !ctxt || !query)
|
||||||
{
|
{
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->lpVtbl = &queryresult_vtbl;
|
This->IXMLDOMSelection_iface.lpVtbl = &domselection_vtbl;
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
This->resultPos = 0;
|
This->resultPos = 0;
|
||||||
This->node = node;
|
This->node = node;
|
||||||
|
@ -519,11 +631,11 @@ HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **
|
||||||
if (is_xpathmode(This->node->doc))
|
if (is_xpathmode(This->node->doc))
|
||||||
{
|
{
|
||||||
xmlXPathRegisterAllFunctions(ctxt);
|
xmlXPathRegisterAllFunctions(ctxt);
|
||||||
This->result = xmlXPathEvalExpression(szQuery, ctxt);
|
This->result = xmlXPathEvalExpression(query, ctxt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xmlChar* xslpQuery = XSLPattern_to_XPath(ctxt, szQuery);
|
xmlChar* pattern_query = XSLPattern_to_XPath(ctxt, query);
|
||||||
|
|
||||||
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"not", xmlXPathNotFunction);
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"not", xmlXPathNotFunction);
|
||||||
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"boolean", xmlXPathBooleanFunction);
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"boolean", xmlXPathBooleanFunction);
|
||||||
|
@ -539,8 +651,8 @@ HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **
|
||||||
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGt", XSLPattern_OP_IGt);
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGt", XSLPattern_OP_IGt);
|
||||||
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGEq", XSLPattern_OP_IGEq);
|
xmlXPathRegisterFunc(ctxt, (xmlChar const*)"OP_IGEq", XSLPattern_OP_IGEq);
|
||||||
|
|
||||||
This->result = xmlXPathEvalExpression(xslpQuery, ctxt);
|
This->result = xmlXPathEvalExpression(pattern_query, ctxt);
|
||||||
xmlFree(xslpQuery);
|
xmlFree(pattern_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!This->result || This->result->type != XPATH_NODESET)
|
if (!This->result || This->result->type != XPATH_NODESET)
|
||||||
|
@ -549,15 +661,15 @@ HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_dispex(&This->dispex, (IUnknown*)&This->lpVtbl, &queryresult_dispex);
|
init_dispex(&This->dispex, (IUnknown*)&This->IXMLDOMSelection_iface, &domselection_dispex);
|
||||||
|
|
||||||
*out = (IXMLDOMNodeList *) &This->lpVtbl;
|
*out = (IXMLDOMNodeList*)&This->IXMLDOMSelection_iface;
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
TRACE("found %d matches\n", xmlXPathNodeSetGetLength(This->result->nodesetval));
|
TRACE("found %d matches\n", xmlXPathNodeSetGetLength(This->result->nodesetval));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (This != NULL && FAILED(hr))
|
if (This && FAILED(hr))
|
||||||
IXMLDOMNodeList_Release( (IXMLDOMNodeList*) &This->lpVtbl );
|
IXMLDOMSelection_Release( &This->IXMLDOMSelection_iface );
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
|
@ -8603,6 +8603,40 @@ static void test_get_attributes(void)
|
||||||
free_bstrs();
|
free_bstrs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_selection(void)
|
||||||
|
{
|
||||||
|
IXMLDOMSelection *selection;
|
||||||
|
IXMLDOMNodeList *list;
|
||||||
|
IXMLDOMDocument *doc;
|
||||||
|
VARIANT_BOOL b;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
doc = create_document(&IID_IXMLDOMDocument);
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument2_loadXML(doc, _bstr_(szExampleXML), &b);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument_selectNodes(doc, _bstr_("root"), &list);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMNodeList_QueryInterface(list, &IID_IXMLDOMSelection, (void**)&selection);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
IXMLDOMSelection_Release(selection);
|
||||||
|
|
||||||
|
IXMLDOMNodeList_Release(list);
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument_get_childNodes(doc, &list);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMNodeList_QueryInterface(list, &IID_IXMLDOMSelection, (void**)&selection);
|
||||||
|
EXPECT_HR(hr, E_NOINTERFACE);
|
||||||
|
|
||||||
|
IXMLDOMNodeList_Release(list);
|
||||||
|
|
||||||
|
IXMLDOMDocument_Release(doc);
|
||||||
|
free_bstrs();
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(domdoc)
|
START_TEST(domdoc)
|
||||||
{
|
{
|
||||||
IXMLDOMDocument *doc;
|
IXMLDOMDocument *doc;
|
||||||
|
@ -8674,6 +8708,8 @@ START_TEST(domdoc)
|
||||||
test_get_dataType();
|
test_get_dataType();
|
||||||
test_get_nodeTypeString();
|
test_get_nodeTypeString();
|
||||||
test_get_attributes();
|
test_get_attributes();
|
||||||
|
test_selection();
|
||||||
|
|
||||||
test_xsltemplate();
|
test_xsltemplate();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
Loading…
Reference in New Issue