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
82bb4f51
Commit
82bb4f51
authored
May 13, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implement empty tagname case of getElementsByTagName() for document.
parent
239d8077
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
+34
-35
domdoc.c
dlls/msxml3/domdoc.c
+6
-0
domdoc.c
dlls/msxml3/tests/domdoc.c
+28
-35
No files found.
dlls/msxml3/domdoc.c
View file @
82bb4f51
...
...
@@ -1846,12 +1846,18 @@ static HRESULT WINAPI domdoc_createEntityReference(
xmlChar
*
tagName_to_XPath
(
const
BSTR
tagName
)
{
xmlChar
*
query
,
*
tmp
;
static
const
xmlChar
everything
[]
=
"/descendant::node()"
;
static
const
xmlChar
mod_pre
[]
=
"*[local-name()='"
;
static
const
xmlChar
mod_post
[]
=
"']"
;
static
const
xmlChar
prefix
[]
=
"descendant::"
;
const
WCHAR
*
tokBegin
,
*
tokEnd
;
int
len
;
/* Special case - empty tagname - means select all nodes,
except document itself. */
if
(
!*
tagName
)
return
xmlStrdup
(
everything
);
query
=
xmlStrdup
(
prefix
);
tokBegin
=
tagName
;
...
...
dlls/msxml3/tests/domdoc.c
View file @
82bb4f51
...
...
@@ -3013,8 +3013,24 @@ static void test_create(void)
IXMLDOMDocument_Release
(
doc
);
}
struct
queryresult_t
{
const
char
*
query
;
const
char
*
result
;
int
len
;
};
static
const
struct
queryresult_t
elementsbytagname
[]
=
{
{
""
,
"P1.D1 E2.D1 E1.E2.D1 T1.E1.E2.D1 E2.E2.D1 T1.E2.E2.D1 E3.E2.D1 E4.E2.D1 E1.E4.E2.D1 T1.E1.E4.E2.D1"
,
10
},
{
"*"
,
"E2.D1 E1.E2.D1 E2.E2.D1 E3.E2.D1 E4.E2.D1 E1.E4.E2.D1"
,
6
},
{
"bs"
,
"E1.E2.D1"
,
1
},
{
"dl"
,
""
,
0
},
{
"str1"
,
""
,
0
},
{
NULL
}
};
static
void
test_getElementsByTagName
(
void
)
{
const
struct
queryresult_t
*
ptr
=
elementsbytagname
;
IXMLDOMNodeList
*
node_list
;
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
elem
;
...
...
@@ -3035,17 +3051,21 @@ static void test_getElementsByTagName(void)
/* null arguments cases */
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
NULL
,
&
node_list
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
NULL
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
_bstr_
(
"*"
)
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
6
,
"len %d
\n
"
,
len
);
while
(
ptr
->
query
)
{
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
_bstr_
(
ptr
->
query
),
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
ptr
->
len
,
"%s: got len %d, expected %d
\n
"
,
ptr
->
query
,
len
,
ptr
->
len
);
expect_list_and_release
(
node_list
,
ptr
->
result
);
IXMLDOMNodeList_Release
(
node_list
);
SysFreeString
(
str
);
free_bstrs
();
ptr
++
;
}
/* broken query BSTR */
memcpy
(
&
buff
[
2
],
szstar
,
sizeof
(
szstar
));
...
...
@@ -3058,33 +3078,6 @@ static void test_getElementsByTagName(void)
ok
(
len
==
6
,
"len %d
\n
"
,
len
);
IXMLDOMNodeList_Release
(
node_list
);
str
=
SysAllocString
(
szbs
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
1
,
"len %d
\n
"
,
len
);
IXMLDOMNodeList_Release
(
node_list
);
SysFreeString
(
str
);
str
=
SysAllocString
(
szdl
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
0
,
"len %d
\n
"
,
len
);
IXMLDOMNodeList_Release
(
node_list
);
SysFreeString
(
str
);
str
=
SysAllocString
(
szstr1
);
r
=
IXMLDOMDocument_getElementsByTagName
(
doc
,
str
,
&
node_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_length
(
node_list
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
len
==
0
,
"len %d
\n
"
,
len
);
IXMLDOMNodeList_Release
(
node_list
);
SysFreeString
(
str
);
/* test for element */
r
=
IXMLDOMDocument_get_documentElement
(
doc
,
&
elem
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
...
...
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