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
549befe7
Commit
549befe7
authored
Dec 23, 2008
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Dec 23, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Use xmlNodeGetContent to get text data.
parent
c6458f0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
20 deletions
+34
-20
node.c
dlls/msxml3/node.c
+6
-20
domdoc.c
dlls/msxml3/tests/domdoc.c
+28
-0
No files found.
dlls/msxml3/node.c
View file @
549befe7
...
...
@@ -864,32 +864,18 @@ static HRESULT WINAPI xmlnode_get_text(
{
xmlnode
*
This
=
impl_from_IXMLDOMNode
(
iface
);
BSTR
str
=
NULL
;
xmlChar
*
pContent
;
TRACE
(
"%p
\n
"
,
This
);
TRACE
(
"%p
type %d
\n
"
,
This
,
This
->
node
->
type
);
if
(
!
text
)
return
E_INVALIDARG
;
switch
(
This
->
node
->
type
)
{
case
XML_ELEMENT_NODE
:
case
XML_ATTRIBUTE_NODE
:
pContent
=
xmlNodeGetContent
((
xmlNodePtr
)
This
->
node
);
if
(
pContent
)
{
xmlNodePtr
child
=
This
->
node
->
children
;
if
(
child
&&
child
->
type
==
XML_TEXT_NODE
)
str
=
bstr_from_xmlChar
(
child
->
content
);
break
;
}
case
XML_TEXT_NODE
:
case
XML_CDATA_SECTION_NODE
:
case
XML_PI_NODE
:
case
XML_COMMENT_NODE
:
str
=
bstr_from_xmlChar
(
This
->
node
->
content
);
break
;
default:
FIXME
(
"Unhandled node type %d
\n
"
,
This
->
node
->
type
);
str
=
bstr_from_xmlChar
(
pContent
);
xmlFree
(
pContent
);
}
/* Always return a string. */
...
...
dlls/msxml3/tests/domdoc.c
View file @
549befe7
...
...
@@ -260,6 +260,20 @@ static BOOL compareIgnoreReturns(BSTR sLeft, BSTR sRight)
}
}
static
BOOL
compareIgnoreReturnsWhitespace
(
BSTR
sLeft
,
BSTR
sRight
)
{
/* MSXML3 inserts whitespace where as libxml doesn't. */
for
(;;)
{
while
(
*
sLeft
==
'\r'
||
*
sLeft
==
'\n'
||
*
sLeft
==
' '
)
sLeft
++
;
while
(
*
sRight
==
'\r'
||
*
sRight
==
'\n'
||
*
sRight
==
' '
)
sRight
++
;
if
(
*
sLeft
!=
*
sRight
)
return
FALSE
;
if
(
!*
sLeft
)
return
TRUE
;
sLeft
++
;
sRight
++
;
}
}
static
void
get_str_for_type
(
DOMNodeType
type
,
char
*
buf
)
{
switch
(
type
)
...
...
@@ -1706,6 +1720,7 @@ static void test_get_text(void)
VARIANT_BOOL
b
;
IXMLDOMDocument
*
doc
;
IXMLDOMNode
*
node
,
*
node2
,
*
node3
;
IXMLDOMNode
*
nodeRoot
;
IXMLDOMNodeList
*
node_list
;
IXMLDOMNamedNodeMap
*
node_map
;
long
len
;
...
...
@@ -1726,6 +1741,19 @@ static void test_get_text(void)
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
SysFreeString
(
str
);
/* Test to get all child node text. */
r
=
IXMLDOMDocument_QueryInterface
(
doc
,
&
IID_IXMLDOMNode
,
(
LPVOID
*
)
&
nodeRoot
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
r
==
S_OK
)
{
r
=
IXMLDOMNode_get_text
(
nodeRoot
,
&
str
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
compareIgnoreReturnsWhitespace
(
str
,
_bstr_
(
"fn1.txt
\n\n
fn2.txt
\n\n
f1
\n
"
)),
"wrong get_text
\n
"
);
SysFreeString
(
str
);
IXMLDOMNode_Release
(
nodeRoot
);
}
if
(
0
)
{
/* this test crashes on win9x */
r
=
IXMLDOMNodeList_QueryInterface
(
node_list
,
&
IID_IDispatch
,
NULL
);
...
...
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