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
8f976c5d
Commit
8f976c5d
authored
Nov 04, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 05, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Encode special characters while setting attribute content.
parent
9dedc4a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
1 deletion
+68
-1
attribute.c
dlls/msxml3/attribute.c
+1
-1
msxml_private.h
dlls/msxml3/msxml_private.h
+1
-0
node.c
dlls/msxml3/node.c
+41
-0
domdoc.c
dlls/msxml3/tests/domdoc.c
+25
-0
No files found.
dlls/msxml3/attribute.c
View file @
8f976c5d
...
...
@@ -207,7 +207,7 @@ static HRESULT WINAPI domattr_put_nodeValue(
TRACE
(
"(%p)->(v%d)
\n
"
,
This
,
V_VT
(
&
value
));
return
node_put_value
(
&
This
->
node
,
&
value
);
return
node_put_value
_escaped
(
&
This
->
node
,
&
value
);
}
static
HRESULT
WINAPI
domattr_get_nodeType
(
...
...
dlls/msxml3/msxml_private.h
View file @
8f976c5d
...
...
@@ -184,6 +184,7 @@ extern HRESULT node_get_nodeName(xmlnode*,BSTR*);
extern
HRESULT
node_get_content
(
xmlnode
*
,
VARIANT
*
);
extern
HRESULT
node_set_content
(
xmlnode
*
,
LPCWSTR
);
extern
HRESULT
node_put_value
(
xmlnode
*
,
VARIANT
*
);
extern
HRESULT
node_put_value_escaped
(
xmlnode
*
,
VARIANT
*
);
extern
HRESULT
node_get_parent
(
xmlnode
*
,
IXMLDOMNode
**
);
extern
HRESULT
node_get_child_nodes
(
xmlnode
*
,
IXMLDOMNodeList
**
);
extern
HRESULT
node_get_first_child
(
xmlnode
*
,
IXMLDOMNode
**
);
...
...
dlls/msxml3/node.c
View file @
8f976c5d
...
...
@@ -151,6 +151,29 @@ HRESULT node_set_content(xmlnode *This, LPCWSTR value)
return
S_OK
;
}
static
HRESULT
node_set_content_escaped
(
xmlnode
*
This
,
LPCWSTR
value
)
{
xmlChar
*
str
,
*
escaped
;
str
=
xmlChar_from_wchar
(
value
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
escaped
=
xmlEncodeSpecialChars
(
NULL
,
str
);
if
(
!
escaped
)
{
heap_free
(
str
);
return
E_OUTOFMEMORY
;
}
xmlNodeSetContent
(
This
->
node
,
escaped
);
heap_free
(
str
);
xmlFree
(
escaped
);
return
S_OK
;
}
HRESULT
node_put_value
(
xmlnode
*
This
,
VARIANT
*
value
)
{
VARIANT
string_value
;
...
...
@@ -169,6 +192,24 @@ HRESULT node_put_value(xmlnode *This, VARIANT *value)
return
S_OK
;
}
HRESULT
node_put_value_escaped
(
xmlnode
*
This
,
VARIANT
*
value
)
{
VARIANT
string_value
;
HRESULT
hr
;
VariantInit
(
&
string_value
);
hr
=
VariantChangeType
(
&
string_value
,
value
,
0
,
VT_BSTR
);
if
(
FAILED
(
hr
))
{
WARN
(
"Couldn't convert to VT_BSTR
\n
"
);
return
hr
;
}
hr
=
node_set_content_escaped
(
This
,
V_BSTR
(
&
string_value
));
VariantClear
(
&
string_value
);
return
S_OK
;
}
static
HRESULT
get_node
(
xmlnode
*
This
,
const
char
*
name
,
...
...
dlls/msxml3/tests/domdoc.c
View file @
8f976c5d
...
...
@@ -6056,8 +6056,11 @@ static void test_TransformWithLoadingLocalFile(void)
static
void
test_put_nodeValue
(
void
)
{
static
const
WCHAR
jeevesW
[]
=
{
'J'
,
'e'
,
'e'
,
'v'
,
'e'
,
's'
,
' '
,
'&'
,
' '
,
'W'
,
'o'
,
'o'
,
's'
,
't'
,
'e'
,
'r'
,
0
};
IXMLDOMDocument
*
doc
;
IXMLDOMText
*
text
;
IXMLDOMEntityReference
*
entityref
;
IXMLDOMAttribute
*
attr
;
IXMLDOMNode
*
node
;
HRESULT
hr
;
VARIANT
data
,
type
;
...
...
@@ -6115,6 +6118,28 @@ static void test_put_nodeValue(void)
IXMLDOMNode_Release
(
node
);
IXMLDOMEntityReference_Release
(
entityref
);
/* supported types */
hr
=
IXMLDOMDocument_createTextNode
(
doc
,
_bstr_
(
""
),
&
text
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
V_VT
(
&
data
)
=
VT_BSTR
;
V_BSTR
(
&
data
)
=
_bstr_
(
"Jeeves & Wooster"
);
hr
=
IXMLDOMText_put_nodeValue
(
text
,
data
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IXMLDOMText_Release
(
text
);
hr
=
IXMLDOMDocument_createAttribute
(
doc
,
_bstr_
(
"attr"
),
&
attr
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
V_VT
(
&
data
)
=
VT_BSTR
;
V_BSTR
(
&
data
)
=
_bstr_
(
"Jeeves & Wooster"
);
hr
=
IXMLDOMAttribute_put_nodeValue
(
attr
,
data
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IXMLDOMAttribute_get_nodeValue
(
attr
,
&
data
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
ok
(
memcmp
(
V_BSTR
(
&
data
),
jeevesW
,
sizeof
(
jeevesW
))
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
data
)));
VariantClear
(
&
data
);
IXMLDOMAttribute_Release
(
attr
);
free_bstrs
();
IXMLDOMDocument_Release
(
doc
);
...
...
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