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
0adfd6cf
Commit
0adfd6cf
authored
Sep 04, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/domdoc: Implement IXMLDOMNamedNodeMap::removeQualifiedItem().
parent
e7bfb98e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
44 deletions
+125
-44
nodemap.c
dlls/msxml3/nodemap.c
+57
-42
domdoc.c
dlls/msxml3/tests/domdoc.c
+68
-2
No files found.
dlls/msxml3/nodemap.c
View file @
0adfd6cf
...
...
@@ -250,43 +250,8 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem(
IXMLDOMNode
**
namedItem
)
{
xmlnodemap
*
This
=
impl_from_IXMLDOMNamedNodeMap
(
iface
);
xmlChar
*
element_name
;
xmlAttrPtr
attr
;
xmlNodePtr
node
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
name
),
namedItem
);
if
(
!
name
)
return
E_INVALIDARG
;
node
=
xmlNodePtr_from_domnode
(
This
->
node
,
0
);
if
(
!
node
)
return
E_FAIL
;
element_name
=
xmlChar_from_wchar
(
name
);
attr
=
xmlHasNsProp
(
node
,
element_name
,
NULL
);
heap_free
(
element_name
);
if
(
!
attr
)
{
if
(
namedItem
)
*
namedItem
=
NULL
;
return
S_FALSE
;
}
if
(
namedItem
)
{
xmlUnlinkNode
(
(
xmlNodePtr
)
attr
);
xmldoc_add_orphan
(
attr
->
doc
,
(
xmlNodePtr
)
attr
);
*
namedItem
=
create_node
(
(
xmlNodePtr
)
attr
);
}
else
{
if
(
xmlRemoveProp
(
attr
)
==
-
1
)
ERR
(
"xmlRemoveProp failed
\n
"
);
}
return
S_OK
;
return
IXMLDOMNamedNodeMap_removeQualifiedItem
(
iface
,
name
,
NULL
,
namedItem
);
}
static
HRESULT
WINAPI
xmlnodemap_get_item
(
...
...
@@ -394,6 +359,10 @@ static HRESULT WINAPI xmlnodemap_getQualifiedItem(
}
attr
=
xmlHasNsProp
(
node
,
name
,
href
);
heap_free
(
name
);
heap_free
(
href
);
if
(
!
attr
)
{
*
qualifiedItem
=
NULL
;
...
...
@@ -402,9 +371,6 @@ static HRESULT WINAPI xmlnodemap_getQualifiedItem(
*
qualifiedItem
=
create_node
((
xmlNodePtr
)
attr
);
heap_free
(
name
);
heap_free
(
href
);
return
S_OK
;
}
...
...
@@ -415,8 +381,58 @@ static HRESULT WINAPI xmlnodemap_removeQualifiedItem(
IXMLDOMNode
**
qualifiedItem
)
{
xmlnodemap
*
This
=
impl_from_IXMLDOMNamedNodeMap
(
iface
);
FIXME
(
"(%p)->(%s %s %p)
\n
"
,
This
,
debugstr_w
(
baseName
),
debugstr_w
(
namespaceURI
),
qualifiedItem
);
return
E_NOTIMPL
;
xmlAttrPtr
attr
;
xmlNodePtr
node
;
xmlChar
*
name
;
xmlChar
*
href
;
TRACE
(
"(%p)->(%s %s %p)
\n
"
,
This
,
debugstr_w
(
baseName
),
debugstr_w
(
namespaceURI
),
qualifiedItem
);
if
(
!
baseName
)
return
E_INVALIDARG
;
node
=
xmlNodePtr_from_domnode
(
This
->
node
,
XML_ELEMENT_NODE
);
if
(
!
node
)
return
E_FAIL
;
if
(
namespaceURI
&&
*
namespaceURI
)
{
href
=
xmlChar_from_wchar
(
namespaceURI
);
if
(
!
href
)
return
E_OUTOFMEMORY
;
}
else
href
=
NULL
;
name
=
xmlChar_from_wchar
(
baseName
);
if
(
!
name
)
{
heap_free
(
href
);
return
E_OUTOFMEMORY
;
}
attr
=
xmlHasNsProp
(
node
,
name
,
href
);
heap_free
(
name
);
heap_free
(
href
);
if
(
!
attr
)
{
if
(
qualifiedItem
)
*
qualifiedItem
=
NULL
;
return
S_FALSE
;
}
if
(
qualifiedItem
)
{
xmlUnlinkNode
(
(
xmlNodePtr
)
attr
);
xmldoc_add_orphan
(
attr
->
doc
,
(
xmlNodePtr
)
attr
);
*
qualifiedItem
=
create_node
(
(
xmlNodePtr
)
attr
);
}
else
{
if
(
xmlRemoveProp
(
attr
)
==
-
1
)
ERR
(
"xmlRemoveProp failed
\n
"
);
}
return
S_OK
;
}
static
HRESULT
WINAPI
xmlnodemap_nextNode
(
...
...
@@ -497,7 +513,6 @@ static HRESULT WINAPI support_error_QueryInterface(
{
xmlnodemap
*
This
=
impl_from_ISupportErrorInfo
(
iface
);
TRACE
(
"%p %s %p
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppvObject
);
return
IXMLDOMNamedNodeMap_QueryInterface
((
IXMLDOMNamedNodeMap
*
)
&
This
->
lpVtbl
,
riid
,
ppvObject
);
}
...
...
dlls/msxml3/tests/domdoc.c
View file @
0adfd6cf
...
...
@@ -2791,7 +2791,7 @@ static void test_removeNamedItem(void)
removed_node
=
(
void
*
)
0xdeadbeef
;
r
=
IXMLDOMNamedNodeMap_removeNamedItem
(
pr_attrs
,
NULL
,
&
removed_node
);
ok
(
r
==
E_INVALIDARG
,
"ret %08x
\n
"
,
r
);
ok
(
removed_node
==
(
void
*
)
0xdeadbeef
,
"
removed_node ==
%p
\n
"
,
removed_node
);
ok
(
removed_node
==
(
void
*
)
0xdeadbeef
,
"
got
%p
\n
"
,
removed_node
);
removed_node
=
(
void
*
)
0xdeadbeef
;
str
=
SysAllocString
(
szvr
);
...
...
@@ -2801,7 +2801,7 @@ static void test_removeNamedItem(void)
removed_node2
=
(
void
*
)
0xdeadbeef
;
r
=
IXMLDOMNamedNodeMap_removeNamedItem
(
pr_attrs
,
str
,
&
removed_node2
);
ok
(
r
==
S_FALSE
,
"ret %08x
\n
"
,
r
);
ok
(
removed_node2
==
NULL
,
"
removed_node ==
%p
\n
"
,
removed_node2
);
ok
(
removed_node2
==
NULL
,
"
got
%p
\n
"
,
removed_node2
);
r
=
IXMLDOMNamedNodeMap_get_length
(
pr_attrs
,
&
len
);
ok
(
r
==
S_OK
,
"ret %08x
\n
"
,
r
);
...
...
@@ -5789,6 +5789,71 @@ static void test_getQualifiedItem(void)
free_bstrs
();
}
static
void
test_removeQualifiedItem
(
void
)
{
IXMLDOMDocument
*
doc
;
IXMLDOMElement
*
element
;
IXMLDOMNode
*
pr_node
,
*
node
;
IXMLDOMNodeList
*
root_list
;
IXMLDOMNamedNodeMap
*
map
;
VARIANT_BOOL
b
;
BSTR
str
;
LONG
len
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
if
(
!
doc
)
return
;
str
=
SysAllocString
(
szComplete4
);
hr
=
IXMLDOMDocument_loadXML
(
doc
,
str
,
&
b
);
ok
(
hr
==
S_OK
,
"loadXML failed
\n
"
);
ok
(
b
==
VARIANT_TRUE
,
"failed to load XML string
\n
"
);
SysFreeString
(
str
);
hr
=
IXMLDOMDocument_get_documentElement
(
doc
,
&
element
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMElement_get_childNodes
(
element
,
&
root_list
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMNodeList_get_item
(
root_list
,
1
,
&
pr_node
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMNodeList_Release
(
root_list
);
hr
=
IXMLDOMNode_get_attributes
(
pr_node
,
&
map
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMNode_Release
(
pr_node
);
hr
=
IXMLDOMNamedNodeMap_get_length
(
map
,
&
len
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
len
==
3
,
"length %d
\n
"
,
len
);
hr
=
IXMLDOMNamedNodeMap_removeQualifiedItem
(
map
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
node
=
(
void
*
)
0xdeadbeef
;
hr
=
IXMLDOMNamedNodeMap_removeQualifiedItem
(
map
,
NULL
,
NULL
,
&
node
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
ok
(
node
==
(
void
*
)
0xdeadbeef
,
"got %p
\n
"
,
node
);
/* out pointer is optional */
hr
=
IXMLDOMNamedNodeMap_removeQualifiedItem
(
map
,
_bstr_
(
"id"
),
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
/* already removed */
hr
=
IXMLDOMNamedNodeMap_removeQualifiedItem
(
map
,
_bstr_
(
"id"
),
NULL
,
NULL
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMNamedNodeMap_removeQualifiedItem
(
map
,
_bstr_
(
"vr"
),
NULL
,
&
node
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMNode_Release
(
node
);
IXMLDOMNamedNodeMap_Release
(
map
);
IXMLDOMElement_Release
(
element
);
IXMLDOMDocument_Release
(
doc
);
free_bstrs
();
}
START_TEST
(
domdoc
)
{
IXMLDOMDocument
*
doc
;
...
...
@@ -5840,6 +5905,7 @@ START_TEST(domdoc)
test_document_IObjectSafety
();
test_splitText
();
test_getQualifiedItem
();
test_removeQualifiedItem
();
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