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
50c64c04
Commit
50c64c04
authored
Jan 11, 2006
by
Huw Davies
Committed by
Alexandre Julliard
Jan 11, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml: Implement createNode, appendChild and insertAfter.
parent
dc6ca178
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
7 deletions
+171
-7
domdoc.c
dlls/msxml3/domdoc.c
+47
-3
node.c
dlls/msxml3/node.c
+54
-4
domdoc.c
dlls/msxml3/tests/domdoc.c
+70
-0
No files found.
dlls/msxml3/domdoc.c
View file @
50c64c04
...
...
@@ -657,6 +657,14 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
return
E_NOTIMPL
;
}
static
DOMNodeType
get_node_type
(
VARIANT
Type
)
{
if
(
V_VT
(
&
Type
)
==
VT_I4
)
return
V_I4
(
&
Type
);
FIXME
(
"Unsupported variant type %x
\n
"
,
V_VT
(
&
Type
));
return
0
;
}
static
HRESULT
WINAPI
domdoc_createNode
(
IXMLDOMDocument
*
iface
,
...
...
@@ -665,10 +673,46 @@ static HRESULT WINAPI domdoc_createNode(
BSTR
namespaceURI
,
IXMLDOMNode
**
node
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
domdoc
*
This
=
impl_from_IXMLDOMDocument
(
iface
);
DOMNodeType
node_type
;
xmlNodePtr
xmlnode
=
NULL
;
xmlChar
*
xml_name
;
xmlDocPtr
xmldoc
;
TRACE
(
"(%p)->(type,%s,%s,%p)
\n
"
,
This
,
debugstr_w
(
name
),
debugstr_w
(
namespaceURI
),
node
);
node_type
=
get_node_type
(
Type
);
TRACE
(
"node_type %d
\n
"
,
node_type
);
xml_name
=
xmlChar_from_wchar
((
WCHAR
*
)
name
);
if
(
!
get_doc
(
This
))
{
xmldoc
=
xmlNewDoc
(
NULL
);
xmldoc
->
_private
=
0
;
attach_xmlnode
(
This
->
node
,
(
xmlNodePtr
)
xmldoc
);
}
switch
(
node_type
)
{
case
NODE_ELEMENT
:
xmlnode
=
xmlNewDocNode
(
get_doc
(
This
),
NULL
,
xml_name
,
NULL
);
*
node
=
create_node
(
xmlnode
);
TRACE
(
"created %p
\n
"
,
xmlnode
);
break
;
default:
FIXME
(
"unhandled node type %d
\n
"
,
node_type
);
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
xml_name
);
if
(
xmlnode
&&
*
node
)
return
S_OK
;
return
E_FAIL
;
}
static
HRESULT
WINAPI
domdoc_nodeFromID
(
IXMLDOMDocument
*
iface
,
...
...
dlls/msxml3/node.c
View file @
50c64c04
...
...
@@ -375,8 +375,54 @@ static HRESULT WINAPI xmlnode_insertBefore(
VARIANT
refChild
,
IXMLDOMNode
**
outNewChild
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
xmlnode
*
This
=
impl_from_IXMLDOMNode
(
iface
);
xmlNodePtr
before_node
,
new_child_node
;
IXMLDOMNode
*
before
=
NULL
,
*
new
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p,var,%p)
\n
"
,
This
,
newChild
,
outNewChild
);
switch
(
V_VT
(
&
refChild
))
{
case
VT_EMPTY
:
case
VT_NULL
:
break
;
case
VT_UNKNOWN
:
hr
=
IUnknown_QueryInterface
(
V_UNKNOWN
(
&
refChild
),
&
IID_IXMLDOMNode
,
(
LPVOID
)
&
before
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
case
VT_DISPATCH
:
hr
=
IDispatch_QueryInterface
(
V_DISPATCH
(
&
refChild
),
&
IID_IXMLDOMNode
,
(
LPVOID
)
&
before
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
default:
FIXME
(
"refChild var type %x
\n
"
,
V_VT
(
&
refChild
));
return
E_FAIL
;
}
IXMLDOMNode_QueryInterface
(
newChild
,
&
IID_IXMLDOMNode
,
(
LPVOID
)
&
new
);
new_child_node
=
impl_from_IXMLDOMNode
(
new
)
->
node
;
TRACE
(
"new_child_node %p This->node %p
\n
"
,
new_child_node
,
This
->
node
);
if
(
before
)
{
before_node
=
impl_from_IXMLDOMNode
(
before
)
->
node
;
xmlAddPrevSibling
(
before_node
,
new_child_node
);
IXMLDOMNode_Release
(
before
);
}
else
{
xmlAddChild
(
This
->
node
,
new_child_node
);
}
IXMLDOMNode_Release
(
new
);
IXMLDOMNode_AddRef
(
newChild
);
*
outNewChild
=
newChild
;
TRACE
(
"ret S_OK
\n
"
);
return
S_OK
;
}
static
HRESULT
WINAPI
xmlnode_replaceChild
(
...
...
@@ -403,8 +449,12 @@ static HRESULT WINAPI xmlnode_appendChild(
IXMLDOMNode
*
newChild
,
IXMLDOMNode
**
outNewChild
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
xmlnode
*
This
=
impl_from_IXMLDOMNode
(
iface
);
VARIANT
var
;
TRACE
(
"(%p)->(%p,%p)
\n
"
,
This
,
newChild
,
outNewChild
);
VariantInit
(
&
var
);
return
IXMLDOMNode_insertBefore
(
iface
,
newChild
,
var
,
outNewChild
);
}
static
HRESULT
WINAPI
xmlnode_hasChildNodes
(
...
...
dlls/msxml3/tests/domdoc.c
View file @
50c64c04
...
...
@@ -598,6 +598,75 @@ static void test_refs(void)
}
static
void
test_create
(
void
)
{
HRESULT
r
;
VARIANT
var
;
BSTR
str
;
IXMLDOMDocument
*
doc
;
IXMLDOMNode
*
root
,
*
node
,
*
child
;
IUnknown
*
unk
;
LONG
ref
;
r
=
CoCreateInstance
(
&
CLSID_DOMDocument
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IXMLDOMDocument
,
(
LPVOID
*
)
&
doc
);
if
(
r
!=
S_OK
)
return
;
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
NODE_ELEMENT
;
str
=
SysAllocString
(
szlc
);
r
=
IXMLDOMDocument_createNode
(
doc
,
var
,
str
,
NULL
,
&
node
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
r
=
IXMLDOMDocument_appendChild
(
doc
,
node
,
&
root
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
ok
(
node
==
root
,
"%p %p
\n
"
,
node
,
root
);
ref
=
IXMLDOMNode_AddRef
(
node
);
ok
(
ref
==
3
,
"ref %ld
\n
"
,
ref
);
IXMLDOMNode_Release
(
node
);
ref
=
IXMLDOMNode_Release
(
node
);
ok
(
ref
==
1
,
"ref %ld
\n
"
,
ref
);
SysFreeString
(
str
);
V_VT
(
&
var
)
=
VT_I4
;
V_I4
(
&
var
)
=
NODE_ELEMENT
;
str
=
SysAllocString
(
szbs
);
r
=
IXMLDOMDocument_createNode
(
doc
,
var
,
str
,
NULL
,
&
node
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
ref
=
IXMLDOMNode_AddRef
(
node
);
ok
(
ref
==
2
,
"ref = %ld
\n
"
,
ref
);
IXMLDOMNode_Release
(
node
);
r
=
IXMLDOMNode_QueryInterface
(
node
,
&
IID_IUnknown
,
(
LPVOID
*
)
&
unk
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
ref
=
IXMLDOMNode_AddRef
(
unk
);
ok
(
ref
==
3
,
"ref = %ld
\n
"
,
ref
);
IXMLDOMNode_Release
(
unk
);
V_VT
(
&
var
)
=
VT_EMPTY
;
r
=
IXMLDOMNode_insertBefore
(
root
,
(
IXMLDOMNode
*
)
unk
,
var
,
&
child
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
ok
(
unk
==
(
IUnknown
*
)
child
,
"%p %p
\n
"
,
unk
,
child
);
IXMLDOMNode_Release
(
child
);
IUnknown_Release
(
unk
);
V_VT
(
&
var
)
=
VT_NULL
;
V_DISPATCH
(
&
var
)
=
(
IDispatch
*
)
node
;
r
=
IXMLDOMNode_insertBefore
(
root
,
node
,
var
,
&
child
);
ok
(
r
==
S_OK
,
"returns %08lx
\n
"
,
r
);
ok
(
node
==
child
,
"%p %p
\n
"
,
node
,
child
);
IXMLDOMNode_Release
(
child
);
IXMLDOMNode_Release
(
node
);
IXMLDOMNode_Release
(
root
);
IXMLDOMDocument_Release
(
doc
);
}
START_TEST
(
domdoc
)
{
HRESULT
r
;
...
...
@@ -608,6 +677,7 @@ START_TEST(domdoc)
test_domdoc
();
test_domnode
();
test_refs
();
test_create
();
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