Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c26c5599
Commit
c26c5599
authored
Mar 13, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Add IXMLDOMSelection stub.
parent
c48b7566
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
258 additions
and
111 deletions
+258
-111
Makefile.in
dlls/msxml3/Makefile.in
+1
-1
domdoc.c
dlls/msxml3/domdoc.c
+1
-1
element.c
dlls/msxml3/element.c
+1
-1
msxml_private.h
dlls/msxml3/msxml_private.h
+12
-13
node.c
dlls/msxml3/node.c
+1
-1
selection.c
dlls/msxml3/selection.c
+206
-94
domdoc.c
dlls/msxml3/tests/domdoc.c
+36
-0
No files found.
dlls/msxml3/Makefile.in
View file @
c26c5599
...
...
@@ -24,9 +24,9 @@ C_SRCS = \
nodemap.c
\
parseerror.c
\
pi.c
\
queryresult.c
\
saxreader.c
\
schema.c
\
selection.c
\
stylesheet.c
\
text.c
\
uuid.c
\
...
...
dlls/msxml3/domdoc.c
View file @
c26c5599
...
...
@@ -1926,7 +1926,7 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
XPath
=
This
->
properties
->
XPath
;
This
->
properties
->
XPath
=
TRUE
;
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
);
This
->
properties
->
XPath
=
XPath
;
...
...
dlls/msxml3/element.c
View file @
c26c5599
...
...
@@ -1278,7 +1278,7 @@ static HRESULT WINAPI domelem_getElementsByTagName(
XPath
=
is_xpathmode
(
get_element
(
This
)
->
doc
);
set_xpathmode
(
get_element
(
This
)
->
doc
,
TRUE
);
query
=
tagName_to_XPath
(
tagName
);
hr
=
queryresult_create
(
get_element
(
This
),
query
,
resultList
);
hr
=
create_selection
(
get_element
(
This
),
query
,
resultList
);
xmlFree
(
query
);
set_xpathmode
(
get_element
(
This
)
->
doc
,
XPath
);
...
...
dlls/msxml3/msxml_private.h
View file @
c26c5599
...
...
@@ -213,23 +213,22 @@ static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
#endif
/* constructors */
extern
IUnknown
*
create_domdoc
(
xmlNodePtr
document
);
extern
IUnknown
*
create_domdoc
(
xmlNodePtr
);
extern
IUnknown
*
create_xmldoc
(
void
);
extern
IXMLDOMNode
*
create_node
(
xmlNodePtr
node
);
extern
IUnknown
*
create_element
(
xmlNodePtr
element
);
extern
IUnknown
*
create_attribute
(
xmlNodePtr
attribute
);
extern
IUnknown
*
create_text
(
xmlNodePtr
text
);
extern
IUnknown
*
create_pi
(
xmlNodePtr
pi
);
extern
IUnknown
*
create_comment
(
xmlNodePtr
comment
);
extern
IUnknown
*
create_cdata
(
xmlNodePtr
text
);
extern
IXMLDOMNode
*
create_node
(
xmlNodePtr
);
extern
IUnknown
*
create_element
(
xmlNodePtr
);
extern
IUnknown
*
create_attribute
(
xmlNodePtr
);
extern
IUnknown
*
create_text
(
xmlNodePtr
);
extern
IUnknown
*
create_pi
(
xmlNodePtr
);
extern
IUnknown
*
create_comment
(
xmlNodePtr
);
extern
IUnknown
*
create_cdata
(
xmlNodePtr
);
extern
IXMLDOMNodeList
*
create_children_nodelist
(
xmlNodePtr
);
extern
IXMLDOMNamedNodeMap
*
create_nodemap
(
const
xmlNodePtr
);
extern
IUnknown
*
create_doc_Implementation
(
void
);
extern
IUnknown
*
create_doc_fragment
(
xmlNodePtr
fragment
);
extern
IUnknown
*
create_doc_entity_ref
(
xmlNodePtr
entity
);
extern
IUnknown
*
create_doc_type
(
xmlNodePtr
doctype
);
extern
HRESULT
queryresult_create
(
xmlNodePtr
node
,
xmlChar
*
szQuery
,
IXMLDOMNodeList
**
out
);
extern
IUnknown
*
create_doc_fragment
(
xmlNodePtr
);
extern
IUnknown
*
create_doc_entity_ref
(
xmlNodePtr
);
extern
IUnknown
*
create_doc_type
(
xmlNodePtr
);
extern
HRESULT
create_selection
(
xmlNodePtr
,
xmlChar
*
,
IXMLDOMNodeList
**
);
/* data accessors */
xmlNodePtr
xmlNodePtr_from_domnode
(
IXMLDOMNode
*
iface
,
xmlElementType
type
);
...
...
dlls/msxml3/node.c
View file @
c26c5599
...
...
@@ -1032,7 +1032,7 @@ HRESULT node_select_nodes(const xmlnode *This, BSTR query, IXMLDOMNodeList **nod
if
(
!
query
||
!
nodes
)
return
E_INVALIDARG
;
str
=
xmlchar_from_wchar
(
query
);
hr
=
queryresult_create
(
This
->
node
,
str
,
nodes
);
hr
=
create_selection
(
This
->
node
,
str
,
nodes
);
heap_free
(
str
);
return
hr
;
...
...
dlls/msxml3/
queryresult
.c
→
dlls/msxml3/
selection
.c
View file @
c26c5599
...
...
@@ -47,7 +47,7 @@
* 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
* - supports IXMLDOMSelection
(TODO)
* - supports IXMLDOMSelection
*
*/
...
...
@@ -58,29 +58,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
int
registerNamespaces
(
xmlXPathContextPtr
ctxt
);
xmlChar
*
XSLPattern_to_XPath
(
xmlXPathContextPtr
ctxt
,
xmlChar
const
*
xslpat_str
);
typedef
struct
_
queryresult
typedef
struct
_
domselection
{
DispatchEx
dispex
;
const
struct
IXMLDOMNodeListVtbl
*
lpVtbl
;
IXMLDOMSelection
IXMLDOMSelection_iface
;
LONG
ref
;
xmlNodePtr
node
;
xmlXPathObjectPtr
result
;
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
queryresult_QueryInterface
(
IXMLDOMNodeList
*
iface
,
static
HRESULT
WINAPI
domselection_QueryInterface
(
IXMLDOMSelection
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppvObject
);
...
...
@@ -88,9 +86,10 @@ static HRESULT WINAPI queryresult_QueryInterface(
return
E_INVALIDARG
;
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
))
{
...
...
@@ -103,25 +102,27 @@ static HRESULT WINAPI queryresult_QueryInterface(
return
E_NOINTERFACE
;
}
IXMLDOM
NodeList
_AddRef
(
iface
);
IXMLDOM
Selection
_AddRef
(
iface
);
return
S_OK
;
}
static
ULONG
WINAPI
queryresult
_AddRef
(
IXMLDOM
NodeList
*
iface
)
static
ULONG
WINAPI
domselection
_AddRef
(
IXMLDOM
Selection
*
iface
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
return
InterlockedIncrement
(
&
This
->
ref
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
queryresult
_Release
(
IXMLDOM
NodeList
*
iface
)
static
ULONG
WINAPI
domselection
_Release
(
IXMLDOM
Selection
*
iface
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
ULONG
ref
;
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
)
;
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
xmlXPathFreeObject
(
This
->
result
);
...
...
@@ -132,11 +133,11 @@ static ULONG WINAPI queryresult_Release(
return
ref
;
}
static
HRESULT
WINAPI
queryresult
_GetTypeInfoCount
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_GetTypeInfoCount
(
IXMLDOM
Selection
*
iface
,
UINT
*
pctinfo
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pctinfo
);
...
...
@@ -145,31 +146,31 @@ static HRESULT WINAPI queryresult_GetTypeInfoCount(
return
S_OK
;
}
static
HRESULT
WINAPI
queryresult
_GetTypeInfo
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_GetTypeInfo
(
IXMLDOM
Selection
*
iface
,
UINT
iTInfo
,
LCID
lcid
,
ITypeInfo
**
ppTInfo
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%u %u %p)
\n
"
,
This
,
iTInfo
,
lcid
,
ppTInfo
);
hr
=
get_typeinfo
(
IXMLDOM
NodeList
_tid
,
ppTInfo
);
hr
=
get_typeinfo
(
IXMLDOM
Selection
_tid
,
ppTInfo
);
return
hr
;
}
static
HRESULT
WINAPI
queryresult
_GetIDsOfNames
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_GetIDsOfNames
(
IXMLDOM
Selection
*
iface
,
REFIID
riid
,
LPOLESTR
*
rgszNames
,
UINT
cNames
,
LCID
lcid
,
DISPID
*
rgDispId
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
ITypeInfo
*
typeinfo
;
HRESULT
hr
;
...
...
@@ -179,7 +180,7 @@ static HRESULT WINAPI queryresult_GetIDsOfNames(
if
(
!
rgszNames
||
cNames
==
0
||
!
rgDispId
)
return
E_INVALIDARG
;
hr
=
get_typeinfo
(
IXMLDOM
NodeList
_tid
,
&
typeinfo
);
hr
=
get_typeinfo
(
IXMLDOM
Selection
_tid
,
&
typeinfo
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
ITypeInfo_GetIDsOfNames
(
typeinfo
,
rgszNames
,
cNames
,
rgDispId
);
...
...
@@ -189,8 +190,8 @@ static HRESULT WINAPI queryresult_GetIDsOfNames(
return
hr
;
}
static
HRESULT
WINAPI
queryresult
_Invoke
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_Invoke
(
IXMLDOM
Selection
*
iface
,
DISPID
dispIdMember
,
REFIID
riid
,
LCID
lcid
,
...
...
@@ -200,17 +201,17 @@ static HRESULT WINAPI queryresult_Invoke(
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
ITypeInfo
*
typeinfo
;
HRESULT
hr
;
TRACE
(
"(%p)->(%d %s %d %d %p %p %p %p)
\n
"
,
This
,
dispIdMember
,
debugstr_guid
(
riid
),
lcid
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
hr
=
get_typeinfo
(
IXMLDOM
NodeList
_tid
,
&
typeinfo
);
hr
=
get_typeinfo
(
IXMLDOM
Selection
_tid
,
&
typeinfo
);
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
);
ITypeInfo_Release
(
typeinfo
);
}
...
...
@@ -218,12 +219,12 @@ static HRESULT WINAPI queryresult_Invoke(
return
hr
;
}
static
HRESULT
WINAPI
queryresult
_get_item
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_get_item
(
IXMLDOM
Selection
*
iface
,
LONG
index
,
IXMLDOMNode
**
listItem
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"(%p)->(%d %p)
\n
"
,
This
,
index
,
listItem
);
...
...
@@ -241,11 +242,11 @@ static HRESULT WINAPI queryresult_get_item(
return
S_OK
;
}
static
HRESULT
WINAPI
queryresult
_get_length
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_get_length
(
IXMLDOM
Selection
*
iface
,
LONG
*
listLength
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
listLength
);
...
...
@@ -256,11 +257,11 @@ static HRESULT WINAPI queryresult_get_length(
return
S_OK
;
}
static
HRESULT
WINAPI
queryresult
_nextNode
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection
_nextNode
(
IXMLDOM
Selection
*
iface
,
IXMLDOMNode
**
nextItem
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
nextItem
);
...
...
@@ -277,45 +278,156 @@ static HRESULT WINAPI queryresult_nextNode(
return
S_OK
;
}
static
HRESULT
WINAPI
queryresult
_reset
(
IXMLDOM
NodeList
*
iface
)
static
HRESULT
WINAPI
domselection
_reset
(
IXMLDOM
Selection
*
iface
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
TRACE
(
"%p
\n
"
,
This
);
This
->
resultPos
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
queryresul
t__newEnum
(
IXMLDOM
NodeList
*
iface
,
static
HRESULT
WINAPI
domselection_ge
t__newEnum
(
IXMLDOM
Selection
*
iface
,
IUnknown
**
ppUnk
)
{
queryresult
*
This
=
impl_from_IXMLDOMNodeList
(
iface
);
domselection
*
This
=
impl_from_IXMLDOMSelection
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
ppUnk
);
return
E_NOTIMPL
;
}
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
;
}
static
const
struct
IXMLDOMNodeListVtbl
queryresult_vtbl
=
static
HRESULT
WINAPI
domselection_clone
(
IXMLDOMSelection
*
iface
,
IXMLDOMSelection
**
node
)
{
queryresult_QueryInterface
,
queryresult_AddRef
,
queryresult_Release
,
queryresult_GetTypeInfoCount
,
queryresult_GetTypeInfo
,
queryresult_GetIDsOfNames
,
queryresult_Invoke
,
queryresult_get_item
,
queryresult_get_length
,
queryresult_nextNode
,
queryresult_reset
,
queryresult__newEnum
,
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
;
int
idx
=
0
;
...
...
@@ -332,10 +444,10 @@ static HRESULT queryresult_get_dispid(IUnknown *iface, BSTR name, DWORD flags, D
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
)
{
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
);
...
...
@@ -348,7 +460,7 @@ static HRESULT queryresult_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
{
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
;
break
;
}
...
...
@@ -364,20 +476,20 @@ static HRESULT queryresult_invoke(IUnknown *iface, DISPID id, LCID lcid, WORD fl
return
S_OK
;
}
static
const
dispex_static_data_vtbl_t
queryresult
_dispex_vtbl
=
{
queryresult
_get_dispid
,
queryresult
_invoke
static
const
dispex_static_data_vtbl_t
domselection
_dispex_vtbl
=
{
domselection
_get_dispid
,
domselection
_invoke
};
static
const
tid_t
queryresult
_iface_tids
[]
=
{
IXMLDOM
NodeList
_tid
,
static
const
tid_t
domselection
_iface_tids
[]
=
{
IXMLDOM
Selection
_tid
,
0
};
static
dispex_static_data_t
queryresult
_dispex
=
{
&
queryresult
_dispex_vtbl
,
static
dispex_static_data_t
domselection
_dispex
=
{
&
domselection
_dispex_vtbl
,
IXMLDOMSelection_tid
,
NULL
,
queryresult
_iface_tids
domselection
_iface_tids
};
#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
)
{
LIBXML2_CALLBACK_SERROR
(
queryresult
_create
,
err
);
LIBXML2_CALLBACK_SERROR
(
domselection
_create
,
err
);
}
HRESULT
queryresult_create
(
xmlNodePtr
node
,
xmlChar
*
szQ
uery
,
IXMLDOMNodeList
**
out
)
HRESULT
create_selection
(
xmlNodePtr
node
,
xmlChar
*
q
uery
,
IXMLDOMNodeList
**
out
)
{
queryresult
*
This
=
heap_alloc_zero
(
sizeof
(
queryresult
));
domselection
*
This
=
heap_alloc_zero
(
sizeof
(
domselection
));
xmlXPathContextPtr
ctxt
=
xmlXPathNewContext
(
node
->
doc
);
HRESULT
hr
;
TRACE
(
"(%p, %s, %p)
\n
"
,
node
,
wine_dbgstr_a
((
char
const
*
)
szQ
uery
),
out
);
TRACE
(
"(%p, %s, %p)
\n
"
,
node
,
wine_dbgstr_a
((
char
const
*
)
q
uery
),
out
);
*
out
=
NULL
;
if
(
This
==
NULL
||
ctxt
==
NULL
||
szQuery
==
NULL
)
if
(
!
This
||
!
ctxt
||
!
query
)
{
hr
=
E_OUTOFMEMORY
;
goto
cleanup
;
}
This
->
lpVtbl
=
&
queryresult
_vtbl
;
This
->
IXMLDOMSelection_iface
.
lpVtbl
=
&
domselection
_vtbl
;
This
->
ref
=
1
;
This
->
resultPos
=
0
;
This
->
node
=
node
;
...
...
@@ -519,11 +631,11 @@ HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **
if
(
is_xpathmode
(
This
->
node
->
doc
))
{
xmlXPathRegisterAllFunctions
(
ctxt
);
This
->
result
=
xmlXPathEvalExpression
(
szQ
uery
,
ctxt
);
This
->
result
=
xmlXPathEvalExpression
(
q
uery
,
ctxt
);
}
else
{
xmlChar
*
xslpQuery
=
XSLPattern_to_XPath
(
ctxt
,
szQ
uery
);
xmlChar
*
pattern_query
=
XSLPattern_to_XPath
(
ctxt
,
q
uery
);
xmlXPathRegisterFunc
(
ctxt
,
(
xmlChar
const
*
)
"not"
,
xmlXPathNotFunction
);
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_IGEq"
,
XSLPattern_OP_IGEq
);
This
->
result
=
xmlXPathEvalExpression
(
xslpQ
uery
,
ctxt
);
xmlFree
(
xslpQ
uery
);
This
->
result
=
xmlXPathEvalExpression
(
pattern_q
uery
,
ctxt
);
xmlFree
(
pattern_q
uery
);
}
if
(
!
This
->
result
||
This
->
result
->
type
!=
XPATH_NODESET
)
...
...
@@ -549,15 +661,15 @@ HRESULT queryresult_create(xmlNodePtr node, xmlChar* szQuery, IXMLDOMNodeList **
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
;
TRACE
(
"found %d matches
\n
"
,
xmlXPathNodeSetGetLength
(
This
->
result
->
nodesetval
));
cleanup:
if
(
This
!=
NULL
&&
FAILED
(
hr
))
IXMLDOM
NodeList_Release
(
(
IXMLDOMNodeList
*
)
&
This
->
lpVtbl
);
if
(
This
&&
FAILED
(
hr
))
IXMLDOM
Selection_Release
(
&
This
->
IXMLDOMSelection_iface
);
xmlXPathFreeContext
(
ctxt
);
return
hr
;
}
...
...
dlls/msxml3/tests/domdoc.c
View file @
c26c5599
...
...
@@ -8603,6 +8603,40 @@ static void test_get_attributes(void)
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
)
{
IXMLDOMDocument
*
doc
;
...
...
@@ -8674,6 +8708,8 @@ START_TEST(domdoc)
test_get_dataType
();
test_get_nodeTypeString
();
test_get_attributes
();
test_selection
();
test_xsltemplate
();
CoUninitialize
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment