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
f414d3cf
Commit
f414d3cf
authored
Feb 12, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Reimplement IXMLDOMDocument::createAttribute() on top of ::createNode().
parent
f0e88575
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
37 deletions
+74
-37
domdoc.c
dlls/msxml3/domdoc.c
+24
-20
domdoc.c
dlls/msxml3/tests/domdoc.c
+50
-17
No files found.
dlls/msxml3/domdoc.c
View file @
f414d3cf
...
@@ -1227,29 +1227,25 @@ static HRESULT WINAPI domdoc_createAttribute(
...
@@ -1227,29 +1227,25 @@ static HRESULT WINAPI domdoc_createAttribute(
IXMLDOMAttribute
**
attribute
)
IXMLDOMAttribute
**
attribute
)
{
{
domdoc
*
This
=
impl_from_IXMLDOMDocument2
(
iface
);
domdoc
*
This
=
impl_from_IXMLDOMDocument2
(
iface
);
xmlNodePtr
xmlnode
;
IXMLDOMNode
*
node
;
xmlChar
*
xml_name
;
VARIANT
type
;
HRESULT
hr
;
TRACE
(
"%p->(%s %p)
\n
"
,
iface
,
debugstr_w
(
name
),
attribute
);
if
(
!
attribute
)
return
E_INVALIDARG
;
*
attribute
=
NULL
;
xml_name
=
xmlChar_from_wchar
(
name
);
TRACE
(
"%p->(%s %p)
\n
"
,
This
,
debugstr_w
(
name
),
attribute
);
xmlnode
=
(
xmlNode
*
)
xmlNewProp
(
NULL
,
xml_name
,
NULL
);
heap_free
(
xml_name
);
if
(
!
xmlnode
)
if
(
!
attribute
||
!
name
)
return
E_INVALIDARG
;
return
E_FAIL
;
xmlnode
->
doc
=
get_doc
(
This
)
;
V_VT
(
&
type
)
=
VT_I1
;
xmldoc_add_orphan
(
xmlnode
->
doc
,
xmlnode
)
;
V_I1
(
&
type
)
=
NODE_ATTRIBUTE
;
*
attribute
=
(
IXMLDOMAttribute
*
)
create_attribute
(
xmlnode
);
hr
=
IXMLDOMDocument_createNode
(
iface
,
type
,
name
,
NULL
,
&
node
);
if
(
hr
==
S_OK
)
{
IXMLDOMNode_QueryInterface
(
node
,
&
IID_IXMLDOMAttribute
,
(
void
**
)
attribute
);
IXMLDOMNode_Release
(
node
);
}
return
S_OK
;
return
hr
;
}
}
...
@@ -1356,8 +1352,16 @@ static HRESULT WINAPI domdoc_createNode(
...
@@ -1356,8 +1352,16 @@ static HRESULT WINAPI domdoc_createNode(
TRACE
(
"node_type %d
\n
"
,
node_type
);
TRACE
(
"node_type %d
\n
"
,
node_type
);
if
((
!
name
||
SysStringLen
(
name
)
==
0
)
&&
(
node_type
==
NODE_ELEMENT
))
/* exit earlier for types that need name */
return
E_FAIL
;
switch
(
node_type
)
{
case
NODE_ELEMENT
:
case
NODE_ATTRIBUTE
:
case
NODE_PROCESSING_INSTRUCTION
:
if
(
!
name
||
SysStringLen
(
name
)
==
0
)
return
E_FAIL
;
default:
break
;
}
xml_name
=
xmlChar_from_wchar
(
name
);
xml_name
=
xmlChar_from_wchar
(
name
);
...
...
dlls/msxml3/tests/domdoc.c
View file @
f414d3cf
...
@@ -1864,6 +1864,29 @@ static void test_create(void)
...
@@ -1864,6 +1864,29 @@ static void test_create(void)
ok
(
str
&&
SysStringLen
(
str
)
==
0
,
"expected empty comment, %p
\n
"
,
str
);
ok
(
str
&&
SysStringLen
(
str
)
==
0
,
"expected empty comment, %p
\n
"
,
str
);
IXMLDOMCDATASection_Release
(
cdata
);
IXMLDOMCDATASection_Release
(
cdata
);
/* NODE_ATTRIBUTE */
V_VT
(
&
var
)
=
VT_I1
;
V_I1
(
&
var
)
=
NODE_ATTRIBUTE
;
str
=
SysAllocString
(
szlc
);
node
=
(
IXMLDOMNode
*
)
0x1
;
r
=
IXMLDOMDocument_createNode
(
doc
,
var
,
NULL
,
NULL
,
&
node
);
ok
(
r
==
E_FAIL
,
"returns %08x
\n
"
,
r
);
ok
(
node
==
(
void
*
)
0x1
,
"expected same ptr, got %p
\n
"
,
node
);
V_VT
(
&
var
)
=
VT_I1
;
V_I1
(
&
var
)
=
NODE_ATTRIBUTE
;
node
=
(
IXMLDOMNode
*
)
0x1
;
r
=
IXMLDOMDocument_createNode
(
doc
,
var
,
_bstr_
(
""
),
NULL
,
&
node
);
ok
(
r
==
E_FAIL
,
"returns %08x
\n
"
,
r
);
ok
(
node
==
(
void
*
)
0x1
,
"expected same ptr, got %p
\n
"
,
node
);
V_VT
(
&
var
)
=
VT_I1
;
V_I1
(
&
var
)
=
NODE_ATTRIBUTE
;
str
=
SysAllocString
(
szlc
);
r
=
IXMLDOMDocument_createNode
(
doc
,
var
,
str
,
NULL
,
&
node
);
ok
(
r
==
S_OK
,
"returns %08x
\n
"
,
r
);
if
(
SUCCEEDED
(
r
)
)
IXMLDOMNode_Release
(
node
);
/* NODE_ELEMENT */
/* NODE_ELEMENT */
V_VT
(
&
var
)
=
VT_I1
;
V_VT
(
&
var
)
=
VT_I1
;
V_I1
(
&
var
)
=
NODE_ELEMENT
;
V_I1
(
&
var
)
=
NODE_ELEMENT
;
...
@@ -2965,7 +2988,7 @@ static void test_xmlTypes(void)
...
@@ -2965,7 +2988,7 @@ static void test_xmlTypes(void)
HRESULT
hr
;
HRESULT
hr
;
IXMLDOMComment
*
pComment
;
IXMLDOMComment
*
pComment
;
IXMLDOMElement
*
pElement
;
IXMLDOMElement
*
pElement
;
IXMLDOMAttribute
*
pAttr
u
bute
;
IXMLDOMAttribute
*
pAttr
i
bute
;
IXMLDOMNamedNodeMap
*
pAttribs
;
IXMLDOMNamedNodeMap
*
pAttribs
;
IXMLDOMCDATASection
*
pCDataSec
;
IXMLDOMCDATASection
*
pCDataSec
;
IXMLDOMImplementation
*
pIXMLDOMImplementation
=
NULL
;
IXMLDOMImplementation
*
pIXMLDOMImplementation
=
NULL
;
...
@@ -3369,41 +3392,51 @@ static void test_xmlTypes(void)
...
@@ -3369,41 +3392,51 @@ static void test_xmlTypes(void)
VariantClear
(
&
v
);
VariantClear
(
&
v
);
/* Attribute */
/* Attribute */
pAttribute
=
(
IXMLDOMAttribute
*
)
0x1
;
hr
=
IXMLDOMDocument_createAttribute
(
doc
,
NULL
,
&
pAttribute
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
ok
(
pAttribute
==
(
void
*
)
0x1
,
"Expect same ptr, got %p
\n
"
,
pAttribute
);
pAttribute
=
(
IXMLDOMAttribute
*
)
0x1
;
hr
=
IXMLDOMDocument_createAttribute
(
doc
,
_bstr_
(
""
),
&
pAttribute
);
ok
(
hr
==
E_FAIL
,
"ret %08x
\n
"
,
hr
);
ok
(
pAttribute
==
(
void
*
)
0x1
,
"Expect same ptr, got %p
\n
"
,
pAttribute
);
str
=
SysAllocString
(
szAttribute
);
str
=
SysAllocString
(
szAttribute
);
hr
=
IXMLDOMDocument_createAttribute
(
doc
,
str
,
&
pAttr
u
bute
);
hr
=
IXMLDOMDocument_createAttribute
(
doc
,
str
,
&
pAttr
i
bute
);
SysFreeString
(
str
);
SysFreeString
(
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
IXMLDOMNode
*
pNewChild
=
(
IXMLDOMNode
*
)
0x1
;
IXMLDOMNode
*
pNewChild
=
(
IXMLDOMNode
*
)
0x1
;
hr
=
IXMLDOMAttribute_get_nextSibling
(
pAttr
u
bute
,
NULL
);
hr
=
IXMLDOMAttribute_get_nextSibling
(
pAttr
i
bute
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
pNextChild
=
(
IXMLDOMNode
*
)
0x1
;
pNextChild
=
(
IXMLDOMNode
*
)
0x1
;
hr
=
IXMLDOMAttribute_get_nextSibling
(
pAttr
u
bute
,
&
pNextChild
);
hr
=
IXMLDOMAttribute_get_nextSibling
(
pAttr
i
bute
,
&
pNextChild
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
pNextChild
==
NULL
,
"pNextChild not NULL
\n
"
);
ok
(
pNextChild
==
NULL
,
"pNextChild not NULL
\n
"
);
/* test Previous Sibling*/
/* test Previous Sibling*/
hr
=
IXMLDOMAttribute_get_previousSibling
(
pAttr
u
bute
,
NULL
);
hr
=
IXMLDOMAttribute_get_previousSibling
(
pAttr
i
bute
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"ret %08x
\n
"
,
hr
);
pNextChild
=
(
IXMLDOMNode
*
)
0x1
;
pNextChild
=
(
IXMLDOMNode
*
)
0x1
;
hr
=
IXMLDOMAttribute_get_previousSibling
(
pAttr
u
bute
,
&
pNextChild
);
hr
=
IXMLDOMAttribute_get_previousSibling
(
pAttr
i
bute
,
&
pNextChild
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
pNextChild
==
NULL
,
"pNextChild not NULL
\n
"
);
ok
(
pNextChild
==
NULL
,
"pNextChild not NULL
\n
"
);
/* test get_attributes */
/* test get_attributes */
hr
=
IXMLDOMAttribute_get_attributes
(
pAttr
u
bute
,
NULL
);
hr
=
IXMLDOMAttribute_get_attributes
(
pAttr
i
bute
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"get_attributes returned wrong code
\n
"
);
ok
(
hr
==
E_INVALIDARG
,
"get_attributes returned wrong code
\n
"
);
pAttribs
=
(
IXMLDOMNamedNodeMap
*
)
0x1
;
pAttribs
=
(
IXMLDOMNamedNodeMap
*
)
0x1
;
hr
=
IXMLDOMAttribute_get_attributes
(
pAttr
u
bute
,
&
pAttribs
);
hr
=
IXMLDOMAttribute_get_attributes
(
pAttr
i
bute
,
&
pAttribs
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
pAttribs
==
NULL
,
"pAttribs not NULL
\n
"
);
ok
(
pAttribs
==
NULL
,
"pAttribs not NULL
\n
"
);
hr
=
IXMLDOMElement_appendChild
(
pElement
,
(
IXMLDOMNode
*
)
pAttr
u
bute
,
&
pNewChild
);
hr
=
IXMLDOMElement_appendChild
(
pElement
,
(
IXMLDOMNode
*
)
pAttr
i
bute
,
&
pNewChild
);
ok
(
hr
==
E_FAIL
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
E_FAIL
,
"ret %08x
\n
"
,
hr
);
ok
(
pNewChild
==
NULL
,
"pNewChild not NULL
\n
"
);
ok
(
pNewChild
==
NULL
,
"pNewChild not NULL
\n
"
);
...
@@ -3411,46 +3444,46 @@ static void test_xmlTypes(void)
...
@@ -3411,46 +3444,46 @@ static void test_xmlTypes(void)
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
hr
=
IXMLDOMNamedNodeMap_setNamedItem
(
pAttribs
,
(
IXMLDOMNode
*
)
pAttr
u
bute
,
NULL
);
hr
=
IXMLDOMNamedNodeMap_setNamedItem
(
pAttribs
,
(
IXMLDOMNode
*
)
pAttr
i
bute
,
NULL
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMNamedNodeMap_Release
(
pAttribs
);
IXMLDOMNamedNodeMap_Release
(
pAttribs
);
}
}
hr
=
IXMLDOMAttribute_get_nodeName
(
pAttr
u
bute
,
&
str
);
hr
=
IXMLDOMAttribute_get_nodeName
(
pAttr
i
bute
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect attribute node Name
\n
"
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect attribute node Name
\n
"
);
SysFreeString
(
str
);
SysFreeString
(
str
);
/* test nodeTypeString */
/* test nodeTypeString */
hr
=
IXMLDOMAttribute_get_nodeTypeString
(
pAttr
u
bute
,
&
str
);
hr
=
IXMLDOMAttribute_get_nodeTypeString
(
pAttr
i
bute
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"attribute"
)
),
"incorrect nodeTypeString string
\n
"
);
ok
(
!
lstrcmpW
(
str
,
_bstr_
(
"attribute"
)
),
"incorrect nodeTypeString string
\n
"
);
SysFreeString
(
str
);
SysFreeString
(
str
);
/* test nodeName */
/* test nodeName */
hr
=
IXMLDOMAttribute_get_nodeName
(
pAttr
u
bute
,
&
str
);
hr
=
IXMLDOMAttribute_get_nodeName
(
pAttr
i
bute
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect nodeName string
\n
"
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect nodeName string
\n
"
);
SysFreeString
(
str
);
SysFreeString
(
str
);
/* test name property */
/* test name property */
hr
=
IXMLDOMAttribute_get_name
(
pAttr
u
bute
,
&
str
);
hr
=
IXMLDOMAttribute_get_name
(
pAttr
i
bute
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect name string
\n
"
);
ok
(
!
lstrcmpW
(
str
,
szAttribute
),
"incorrect name string
\n
"
);
SysFreeString
(
str
);
SysFreeString
(
str
);
hr
=
IXMLDOMAttribute_get_xml
(
pAttr
u
bute
,
&
str
);
hr
=
IXMLDOMAttribute_get_xml
(
pAttr
i
bute
,
&
str
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
szAttributeXML
),
"incorrect attribute xml
\n
"
);
ok
(
!
lstrcmpW
(
str
,
szAttributeXML
),
"incorrect attribute xml
\n
"
);
SysFreeString
(
str
);
SysFreeString
(
str
);
hr
=
IXMLDOMAttribute_get_dataType
(
pAttr
u
bute
,
&
v
);
hr
=
IXMLDOMAttribute_get_dataType
(
pAttr
i
bute
,
&
v
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
v
)
==
VT_NULL
,
"incorrect dataType type
\n
"
);
ok
(
V_VT
(
&
v
)
==
VT_NULL
,
"incorrect dataType type
\n
"
);
VariantClear
(
&
v
);
VariantClear
(
&
v
);
IXMLDOMAttribute_Release
(
pAttr
u
bute
);
IXMLDOMAttribute_Release
(
pAttr
i
bute
);
/* Check Element again with the Add Attribute*/
/* Check Element again with the Add Attribute*/
hr
=
IXMLDOMElement_get_xml
(
pElement
,
&
str
);
hr
=
IXMLDOMElement_get_xml
(
pElement
,
&
str
);
...
...
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