Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6fe686f5
Commit
6fe686f5
authored
Oct 07, 2008
by
Michael Karcher
Committed by
Alexandre Julliard
Oct 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Basic implementation of IXMLDOMNode::replaceChild.
parent
2a21579b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
11 deletions
+50
-11
node.c
dlls/msxml3/node.c
+37
-2
domdoc.c
dlls/msxml3/tests/domdoc.c
+13
-9
No files found.
dlls/msxml3/node.c
View file @
6fe686f5
...
...
@@ -610,6 +610,9 @@ static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode
**
outOldChild
)
{
xmlnode
*
This
=
impl_from_IXMLDOMNode
(
iface
);
xmlNode
*
old_child_ptr
,
*
new_child_ptr
;
xmlDocPtr
leaving_doc
;
xmlNode
*
my_ancestor
;
TRACE
(
"%p->(%p,%p,%p)
\n
"
,
This
,
newChild
,
oldChild
,
outOldChild
);
...
...
@@ -618,8 +621,40 @@ static HRESULT WINAPI xmlnode_replaceChild(
if
(
!
newChild
||
!
oldChild
)
return
E_INVALIDARG
;
FIXME
(
"not implemented
\n
"
);
return
E_NOTIMPL
;
if
(
outOldChild
)
*
outOldChild
=
NULL
;
old_child_ptr
=
impl_from_IXMLDOMNode
(
oldChild
)
->
node
;
if
(
old_child_ptr
->
parent
!=
This
->
node
)
{
WARN
(
"childNode %p is not a child of %p
\n
"
,
oldChild
,
iface
);
return
E_INVALIDARG
;
}
new_child_ptr
=
impl_from_IXMLDOMNode
(
newChild
)
->
node
;
my_ancestor
=
This
->
node
;
while
(
my_ancestor
)
{
if
(
my_ancestor
==
new_child_ptr
)
{
WARN
(
"tried to create loop
\n
"
);
return
E_FAIL
;
}
my_ancestor
=
my_ancestor
->
parent
;
}
leaving_doc
=
new_child_ptr
->
doc
;
xmldoc_add_ref
(
old_child_ptr
->
doc
);
xmlReplaceNode
(
old_child_ptr
,
new_child_ptr
);
xmldoc_release
(
leaving_doc
);
if
(
outOldChild
)
{
IXMLDOMNode_AddRef
(
oldChild
);
*
outOldChild
=
oldChild
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
xmlnode_removeChild
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
6fe686f5
...
...
@@ -1843,7 +1843,7 @@ static void test_replaceChild(void)
VARIANT_BOOL
b
;
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
element
;
IXMLDOMNode
*
fo_node
,
*
ba_node
,
*
removed_node
,
*
temp_node
;
IXMLDOMNode
*
fo_node
,
*
ba_node
,
*
lc_node
,
*
removed_node
,
*
temp_node
;
IXMLDOMNodeList
*
root_list
,
*
fo_list
;
IUnknown
*
unk1
,
*
unk2
;
long
len
;
...
...
@@ -1865,6 +1865,9 @@ static void test_replaceChild(void)
r
=
IXMLDOMElement_get_childNodes
(
element
,
&
root_list
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_item
(
root_list
,
0
,
&
lc_node
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNodeList_get_item
(
root_list
,
3
,
&
fo_node
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
...
...
@@ -1890,13 +1893,14 @@ static void test_replaceChild(void)
/* invalid parameter: OldNode is not a child */
removed_node
=
(
void
*
)
0xdeadbeef
;
r
=
IXMLDOMElement_replaceChild
(
element
,
ba_node
,
ba_node
,
&
removed_node
);
todo_wine
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
if
(
r
==
E_NOTIMPL
)
{
skip
(
"replaceChild not implemented
\n
"
);
return
;
}
r
=
IXMLDOMElement_replaceChild
(
element
,
lc_node
,
ba_node
,
&
removed_node
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
ok
(
removed_node
==
NULL
,
"%p
\n
"
,
removed_node
);
/* invalid parameter: would create loop */
removed_node
=
(
void
*
)
0xdeadbeef
;
r
=
IXMLDOMNode_replaceChild
(
fo_node
,
fo_node
,
ba_node
,
&
removed_node
);
ok
(
r
==
E_FAIL
,
"ret %08x
\n
"
,
r
);
ok
(
removed_node
==
NULL
,
"%p
\n
"
,
removed_node
);
r
=
IXMLDOMElement_replaceChild
(
element
,
ba_node
,
fo_node
,
NULL
);
...
...
@@ -1912,7 +1916,7 @@ static void test_replaceChild(void)
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
r
=
IXMLDOMNode_QueryInterface
(
ba_node
,
&
IID_IUnknown
,
(
void
**
)
&
unk2
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
unk1
==
unk2
,
"unk1 %p unk2 %p
\n
"
,
unk1
,
unk2
);
todo_wine
ok
(
unk1
==
unk2
,
"unk1 %p unk2 %p
\n
"
,
unk1
,
unk2
);
IUnknown_Release
(
unk1
);
IUnknown_Release
(
unk2
);
...
...
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