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
b11f43d5
Commit
b11f43d5
authored
Sep 21, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/writer: Fix writing prefixed attributes.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
55af98d1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
writer.c
dlls/xmllite/tests/writer.c
+27
-0
writer.c
dlls/xmllite/writer.c
+5
-3
No files found.
dlls/xmllite/tests/writer.c
View file @
b11f43d5
...
...
@@ -1768,6 +1768,33 @@ todo_wine
"</p:a>"
);
IStream_Release
(
stream
);
/* Define prefix, write attribute with it. */
stream
=
writer_set_output
(
writer
);
hr
=
IXmlWriter_WriteStartDocument
(
writer
,
XmlStandalone_Omit
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
write_start_element
(
writer
,
NULL
,
"e"
,
NULL
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"xmlns"
,
"prefix"
,
NULL
,
"uri"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
write_attribute_string
(
writer
,
"prefix"
,
"attr"
,
NULL
,
"value"
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_WriteEndDocument
(
writer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXmlWriter_Flush
(
writer
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
CHECK_OUTPUT
(
stream
,
"<e xmlns:prefix=
\"
uri
\"
prefix:attr=
\"
value
\"
/>"
);
IStream_Release
(
stream
);
IXmlWriter_Release
(
writer
);
}
...
...
dlls/xmllite/writer.c
View file @
b11f43d5
...
...
@@ -843,8 +843,8 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
static
const
WCHAR
xmlnsW
[]
=
{
'x'
,
'm'
,
'l'
,
'n'
,
's'
,
0
};
static
const
WCHAR
xmlW
[]
=
{
'x'
,
'm'
,
'l'
,
0
};
xmlwriter
*
This
=
impl_from_IXmlWriter
(
iface
);
BOOL
is_xmlns_prefix
,
is_xmlns_local
;
int
prefix_len
,
local_len
;
BOOL
is_xmlns_prefix
;
struct
ns
*
ns
;
HRESULT
hr
;
...
...
@@ -879,6 +879,8 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
if
(
FAILED
(
hr
=
is_valid_ncname
(
local
,
&
local_len
)))
return
hr
;
is_xmlns_local
=
!
strcmpW
(
local
,
xmlnsW
);
/* Trivial case, no prefix. */
if
(
prefix_len
==
0
&&
is_empty_string
(
uri
))
{
...
...
@@ -918,9 +920,9 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
}
/* Ignore prefix is URI wasn't specified. */
if
(
is_empty_string
(
uri
))
if
(
is_
xmlns_local
&&
is_
empty_string
(
uri
))
{
write_output_attribute
(
This
,
NULL
,
0
,
local
,
local_len
,
value
);
write_output_attribute
(
This
,
NULL
,
0
,
xmlnsW
,
ARRAY_SIZE
(
xmlnsW
)
-
1
,
value
);
return
S_OK
;
}
...
...
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