Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
46d08bb6
Commit
46d08bb6
authored
Jul 08, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 09, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Fix xml declaration output when it's specified in loaded document (in case of stream).
parent
1a055244
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
10 deletions
+59
-10
domdoc.c
dlls/msxml3/domdoc.c
+9
-4
main.c
dlls/msxml3/main.c
+0
-1
domdoc.c
dlls/msxml3/tests/domdoc.c
+50
-5
No files found.
dlls/msxml3/domdoc.c
View file @
46d08bb6
...
...
@@ -371,13 +371,17 @@ void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node)
/* unlinks a first "<?xml" child if it was created */
xmlNodePtr
xmldoc_unlink_xmldecl
(
xmlDocPtr
doc
)
{
xmlNodePtr
node
;
static
const
xmlChar
xmlA
[]
=
"xml"
;
xmlNodePtr
node
,
first_child
;
assert
(
doc
!=
NULL
);
if
(
doc
->
standalone
!=
-
1
)
/* xml declaration node could be created automatically after parsing or added
to a tree later */
first_child
=
doc
->
children
;
if
(
first_child
&&
first_child
->
type
==
XML_PI_NODE
&&
xmlStrEqual
(
first_child
->
name
,
xmlA
))
{
node
=
doc
->
children
;
node
=
first_child
;
xmlUnlinkNode
(
node
);
}
else
...
...
@@ -2383,8 +2387,9 @@ static HRESULT WINAPI domdoc_save(
ret
=
IUnknown_QueryInterface
(
pUnk
,
&
IID_IStream
,
(
void
**
)
&
stream
);
if
(
ret
==
S_OK
)
{
int
options
=
get_doc
(
This
)
->
standalone
==
-
1
?
XML_SAVE_NO_DECL
:
0
;
ctx
=
xmlSaveToIO
(
domdoc_stream_save_writecallback
,
domdoc_stream_save_closecallback
,
stream
,
NULL
,
XML_SAVE_NO_DECL
);
domdoc_stream_save_closecallback
,
stream
,
NULL
,
options
);
if
(
!
ctx
)
{
...
...
dlls/msxml3/main.c
View file @
46d08bb6
...
...
@@ -209,7 +209,6 @@ static void init_libxslt(void)
#endif
}
BOOL
WINAPI
DllMain
(
HINSTANCE
hInstDLL
,
DWORD
fdwReason
,
LPVOID
lpv
)
{
MSXML_hInstance
=
hInstDLL
;
...
...
dlls/msxml3/tests/domdoc.c
View file @
46d08bb6
...
...
@@ -1504,9 +1504,16 @@ static const WCHAR szComplete6[] = {
'<'
,
'o'
,
'p'
,
'e'
,
'n'
,
'>'
,
'<'
,
'/'
,
'o'
,
'p'
,
'e'
,
'n'
,
'>'
,
'\n'
,
0
};
static
const
CHAR
szNonUnicodeXML
[]
=
"<?xml version='1.0' encoding='Windows-1252'?>
\n
"
"<open></open>
\n
"
;
#define DECL_WIN_1252 \
"<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
static
const
char
win1252xml
[]
=
DECL_WIN_1252
"<open></open>"
;
static
const
char
win1252decl
[]
=
DECL_WIN_1252
;
static
const
char
szExampleXML
[]
=
"<?xml version='1.0' encoding='utf-8'?>
\n
"
...
...
@@ -2327,7 +2334,7 @@ if (0)
/* try a BSTR containing a Windows-1252 document */
b
=
VARIANT_TRUE
;
str
=
SysAllocStringByteLen
(
szNonUnicodeXML
,
sizeof
(
szNonUnicodeXML
)
-
1
);
str
=
SysAllocStringByteLen
(
win1252xml
,
strlen
(
win1252xml
)
);
r
=
IXMLDOMDocument_loadXML
(
doc
,
str
,
&
b
);
ok
(
r
==
S_FALSE
,
"loadXML succeeded
\n
"
);
ok
(
b
==
VARIANT_FALSE
,
"succeeded in loading XML string
\n
"
);
...
...
@@ -7238,10 +7245,14 @@ static void test_save(void)
IXMLDOMElement
*
root
;
BSTR
sOrig
,
sNew
,
filename
;
char
buffer
[
100
];
IStream
*
stream
;
HGLOBAL
global
;
VARIANT_BOOL
b
;
DWORD
read
=
0
;
VARIANT
dest
;
HANDLE
hfile
;
HRESULT
hr
;
char
*
ptr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument
);
if
(
!
doc
)
return
;
...
...
@@ -7327,6 +7338,40 @@ static void test_save(void)
hr
=
IXMLDOMDocument_save
(
doc
,
dest
);
EXPECT_HR
(
hr
,
S_OK
);
/* loaded data contains xml declaration */
hr
=
IXMLDOMDocument_loadXML
(
doc
,
_bstr_
(
win1252xml
),
&
b
);
EXPECT_HR
(
hr
,
S_OK
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
V_VT
(
&
dest
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
dest
)
=
(
IUnknown
*
)
stream
;
hr
=
IXMLDOMDocument_save
(
doc
,
dest
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
GetHGlobalFromStream
(
stream
,
&
global
);
EXPECT_HR
(
hr
,
S_OK
);
ptr
=
GlobalLock
(
global
);
ok
(
!
memcmp
(
ptr
,
win1252decl
,
strlen
(
win1252decl
)),
"got wrong xml declaration
\n
"
);
GlobalUnlock
(
global
);
IStream_Release
(
stream
);
/* loaded data without xml declaration */
hr
=
IXMLDOMDocument_loadXML
(
doc
,
_bstr_
(
"<a/>"
),
&
b
);
EXPECT_HR
(
hr
,
S_OK
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
stream
);
V_VT
(
&
dest
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
dest
)
=
(
IUnknown
*
)
stream
;
hr
=
IXMLDOMDocument_save
(
doc
,
dest
);
EXPECT_HR
(
hr
,
S_OK
);
hr
=
GetHGlobalFromStream
(
stream
,
&
global
);
EXPECT_HR
(
hr
,
S_OK
);
ptr
=
GlobalLock
(
global
);
ok
(
ptr
[
0
]
==
'<'
&&
ptr
[
1
]
!=
'?'
,
"got wrong start tag %c%c
\n
"
,
ptr
[
0
],
ptr
[
1
]);
GlobalUnlock
(
global
);
IStream_Release
(
stream
);
IXMLDOMDocument_Release
(
doc
);
free_bstrs
();
}
...
...
@@ -10697,7 +10742,7 @@ static void test_load(void)
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"failed to create test file
\n
"
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
;
ret
=
WriteFile
(
hfile
,
szNonUnicodeXML
,
sizeof
(
szNonUnicodeXML
)
-
1
,
&
written
,
NULL
);
ret
=
WriteFile
(
hfile
,
win1252xml
,
strlen
(
win1252xml
)
,
&
written
,
NULL
);
ok
(
ret
,
"WriteFile failed
\n
"
);
CloseHandle
(
hfile
);
...
...
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