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
86af5b97
Commit
86af5b97
authored
Dec 03, 2007
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Dec 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Implement cloneNode.
parent
f945f16d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
2 deletions
+157
-2
node.c
dlls/msxml3/node.c
+30
-2
domdoc.c
dlls/msxml3/tests/domdoc.c
+127
-0
No files found.
dlls/msxml3/node.c
View file @
86af5b97
...
...
@@ -519,8 +519,36 @@ static HRESULT WINAPI xmlnode_cloneNode(
VARIANT_BOOL
deep
,
IXMLDOMNode
**
cloneRoot
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
xmlnode
*
This
=
impl_from_IXMLDOMNode
(
iface
);
xmlNodePtr
pClone
=
NULL
;
IXMLDOMNode
*
pNode
=
NULL
;
TRACE
(
"%p (%d)
\n
"
,
This
,
deep
);
if
(
!
cloneRoot
)
return
E_INVALIDARG
;
pClone
=
xmlCopyNode
(
This
->
node
,
deep
?
1
:
2
);
if
(
pClone
)
{
pClone
->
doc
=
This
->
node
->
doc
;
pNode
=
create_node
(
pClone
);
if
(
!
pNode
)
{
ERR
(
"Copy failed
\n
"
);
return
E_FAIL
;
}
*
cloneRoot
=
pNode
;
}
else
{
ERR
(
"Copy failed
\n
"
);
return
E_FAIL
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
xmlnode_get_nodeTypeString
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
86af5b97
...
...
@@ -1594,6 +1594,132 @@ static void test_XPath(void)
free_bstrs
();
}
static
void
test_cloneNode
(
void
)
{
IXMLDOMDocument
*
doc
=
NULL
;
VARIANT_BOOL
b
;
IXMLDOMNodeList
*
pList
;
IXMLDOMNamedNodeMap
*
mapAttr
;
long
nLength
=
0
,
nLength1
=
0
;
long
nAttrCnt
=
0
,
nAttrCnt1
=
0
;
IXMLDOMNode
*
node
;
IXMLDOMNode
*
node_clone
;
HRESULT
r
;
BSTR
str
;
r
=
CoCreateInstance
(
&
CLSID_DOMDocument
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IXMLDOMDocument2
,
(
LPVOID
*
)
&
doc
);
if
(
r
!=
S_OK
)
return
;
str
=
SysAllocString
(
szComplete4
);
ole_check
(
IXMLDOMDocument_loadXML
(
doc
,
str
,
&
b
));
ok
(
b
==
VARIANT_TRUE
,
"failed to load XML string
\n
"
);
SysFreeString
(
str
);
if
(
!
b
)
return
;
r
=
IXMLDOMNode_selectSingleNode
(
doc
,
_bstr_
(
"lc/pr"
),
&
node
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
node
!=
NULL
,
"node %p
\n
"
,
node
);
if
(
!
node
)
{
IXMLDOMDocument_Release
(
doc
);
return
;
}
/* Check invalid parameter */
r
=
IXMLDOMNode_cloneNode
(
node
,
VARIANT_TRUE
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
/* All Children */
r
=
IXMLDOMNode_cloneNode
(
node
,
VARIANT_TRUE
,
&
node_clone
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
node_clone
!=
NULL
,
"node %p
\n
"
,
node
);
if
(
!
node_clone
)
{
IXMLDOMDocument_Release
(
doc
);
IXMLDOMNode_Release
(
node
);
return
;
}
r
=
IXMLDOMNode_get_childNodes
(
node
,
&
pList
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
pList
)
{
IXMLDOMNodeList_get_length
(
pList
,
&
nLength
);
IXMLDOMNodeList_Release
(
pList
);
}
r
=
IXMLDOMNode_get_attributes
(
node
,
&
mapAttr
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
mapAttr
)
{
IXMLDOMNamedNodeMap_get_length
(
mapAttr
,
&
nAttrCnt
);
IXMLDOMNamedNodeMap_Release
(
mapAttr
);
}
r
=
IXMLDOMNode_get_childNodes
(
node_clone
,
&
pList
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
pList
)
{
IXMLDOMNodeList_get_length
(
pList
,
&
nLength1
);
IXMLDOMNodeList_Release
(
pList
);
}
r
=
IXMLDOMNode_get_attributes
(
node_clone
,
&
mapAttr
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
mapAttr
)
{
IXMLDOMNamedNodeMap_get_length
(
mapAttr
,
&
nAttrCnt1
);
IXMLDOMNamedNodeMap_Release
(
mapAttr
);
}
ok
(
nLength
==
nLength1
,
"wrong Child count (%ld, %ld)
\n
"
,
nLength
,
nLength1
);
ok
(
nAttrCnt
==
nAttrCnt1
,
"wrong Attribute count (%ld, %ld)
\n
"
,
nAttrCnt
,
nAttrCnt1
);
IXMLDOMNode_Release
(
node_clone
);
/* No Children */
r
=
IXMLDOMNode_cloneNode
(
node
,
VARIANT_FALSE
,
&
node_clone
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
ok
(
node_clone
!=
NULL
,
"node %p
\n
"
,
node
);
if
(
!
node_clone
)
{
IXMLDOMDocument_Release
(
doc
);
IXMLDOMNode_Release
(
node
);
return
;
}
r
=
IXMLDOMNode_get_childNodes
(
node_clone
,
&
pList
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
pList
)
{
IXMLDOMNodeList_get_length
(
pList
,
&
nLength1
);
ok
(
nLength1
==
0
,
"Length should be 0 (%ld)
\n
"
,
nLength1
);
IXMLDOMNodeList_Release
(
pList
);
}
r
=
IXMLDOMNode_get_attributes
(
node_clone
,
&
mapAttr
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
if
(
mapAttr
)
{
IXMLDOMNamedNodeMap_get_length
(
mapAttr
,
&
nAttrCnt1
);
ok
(
nAttrCnt1
==
3
,
"Attribute count should be 3 (%ld)
\n
"
,
nAttrCnt1
);
IXMLDOMNamedNodeMap_Release
(
mapAttr
);
}
ok
(
nLength
!=
nLength1
,
"wrong Child count (%ld, %ld)
\n
"
,
nLength
,
nLength1
);
ok
(
nAttrCnt
==
nAttrCnt1
,
"wrong Attribute count (%ld, %ld)
\n
"
,
nAttrCnt
,
nAttrCnt1
);
IXMLDOMNode_Release
(
node_clone
);
IXMLDOMNode_Release
(
node
);
IXMLDOMDocument_Release
(
doc
);
}
START_TEST
(
domdoc
)
{
HRESULT
r
;
...
...
@@ -1612,6 +1738,7 @@ START_TEST(domdoc)
test_XMLHTTP
();
test_IXMLDOMDocument2
();
test_XPath
();
test_cloneNode
();
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