38DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
61#define reader_set_input(a, b) _reader_set_input(__LINE__, a, b)
75#define EXPECT_REF(obj, ref) _expect_ref((IUnknown *)obj, ref, __LINE__)
80 refcount = IUnknown_Release(
obj);
81 ok_(__FILE__,
line)(refcount ==
ref,
"expected refcount %lu, got %lu.\n",
ref, refcount);
92 ok_(__FILE__,
line)(
hr ==
S_OK,
"Failed to get the stream handle, hr %#lx.\n",
hr);
95 ok_(__FILE__,
line)(
size == content_size,
"Unexpected test output size %Id.\n", content_size);
97 if (
size <= content_size)
99 if (
size != content_size && *
ptr == 0xfeff)
121 ok_(__FILE__,
line)(0,
"data size mismatch, expected %u, got %u\n",
len,
size);
129#define CHECK_OUTPUT(stream, expected) check_output(stream, expected, FALSE, __LINE__)
130#define CHECK_OUTPUT_TODO(stream, expected) check_output(stream, expected, TRUE, __LINE__)
131#define CHECK_OUTPUT_RAW(stream, expected, size) check_output_raw(stream, expected, size, __LINE__)
138 ok(
hr ==
S_OK,
"Failed to set writer property, hr %#lx.\n",
hr);
154 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"a",
NULL,
L"a");
155 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
157 hr = IXmlWriter_WriteCData(writer,
L"a");
158 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
160 hr = IXmlWriter_WriteCharEntity(writer,
'a');
161 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
163 hr = IXmlWriter_WriteChars(writer,
L"a", 1);
164 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
166 hr = IXmlWriter_WriteComment(writer,
L"a");
167 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
170 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
172 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"a",
NULL,
L"a");
173 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
175 hr = IXmlWriter_WriteEndDocument(writer);
176 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
178 hr = IXmlWriter_WriteEndElement(writer);
179 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
181 hr = IXmlWriter_WriteEntityRef(writer,
L"a");
182 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
184 hr = IXmlWriter_WriteFullEndElement(writer);
185 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
187 hr = IXmlWriter_WriteName(writer,
L"a");
188 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
190 hr = IXmlWriter_WriteNmToken(writer,
L"a");
191 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
198 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
204 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
206 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"a",
L"a");
207 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
209 hr = IXmlWriter_WriteQualifiedName(writer,
L"a",
NULL);
210 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
212 hr = IXmlWriter_WriteRaw(writer,
L"a");
213 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
215 hr = IXmlWriter_WriteRawChars(writer,
L"a", 1);
216 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
219 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
221 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
222 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
224 hr = IXmlWriter_WriteString(writer,
L"a");
225 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
227 hr = IXmlWriter_WriteSurrogateCharEntity(writer, low, high);
228 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
230 hr = IXmlWriter_WriteWhitespace(writer,
L" ");
231 ok(
hr == exp_hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, exp_hr);
233 IXmlReader_Release(
reader);
304 ok(0,
"unexpected call\n");
346 hr = IUnknown_QueryInterface(unk, &IID_IXmlWriter, (
void **)&writer);
348 ok(unk == (
IUnknown *)writer,
"unexpected interface pointer\n");
349 IUnknown_Release(unk);
350 IXmlWriter_Release(writer);
376 IXmlWriter_Release(writer);
389 hr = IXmlWriter_SetOutput(writer, output);
390 ok(
hr ==
S_OK,
"Failed to set output, hr %#lx.\n",
hr);
394 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"a",
NULL,
L"a");
397 hr = IXmlWriter_WriteCData(writer,
L"a");
400 hr = IXmlWriter_WriteCharEntity(writer, 0x100);
403 hr = IXmlWriter_WriteChars(writer,
L"a", 1);
406 hr = IXmlWriter_WriteComment(writer,
L"a");
415 hr = IXmlWriter_WriteEndDocument(writer);
418 hr = IXmlWriter_WriteEndElement(writer);
421 hr = IXmlWriter_WriteEntityRef(writer,
L"a");
424 hr = IXmlWriter_WriteFullEndElement(writer);
427 hr = IXmlWriter_WriteName(writer,
L"a");
430 hr = IXmlWriter_WriteNmToken(writer,
L"a");
440 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"a",
L"a");
443 hr = IXmlWriter_WriteQualifiedName(writer,
L"a",
NULL);
446 hr = IXmlWriter_WriteRaw(writer,
L"a");
449 hr = IXmlWriter_WriteRawChars(writer,
L"a", 1);
455 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
458 hr = IXmlWriter_WriteString(writer,
L"a");
461 hr = IXmlWriter_WriteSurrogateCharEntity(writer, low, high);
464 hr = IXmlWriter_WriteWhitespace(writer,
L" ");
467 hr = IXmlWriter_WriteChars(writer,
L"a", 1);
470 hr = IXmlWriter_WriteRawChars(writer,
L"a", 1);
473 hr = IXmlWriter_Flush(writer);
474 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
476 IXmlReader_Release(
reader);
481 static const WCHAR utf16_outputW[] = {0xfeff,
'<',
'a'};
492 IUnknown_Release(output);
497 hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (
void**)&unk);
500 ok(unk !=
NULL && unk != output,
"got %p, output %p\n", unk, output);
503 IUnknown_Release(output);
505 IUnknown_Release(output);
510 IUnknown_Release(output);
515 hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (
void**)&unk);
517 ok(unk !=
NULL,
"got %p\n", unk);
519 IUnknown_Release(output);
520 IUnknown_Release(output);
526 IUnknown_Release(output);
530 ok(
hr ==
S_OK,
"Failed to create writer, hr %#lx.\n",
hr);
533 ok(
hr ==
S_OK,
"Failed to create stream, hr %#lx.\n",
hr);
536 ok(
hr ==
S_OK,
"Failed to create writer output, hr %#lx.\n",
hr);
538 hr = IXmlWriter_SetOutput(writer, output);
539 ok(
hr ==
S_OK,
"Failed to set writer output, hr %#lx.\n",
hr);
541 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
542 ok(
hr ==
S_OK,
"Write failed, hr %#lx.\n",
hr);
544 hr = IXmlWriter_Flush(writer);
545 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
550 IUnknown_Release(output);
554 ok(
hr ==
S_OK,
"Failed to create stream, hr %#lx.\n",
hr);
558 ok(
hr ==
S_OK,
"Failed to create writer output, hr %#lx.\n",
hr);
564 IUnknown_Release(output);
578 IUnknown_Release(output);
580 IXmlWriter_Release(writer);
585 static const char fullprolog[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
586 static const char *prologversion2 =
"<?xml version=\"1.0\" encoding=\"uS-asCii\"?>";
587 static const char prologversion[] =
"<?xml version=\"1.0\"?>";
600 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
603 hr = IXmlWriter_Flush(writer);
609 hr = IXmlWriter_Flush(writer);
615 hr = IXmlWriter_Flush(writer);
628 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
638 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
641 hr = IXmlWriter_Flush(writer);
647 IXmlWriter_Release(writer);
660 hr = IXmlWriter_SetOutput(writer, output);
666 hr = IXmlWriter_Flush(writer);
672 IXmlWriter_Release(writer);
673 IUnknown_Release(output);
691 hr = IXmlWriter_Flush(writer);
696 hr = IXmlWriter_Flush(writer);
702 IXmlWriter_Release(writer);
708 static const char prologversion[] =
"<?xml version=\"1.0\"?>";
725 hr = IXmlWriter_Flush(writer);
744 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
747 hr = IXmlWriter_Flush(writer);
755 hr = IXmlWriter_Flush(writer);
763 hr = IXmlWriter_Flush(writer);
769 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
772 hr = IXmlWriter_Flush(writer);
776 IXmlWriter_Release(writer);
781 static const WCHAR piW[] = {0xfeff,
'<',
'?',
'x',
'm',
'l',
' ',
'v',
'e',
'r',
's',
'i',
'o',
'n',
'=',
'"',
'1',
'.',
'0',
'"',
'?',
'>'};
782 static const WCHAR aopenW[] = {0xfeff,
'<',
'a'};
783 static const WCHAR afullW[] = {0xfeff,
'<',
'a',
' ',
'/',
'>'};
784 static const WCHAR bomW[] = {0xfeff};
802 hr = IXmlWriter_SetOutput(writer, output);
809 hr = IXmlWriter_Flush(writer);
815 IUnknown_Release(output);
824 hr = IXmlWriter_SetOutput(writer, output);
827 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"xml",
L"version=\"1.0\"");
830 hr = IXmlWriter_Flush(writer);
835 IUnknown_Release(output);
845 hr = IXmlWriter_SetOutput(writer, output);
848 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
851 hr = IXmlWriter_Flush(writer);
856 IUnknown_Release(output);
866 hr = IXmlWriter_SetOutput(writer, output);
874 hr = IXmlWriter_Flush(writer);
882 IUnknown_Release(output);
885 IXmlWriter_Release(writer);
896 const char *output_partial;
901 start_element_tests[] =
903 {
L"prefix",
L"local",
L"uri",
"<prefix:local xmlns:prefix=\"uri\" />",
"<prefix:local" },
904 {
NULL,
L"local",
L"uri",
"<local xmlns=\"uri\" />",
"<local" },
905 {
L"",
L"local",
L"uri",
"<local xmlns=\"uri\" />",
"<local" },
906 {
L"",
L"local",
L"uri",
"<local xmlns=\"uri\" />",
"<local" },
907 {
NULL,
L"local",
NULL,
"<local />",
"<local" },
908 {
NULL,
L"local",
L"",
"<local />",
"<local" },
928 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
933 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
939 hr = IXmlWriter_Flush(writer);
950 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"a",
L"a");
954 IXmlWriter_Release(writer);
960 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"b",
NULL,
L"value");
965 hr = IXmlWriter_WriteStartElement(writer,
L"prefix",
L"a",
L"uri");
966 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
968 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"b",
NULL,
L"value");
969 ok(
hr ==
S_OK,
"Failed to write element string, hr %#lx.\n",
hr);
972 ok(
hr ==
S_OK,
"Failed to write element string, hr %#lx.\n",
hr);
974 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"d",
L"uri");
975 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
977 hr = IXmlWriter_WriteStartElement(writer,
L"",
L"e",
L"uri");
978 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
980 hr = IXmlWriter_WriteStartElement(writer,
L"prefix2",
L"f",
L"uri");
981 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
983 hr = IXmlWriter_Flush(writer);
987 "<prefix:a xmlns:prefix=\"uri\">"
1004 ok(
hr ==
S_OK,
"Failed to start document, hr %#lx.\n",
hr);
1006 hr = IXmlWriter_WriteStartElement(writer, start_element_tests[
i].
prefix, start_element_tests[
i].
local,
1007 start_element_tests[
i].
uri);
1008 ok(
hr == start_element_tests[
i].
hr,
"%u: unexpected hr %#lx.\n",
i,
hr);
1012 hr = IXmlWriter_Flush(writer);
1013 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1015 check_output(
stream, start_element_tests[
i].output_partial, start_element_tests[
i].todo_partial, __LINE__);
1017 hr = IXmlWriter_WriteEndDocument(writer);
1018 ok(
hr ==
S_OK,
"Failed to end document, hr %#lx.\n",
hr);
1020 hr = IXmlWriter_Flush(writer);
1021 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1029 IXmlWriter_Release(writer);
1044 element_string_tests[] =
1046 {
L"prefix",
L"local",
L"uri",
L"value",
"<prefix:local xmlns:prefix=\"uri\">value</prefix:local>" },
1047 {
NULL,
L"local",
L"uri",
L"value",
"<local xmlns=\"uri\">value</local>" },
1048 {
L"",
L"local",
L"uri",
L"value",
"<local xmlns=\"uri\">value</local>" },
1049 {
L"prefix",
L"local",
L"uri",
NULL,
"<prefix:local xmlns:prefix=\"uri\" />" },
1050 {
NULL,
L"local",
L"uri",
NULL,
"<local xmlns=\"uri\" />" },
1051 {
L"",
L"local",
L"uri",
NULL,
"<local xmlns=\"uri\" />" },
1053 {
L"prefix",
L"local",
L"uri",
L"",
"<prefix:local xmlns:prefix=\"uri\"></prefix:local>" },
1054 {
NULL,
L"local",
L"uri",
L"",
"<local xmlns=\"uri\"></local>" },
1055 {
L"",
L"local",
L"uri",
L"",
"<local xmlns=\"uri\"></local>" },
1056 {
NULL,
L"local",
NULL,
L"",
"<local></local>" },
1057 {
L"",
L"local",
L"http://www.w3.org/2000/xmlns/",
NULL,
"<local xmlns=\"http://www.w3.org/2000/xmlns/\" />" },
1078 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"b",
NULL,
L"value");
1083 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1086 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"b",
NULL,
L"value");
1092 hr = IXmlWriter_WriteElementString(writer,
L"prefix",
L"b",
L"uri",
NULL);
1095 hr = IXmlWriter_WriteStartElement(writer,
L"prefix",
L"c",
L"uri");
1096 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
1098 hr = IXmlWriter_WriteElementString(writer,
L"prefix",
L"d",
NULL,
NULL);
1099 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1101 hr = IXmlWriter_WriteElementString(writer,
L"prefix2",
L"d",
L"uri",
NULL);
1102 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1104 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"e",
L"uri",
NULL);
1105 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1107 hr = IXmlWriter_WriteElementString(writer,
L"prefix",
L"f",
L"uri2",
NULL);
1108 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1110 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"g",
L"uri3",
NULL);
1111 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1113 hr = IXmlWriter_WriteElementString(writer,
L"prefix",
L"h",
NULL,
NULL);
1114 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1116 hr = IXmlWriter_WriteElementString(writer,
L"prefix_i",
L"i",
NULL,
NULL);
1119 hr = IXmlWriter_WriteElementString(writer,
L"",
L"j",
L"uri",
NULL);
1120 ok(
hr ==
S_OK,
"Failed to write element, hr %#lx.\n",
hr);
1122 hr = IXmlWriter_Flush(writer);
1126 "<a><b>value</b><b />"
1127 "<prefix:b xmlns:prefix=\"uri\" />"
1128 "<prefix:c xmlns:prefix=\"uri\">"
1130 "<prefix2:d xmlns:prefix2=\"uri\" />"
1132 "<prefix:f xmlns:prefix=\"uri2\" />"
1133 "<g xmlns=\"uri3\" />"
1135 "<j xmlns=\"uri\" />");
1146 ok(
hr ==
S_OK,
"Failed to start document, hr %#lx.\n",
hr);
1148 hr = IXmlWriter_WriteElementString(writer, element_string_tests[
i].
prefix, element_string_tests[
i].
local,
1149 element_string_tests[
i].
uri, element_string_tests[
i].
value);
1150 ok(
hr == element_string_tests[
i].
hr,
"%u: unexpected hr %#lx.\n",
i,
hr);
1154 hr = IXmlWriter_Flush(writer);
1155 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1159 hr = IXmlWriter_WriteEndDocument(writer);
1160 ok(
hr ==
S_OK,
"Failed to end document, hr %#lx.\n",
hr);
1162 hr = IXmlWriter_Flush(writer);
1163 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1171 IXmlWriter_Release(writer);
1185 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1188 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1191 hr = IXmlWriter_WriteEndElement(writer);
1194 hr = IXmlWriter_WriteEndElement(writer);
1197 hr = IXmlWriter_Flush(writer);
1202 IXmlWriter_Release(writer);
1217 hr = IXmlWriter_WriteEndDocument(writer);
1223 hr = IXmlWriter_WriteEndDocument(writer);
1226 hr = IXmlWriter_WriteEndDocument(writer);
1232 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1238 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1241 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1244 hr = IXmlWriter_WriteEndDocument(writer);
1254 hr = IXmlWriter_Flush(writer);
1259 IXmlWriter_Release(writer);
1274 hr = IXmlWriter_WriteComment(writer,
L"a");
1282 hr = IXmlWriter_WriteComment(writer,
L"a");
1285 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1288 hr = IXmlWriter_WriteComment(writer,
L"a");
1291 hr = IXmlWriter_WriteComment(writer,
NULL);
1294 hr = IXmlWriter_WriteComment(writer,
L"-->");
1297 hr = IXmlWriter_Flush(writer);
1302 IXmlWriter_Release(writer);
1317 hr = IXmlWriter_WriteCData(writer,
L"a");
1322 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1325 hr = IXmlWriter_WriteCData(writer,
L"a");
1328 hr = IXmlWriter_WriteCData(writer,
NULL);
1331 hr = IXmlWriter_WriteCData(writer,
L"]]>");
1334 hr = IXmlWriter_WriteCData(writer,
L"a]]>b");
1337 hr = IXmlWriter_Flush(writer);
1349 IXmlWriter_Release(writer);
1355 static const WCHAR surrogates[] = {0xdc00, 0xd800,
'\0'};
1356 static const WCHAR invalid[] = {0x8,
'\0'};
1357 static const WCHAR rawW[] =
L"a<:";
1365 hr = IXmlWriter_WriteRaw(writer,
NULL);
1368 hr = IXmlWriter_WriteRaw(writer, rawW);
1373 hr = IXmlWriter_WriteRaw(writer, surrogates);
1376 hr = IXmlWriter_WriteRaw(writer,
L"\uffff");
1379 hr = IXmlWriter_WriteRaw(writer, invalid);
1382 hr = IXmlWriter_WriteRaw(writer,
NULL);
1385 hr = IXmlWriter_WriteRaw(writer, rawW);
1388 hr = IXmlWriter_WriteRaw(writer, rawW);
1391 hr = IXmlWriter_WriteComment(writer, rawW);
1394 hr = IXmlWriter_WriteRaw(writer, rawW);
1397 hr = IXmlWriter_WriteElementString(writer,
NULL,
L"a",
NULL,
L"a");
1403 hr = IXmlWriter_WriteComment(writer, rawW);
1406 hr = IXmlWriter_WriteEndDocument(writer);
1409 hr = IXmlWriter_WriteRaw(writer, rawW);
1412 hr = IXmlWriter_Flush(writer);
1414 CHECK_OUTPUT(
stream,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>a<:a<:<!--a<:-->a<:<a>a</a>");
1420 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
1422 hr = IXmlWriter_WriteRaw(writer,
L"text");
1425 hr = IXmlWriter_Flush(writer);
1430 IXmlWriter_Release(writer);
1448 hr = IXmlWriter_WriteEndElement(writer);
1457 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"a",
NULL,
L"a");
1466 hr = IXmlWriter_WriteEndDocument(writer);
1475 hr = IXmlWriter_WriteFullEndElement(writer);
1484 hr = IXmlWriter_WriteCData(writer,
L"a");
1493 hr = IXmlWriter_WriteName(writer,
L"a");
1502 hr = IXmlWriter_WriteNmToken(writer,
L"a");
1511 hr = IXmlWriter_WriteString(writer,
L"a");
1520 hr = IXmlWriter_WriteChars(writer,
L"a", 1);
1526 IXmlWriter_Release(writer);
1546 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1549 hr = IXmlWriter_WriteComment(writer,
L"comment");
1552 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1555 hr = IXmlWriter_WriteEndDocument(writer);
1558 hr = IXmlWriter_Flush(writer);
1563 " <!--comment-->\r\n"
1572 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1581 hr = IXmlWriter_WriteEndElement(writer);
1584 hr = IXmlWriter_Flush(writer);
1595 IXmlWriter_Release(writer);
1607 const char *output_partial;
1615 {
NULL,
L"a",
NULL,
L"b",
"<e a=\"b\" />",
"<e a=\"b\"" },
1616 {
L"",
L"a",
NULL,
L"b",
"<e a=\"b\" />",
"<e a=\"b\"" },
1617 {
NULL,
L"a",
L"",
L"b",
"<e a=\"b\" />",
"<e a=\"b\"" },
1618 {
L"",
L"a",
L"",
L"b",
"<e a=\"b\" />",
"<e a=\"b\"" },
1619 {
L"prefix",
L"local",
L"uri",
L"b",
"<e prefix:local=\"b\" xmlns:prefix=\"uri\" />",
"<e prefix:local=\"b\"" },
1620 {
NULL,
L"a",
L"http://www.w3.org/2000/xmlns/",
L"defuri",
"<e xmlns:a=\"defuri\" />",
"<e xmlns:a=\"defuri\"" },
1621 {
L"xmlns",
L"a",
NULL,
L"uri",
"<e xmlns:a=\"uri\" />",
"<e xmlns:a=\"uri\"" },
1622 {
L"xmlns",
L"a",
L"",
L"uri",
"<e xmlns:a=\"uri\" />",
"<e xmlns:a=\"uri\"" },
1623 {
L"prefix",
L"xmlns",
L"uri",
L"value",
"<e prefix:xmlns=\"value\" xmlns:prefix=\"uri\" />",
"<e prefix:xmlns=\"value\"" },
1624 {
L"prefix",
L"xmlns",
L"uri",
NULL,
"<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />",
"<e prefix:xmlns=\"\"" },
1625 {
L"prefix",
L"xmlns",
L"uri",
L"",
"<e prefix:xmlns=\"\" xmlns:prefix=\"uri\" />",
"<e prefix:xmlns=\"\"" },
1626 {
L"prefix",
L"xmlns",
NULL,
L"uri",
"<e xmlns=\"uri\" />",
"<e xmlns=\"uri\"" },
1627 {
L"prefix",
L"xmlns",
L"",
L"uri",
"<e xmlns=\"uri\" />",
"<e xmlns=\"uri\"" },
1628 {
L"xml",
L"space",
NULL,
L"preserve",
"<e xml:space=\"preserve\" />",
"<e xml:space=\"preserve\"" },
1629 {
L"xml",
L"space",
L"",
L"preserve",
"<e xml:space=\"preserve\" />",
"<e xml:space=\"preserve\"" },
1630 {
L"xml",
L"space",
NULL,
L"default",
"<e xml:space=\"default\" />",
"<e xml:space=\"default\"" },
1631 {
L"xml",
L"space",
L"",
L"default",
"<e xml:space=\"default\" />",
"<e xml:space=\"default\"" },
1632 {
L"xml",
L"a",
NULL,
L"value",
"<e xml:a=\"value\" />",
"<e xml:a=\"value\"" },
1633 {
L"xml",
L"a",
L"",
L"value",
"<e xml:a=\"value\" />",
"<e xml:a=\"value\"" },
1636 {
NULL,
L"a",
L"defuri",
NULL,
"<e p1:a=\"\" xmlns:p1=\"defuri\" />",
"<e p1:a=\"\"",
S_OK, 1, 1, 1 },
1637 {
NULL,
L"a",
L"defuri",
L"b",
"<e p1:a=\"b\" xmlns:p1=\"defuri\" />",
"<e p1:a=\"b\"",
S_OK, 1, 1, 1 },
1638 {
L"",
L"a",
L"defuri",
NULL,
"<e p1:a=\"\" xmlns:p1=\"defuri\" />",
"<e p1:a=\"\"",
S_OK, 1, 1, 1 },
1639 {
NULL,
L"a",
L"defuri",
L"",
"<e p1:a=\"\" xmlns:p1=\"defuri\" />",
"<e p1:a=\"\"",
S_OK, 1, 1, 1 },
1640 {
L"",
L"a",
L"defuri",
L"b",
"<e p1:a=\"b\" xmlns:p1=\"defuri\" />",
"<e p1:a=\"b\"",
S_OK, 1, 1, 1 },
1644 {
L"",
L"a",
L"http://www.w3.org/2000/xmlns/",
L"defuri",
"<e />",
"<e",
WR_E_XMLNSPREFIXDECLARATION, 1, 1, 1 },
1646 {
L"",
L"",
L"http://www.w3.org/2000/xmlns/",
L"defuri",
"<e />",
"<e",
E_INVALIDARG },
1648 {
L"prefix",
L"a",
L"http://www.w3.org/2000/xmlns/",
L"defuri",
"<e />",
"<e",
WR_E_XMLNSURIDECLARATION, 1, 1, 1 },
1649 {
L"prefix",
NULL,
L"http://www.w3.org/2000/xmlns/",
L"defuri",
"<e />",
"<e",
E_INVALIDARG },
1655 {
NULL,
L"xmlns",
L"uri",
NULL,
"<e />",
"<e",
WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
1656 {
L"xmlns",
NULL,
L"uri",
NULL,
"<e />",
"<e",
WR_E_XMLNSPREFIXDECLARATION, 0, 0, 1 },
1690 ok(
hr ==
S_OK,
"Failed to start document, hr %#lx.\n",
hr);
1692 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"e",
NULL);
1693 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
1695 hr = IXmlWriter_WriteAttributeString(writer, attribute_tests[
i].
prefix, attribute_tests[
i].
local,
1696 attribute_tests[
i].
uri, attribute_tests[
i].
value);
1698 ok(
hr == attribute_tests[
i].
hr,
"Unexpected hr %#lx, expected %#lx.\n",
hr, attribute_tests[
i].
hr);
1700 hr = IXmlWriter_Flush(writer);
1701 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1703 check_output(
stream, attribute_tests[
i].output_partial, attribute_tests[
i].todo_partial, __LINE__);
1705 hr = IXmlWriter_WriteEndDocument(writer);
1706 ok(
hr ==
S_OK,
"Failed to end document, hr %#lx.\n",
hr);
1708 hr = IXmlWriter_Flush(writer);
1709 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
1723 hr = IXmlWriter_WriteStartElement(writer,
L"p",
L"a",
L"outeruri");
1726 hr = IXmlWriter_WriteAttributeString(writer,
L"prefix",
L"local",
L"uri",
L"b");
1729 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"a",
NULL,
L"b");
1732 hr = IXmlWriter_WriteAttributeString(writer,
L"xmlns",
L"prefix",
NULL,
L"uri");
1735 hr = IXmlWriter_WriteAttributeString(writer,
L"p",
L"attr",
NULL,
L"value");
1736 ok(
hr ==
S_OK,
"Failed to write attribute string, hr %#lx.\n",
hr);
1738 hr = IXmlWriter_WriteAttributeString(writer,
L"prefix",
L"local",
NULL,
L"b");
1742 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
1745 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"attr2",
L"outeruri",
L"value");
1746 ok(
hr ==
S_OK,
"Failed to write attribute string, hr %#lx.\n",
hr);
1748 hr = IXmlWriter_WriteAttributeString(writer,
L"pr",
L"attr3",
L"outeruri",
L"value");
1749 ok(
hr ==
S_OK,
"Failed to write attribute string, hr %#lx.\n",
hr);
1751 hr = IXmlWriter_WriteEndDocument(writer);
1754 hr = IXmlWriter_Flush(writer);
1758 "<p:a prefix:local=\"b\" a=\"b\" xmlns:prefix=\"uri\" p:attr=\"value\" xmlns:p=\"outeruri\">"
1759 "<b p:attr2=\"value\" pr:attr3=\"value\" xmlns:pr=\"outeruri\" />"
1770 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"e",
NULL);
1773 hr = IXmlWriter_WriteAttributeString(writer,
L"xmlns",
L"prefix",
NULL,
L"uri");
1776 hr = IXmlWriter_WriteAttributeString(writer,
L"prefix",
L"attr",
NULL,
L"value");
1779 hr = IXmlWriter_WriteEndDocument(writer);
1782 hr = IXmlWriter_Flush(writer);
1786 "<e xmlns:prefix=\"uri\" prefix:attr=\"value\" />");
1790 IXmlWriter_Release(writer);
1811 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1814 hr = IXmlWriter_WriteFullEndElement(writer);
1817 hr = IXmlWriter_WriteEndDocument(writer);
1820 hr = IXmlWriter_Flush(writer);
1836 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1839 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1842 hr = IXmlWriter_WriteFullEndElement(writer);
1845 hr = IXmlWriter_WriteEndDocument(writer);
1848 hr = IXmlWriter_Flush(writer);
1861 ok(
hr ==
S_OK,
"Failed to set property, hr %#lx.\n",
hr);
1863 hr = IXmlWriter_WriteStartElement(writer,
L"",
L"a",
NULL);
1865 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
L"");
1867 hr = IXmlWriter_WriteStartElement(writer,
L"",
L"c",
L"");
1869 hr = IXmlWriter_WriteFullEndElement(writer);
1871 hr = IXmlWriter_WriteFullEndElement(writer);
1873 hr = IXmlWriter_WriteFullEndElement(writer);
1876 hr = IXmlWriter_Flush(writer);
1881 IXmlWriter_Release(writer);
1901 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1904 hr = IXmlWriter_WriteCharEntity(writer, 0x100);
1907 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
1910 hr = IXmlWriter_WriteEndDocument(writer);
1913 hr = IXmlWriter_Flush(writer);
1917 "<a>Ā<a /></a>");
1919 IXmlWriter_Release(writer);
1928 static WCHAR surrogates[] = {0xd800, 0xdc00, 0};
1933 hr = IXmlWriter_WriteRawChars(writer,
NULL, 0);
1936 hr = IXmlWriter_WriteRawChars(writer,
L"", 0);
1939 hr = IXmlWriter_WriteRawChars(writer,
NULL, 5);
1942 hr = IXmlWriter_WriteRawChars(writer,
L"", 6);
1947 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
1950 hr = IXmlWriter_WriteRawChars(writer,
L"<rawChars>", 5);
1953 hr = IXmlWriter_Flush(writer);
1961 hr = IXmlWriter_WriteRawChars(writer,
L"a", 1);
1964 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
1967 hr = IXmlWriter_WriteRawChars(writer,
L"<;;>", 10);
1970 hr = IXmlWriter_Flush(writer);
1978 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
1981 hr = IXmlWriter_WriteRawChars(writer, surrogates, 1);
1984 hr = IXmlWriter_WriteRawChars(writer, surrogates, 2);
1987 hr = IXmlWriter_Flush(writer);
1995 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
1998 hr = IXmlWriter_WriteRawChars(writer,
L"", 5);
2001 hr = IXmlWriter_Flush(writer);
2009 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
2012 hr = IXmlWriter_WriteRawChars(writer,
L"", 0);
2015 hr = IXmlWriter_Flush(writer);
2025 hr = IXmlWriter_WriteEndElement(writer);
2028 hr = IXmlWriter_WriteRawChars(writer,
L"a", 1);
2032 IXmlWriter_Release(writer);
2041 WCHAR high = 0xdaff;
2046 hr = IXmlWriter_WriteSurrogateCharEntity(writer, high, low);
2049 hr = IXmlWriter_WriteSurrogateCharEntity(writer, low, high);
2054 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"root",
NULL);
2057 hr = IXmlWriter_WriteSurrogateCharEntity(writer, high, low);
2060 hr = IXmlWriter_Flush(writer);
2065 hr = IXmlWriter_WriteSurrogateCharEntity(writer, low, high);
2068 hr = IXmlWriter_WriteFullEndElement(writer);
2071 hr = IXmlWriter_Flush(writer);
2079 hr = IXmlWriter_WriteEndElement(writer);
2082 hr = IXmlWriter_WriteSurrogateCharEntity(writer, low, high);
2085 IXmlWriter_Release(writer);
2091 static const WCHAR surrogates[] = {0xd800, 0xdc00,
'x',
'y',
'\0'};
2101 hr = IXmlWriter_WriteString(writer,
L"a");
2104 hr = IXmlWriter_WriteString(writer,
NULL);
2107 hr = IXmlWriter_WriteString(writer,
L"");
2112 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"sub",
NULL);
2115 hr = IXmlWriter_WriteString(writer,
L"\v");
2118 hr = IXmlWriter_WriteString(writer,
L"\ufffe");
2121 hr = IXmlWriter_WriteString(writer, surrogates);
2124 hr = IXmlWriter_Flush(writer);
2128 "<sub>\U00010000xy");
2133 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
2136 hr = IXmlWriter_WriteString(writer,
NULL);
2139 hr = IXmlWriter_WriteString(writer,
L"");
2142 hr = IXmlWriter_WriteString(writer,
L"a");
2146 hr = IXmlWriter_WriteString(writer,
L"<&\">=");
2149 hr = IXmlWriter_Flush(writer);
2153 "<b>a<&\">=");
2158 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
2161 hr = IXmlWriter_WriteString(writer,
NULL);
2164 hr = IXmlWriter_Flush(writer);
2170 hr = IXmlWriter_WriteString(writer,
L"");
2173 hr = IXmlWriter_Flush(writer);
2180 IXmlWriter_Release(writer);
2184 ok(
hr ==
S_OK,
"Failed to create a writer, hr %#lx.\n",
hr);
2190 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
2191 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2193 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
2194 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2196 hr = IXmlWriter_WriteString(writer,
L"text");
2197 ok(
hr ==
S_OK,
"Failed to write a string, hr %#lx.\n",
hr);
2199 hr = IXmlWriter_Flush(writer);
2200 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2206 hr = IXmlWriter_WriteFullEndElement(writer);
2207 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2209 hr = IXmlWriter_Flush(writer);
2210 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2216 hr = IXmlWriter_WriteFullEndElement(writer);
2217 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2219 hr = IXmlWriter_Flush(writer);
2220 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2231 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"a",
NULL);
2232 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2234 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"b",
NULL);
2235 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2237 hr = IXmlWriter_WriteEndElement(writer);
2238 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2240 hr = IXmlWriter_Flush(writer);
2241 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2247 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"c",
NULL);
2248 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2250 hr = IXmlWriter_WriteAttributeString(writer,
NULL,
L"attr",
NULL,
L"value");
2251 ok(
hr ==
S_OK,
"Failed to write attribute string, hr %#lx.\n",
hr);
2253 hr = IXmlWriter_Flush(writer);
2254 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2259 " <c attr=\"value\"");
2261 hr = IXmlWriter_WriteString(writer,
L"text");
2262 ok(
hr ==
S_OK,
"Failed to write a string, hr %#lx.\n",
hr);
2264 hr = IXmlWriter_Flush(writer);
2265 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2270 " <c attr=\"value\">text");
2272 hr = IXmlWriter_WriteEndElement(writer);
2273 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2275 hr = IXmlWriter_Flush(writer);
2276 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2281 " <c attr=\"value\">text</c>");
2283 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"d",
NULL);
2284 ok(
hr ==
S_OK,
"Failed to start element, hr %#lx.\n",
hr);
2286 hr = IXmlWriter_WriteString(writer,
L"");
2287 ok(
hr ==
S_OK,
"Failed to write a string, hr %#lx.\n",
hr);
2289 hr = IXmlWriter_WriteEndElement(writer);
2290 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2292 hr = IXmlWriter_Flush(writer);
2293 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2298 " <c attr=\"value\">text</c>\r\n"
2301 hr = IXmlWriter_WriteEndElement(writer);
2302 ok(
hr ==
S_OK,
"Failed to end element, hr %#lx.\n",
hr);
2304 hr = IXmlWriter_Flush(writer);
2305 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2310 " <c attr=\"value\">text</c>\r\n"
2314 IXmlWriter_Release(writer);
2323 static WCHAR raw[] = {
's',
'a',
'm', 0xd800, 0xdc00,
'p',
'l',
'e', 0};
2328 hr = IXmlWriter_WriteChars(writer,
NULL, 0);
2331 hr = IXmlWriter_WriteChars(writer,
NULL, 5);
2334 hr = IXmlWriter_WriteChars(writer,
L"", 0);
2337 hr = IXmlWriter_WriteChars(writer,
L"", 5);
2342 hr = IXmlWriter_WriteChars(writer,
L"a", 1);
2345 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"chars",
NULL);
2352 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"chars",
NULL);
2355 hr = IXmlWriter_WriteChars(writer,
NULL, 5);
2358 hr = IXmlWriter_WriteChars(writer,
L"<chars>", 20);
2361 hr = IXmlWriter_WriteChars(writer,
L"<chars>", 7);
2364 hr = IXmlWriter_Flush(writer);
2368 "<chars><chars><chars>");
2373 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"chars",
NULL);
2376 hr = IXmlWriter_WriteChars(writer, raw, 8);
2381 hr = IXmlWriter_WriteChars(writer, raw, 8);
2384 hr = IXmlWriter_Flush(writer);
2392 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"chars",
NULL);
2395 hr = IXmlWriter_WriteChars(writer,
NULL, 0);
2398 hr = IXmlWriter_WriteFullEndElement(writer);
2401 hr = IXmlWriter_Flush(writer);
2410 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"chars",
NULL);
2413 hr = IXmlWriter_WriteChars(writer,
L"", 0);
2416 hr = IXmlWriter_Flush(writer);
2426 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"c",
NULL);
2429 hr = IXmlWriter_WriteChars(writer,
L"", 5);
2432 hr = IXmlWriter_Flush(writer);
2438 IXmlWriter_Release(writer);
2449 const WCHAR *subset;
2454 {
L"a",
L"",
NULL,
NULL,
"<!DOCTYPE a PUBLIC \"\" \"\">" },
2456 {
L"a",
NULL,
L"",
NULL,
"<!DOCTYPE a SYSTEM \"\">" },
2457 {
L"a",
L"",
L"",
NULL,
"<!DOCTYPE a PUBLIC \"\" \"\">" },
2458 {
L"a",
L"pubid",
L"",
NULL,
"<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
2459 {
L"a",
L"pubid",
NULL,
NULL,
"<!DOCTYPE a PUBLIC \"pubid\" \"\">" },
2460 {
L"a",
L"",
L"sysid",
NULL,
"<!DOCTYPE a PUBLIC \"\" \"sysid\">" },
2461 {
L"a",
NULL,
NULL,
L"",
"<!DOCTYPE a []>" },
2462 {
L"a",
NULL,
NULL,
L"subset",
"<!DOCTYPE a [subset]>" },
2463 {
L"a",
L"",
NULL,
L"subset",
"<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
2464 {
L"a",
NULL,
L"",
L"subset",
"<!DOCTYPE a SYSTEM \"\" [subset]>" },
2465 {
L"a",
L"",
L"",
L"subset",
"<!DOCTYPE a PUBLIC \"\" \"\" [subset]>" },
2466 {
L"a",
L"pubid",
NULL,
L"subset",
"<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
2467 {
L"a",
L"pubid",
L"",
L"subset",
"<!DOCTYPE a PUBLIC \"pubid\" \"\" [subset]>" },
2468 {
L"a",
NULL,
L"sysid",
L"subset",
"<!DOCTYPE a SYSTEM \"sysid\" [subset]>" },
2469 {
L"a",
L"",
L"sysid",
L"subset",
"<!DOCTYPE a PUBLIC \"\" \"sysid\" [subset]>" },
2470 {
L"a",
L"pubid",
L"sysid",
L"subset",
"<!DOCTYPE a PUBLIC \"pubid\" \"sysid\" [subset]>" },
2472 static const WCHAR pubidW[] = {
'p',0x100,
'i',
'd',0};
2479 ok(
hr ==
S_OK,
"Failed to create writer instance, hr %#lx.\n",
hr);
2494 hr = IXmlWriter_WriteDocType(writer,
L"a", pubidW,
NULL,
NULL);
2511 hr = IXmlWriter_WriteDocType(writer, doctype_tests[
i].
name, doctype_tests[
i].pubid, doctype_tests[
i].sysid,
2512 doctype_tests[
i].subset);
2513 ok(
hr ==
S_OK,
"%u: failed to write doctype, hr %#lx.\n",
i,
hr);
2515 hr = IXmlWriter_Flush(writer);
2516 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2520 hr = IXmlWriter_WriteDocType(writer, doctype_tests[
i].
name, doctype_tests[
i].pubid, doctype_tests[
i].sysid,
2521 doctype_tests[
i].subset);
2527 IXmlWriter_Release(writer);
2541 hr = IXmlWriter_WriteWhitespace(writer,
L" ");
2543 hr = IXmlWriter_WriteWhitespace(writer,
L"ab");
2545 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2547 hr = IXmlWriter_WriteWhitespace(writer,
L"\t");
2550 hr = IXmlWriter_Flush(writer);
2551 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2555 IXmlWriter_Release(writer);
2569 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2571 hr = IXmlWriter_WriteProcessingInstruction(writer,
L"pi",
L"content");
2574 hr = IXmlWriter_Flush(writer);
2575 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2579 IXmlWriter_Release(writer);
2606 hr = IXmlWriter_Flush(writer);
2607 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2616 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2620 hr = IXmlReader_GetNodeType(
reader, &node_type);
2623 hr = IXmlWriter_Flush(writer);
2629 hr = IXmlReader_MoveToAttributeByName(
reader,
L"attr2",
NULL);
2632 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2636 hr = IXmlReader_GetNodeType(
reader, &node_type);
2642 hr = IXmlWriter_Flush(writer);
2647 IXmlWriter_Release(writer);
2648 IXmlReader_Release(
reader);
2659 write_node_tests[] =
2666 {
"<r><e1><e2 attr1=\'a\'/></e1></r>",
"<w><e1><e2 attr1=\"a\" /></e1>",
XmlNodeType_Element },
2695 hr = IXmlReader_Read(
reader, &node_type);
2698 hr = IXmlReader_Read(
reader, &node_type);
2700 ok(node_type == write_node_tests[
i].node_type,
"Unexpected node type %d.\n", node_type);
2703 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2710 hr = IXmlReader_GetNodeType(
reader, &node_type);
2718 hr = IXmlWriter_Flush(writer);
2719 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2730 hr = IXmlReader_Read(
reader, &node_type);
2733 hr = IXmlReader_MoveToFirstAttribute(
reader);
2738 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2739 hr = IXmlReader_GetNodeType(
reader, &node_type);
2742 hr = IXmlWriter_Flush(writer);
2743 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2749 hr = IXmlReader_Read(
reader, &node_type);
2755 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2756 hr = IXmlReader_GetNodeType(
reader, &node_type);
2759 hr = IXmlWriter_Flush(writer);
2760 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2766 hr = IXmlReader_Read(
reader, &node_type);
2772 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2773 hr = IXmlReader_GetNodeType(
reader, &node_type);
2776 hr = IXmlWriter_Flush(writer);
2777 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2778 CHECK_OUTPUT(
stream,
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
2783 hr = IXmlReader_GetNodeType(
reader, &node_type);
2785 ok(node_type ==
XmlNodeType_None,
"Unexpected node type on return %d.\n", node_type);
2788 ok(
hr ==
S_FALSE,
"Failed to write a node, hr %#lx.\n",
hr);
2790 hr = IXmlReader_GetNodeType(
reader, &node_type);
2793 ok(node_type ==
XmlNodeType_None,
"Unexpected node type on return %d.\n", node_type);
2794 hr = IXmlWriter_Flush(writer);
2795 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2799 IXmlReader_Release(
reader);
2800 IXmlWriter_Release(writer);
2811 write_node_tests[] =
2834 hr = IXmlWriter_WriteNodeShallow(writer,
NULL,
FALSE);
2848 hr = IXmlReader_Read(
reader, &node_type);
2851 hr = IXmlReader_Read(
reader, &node_type);
2853 ok(node_type == write_node_tests[
i].node_type,
"Unexpected node type %d.\n", node_type);
2856 hr = IXmlWriter_WriteStartElement(writer,
NULL,
L"w",
NULL);
2859 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2861 hr = IXmlReader_GetNodeType(
reader, &node_type);
2863 ok(node_type == write_node_tests[
i].node_type,
"Unexpected node type on return %d.\n", node_type);
2865 hr = IXmlWriter_Flush(writer);
2866 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2877 hr = IXmlReader_Read(
reader, &node_type);
2880 hr = IXmlReader_MoveToFirstAttribute(
reader);
2885 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2886 hr = IXmlReader_GetNodeType(
reader, &node_type);
2889 hr = IXmlWriter_Flush(writer);
2890 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2896 hr = IXmlReader_Read(
reader, &node_type);
2902 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2903 hr = IXmlReader_GetNodeType(
reader, &node_type);
2906 hr = IXmlWriter_Flush(writer);
2907 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2913 hr = IXmlReader_Read(
reader, &node_type);
2919 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2920 hr = IXmlReader_GetNodeType(
reader, &node_type);
2923 hr = IXmlWriter_Flush(writer);
2924 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2925 CHECK_OUTPUT(
stream,
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
2930 hr = IXmlReader_GetNodeType(
reader, &node_type);
2932 ok(node_type ==
XmlNodeType_None,
"Unexpected node type on return %d.\n", node_type);
2935 ok(
hr ==
S_OK,
"Failed to write a node, hr %#lx.\n",
hr);
2937 hr = IXmlReader_GetNodeType(
reader, &node_type);
2939 ok(node_type ==
XmlNodeType_None,
"Unexpected node type on return %d.\n", node_type);
2940 hr = IXmlWriter_Flush(writer);
2941 ok(
hr ==
S_OK,
"Failed to flush, hr %#lx.\n",
hr);
2945 IXmlReader_Release(
reader);
2946 IXmlWriter_Release(writer);
HRESULT WINAPI GetHGlobalFromStream(IStream *stream, HGLOBAL *phglobal)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc)
HRESULT WINAPI CreateXmlWriterOutputWithEncodingCodePage(IUnknown *stream, IMalloc *imalloc, UINT codepage, IXmlWriterOutput **out)
HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *imalloc, const WCHAR *encoding, IXmlWriterOutput **out)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
static ERESOURCE GlobalLock
#define todo_wine_if(is_todo)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define memcpy(s1, s2, n)
ssize_t pread(int fd, void *buf, size_t count, off_t offset)
static void test_writer_state(void)
static void test_writeroutput(void)
static HRESULT WINAPI teststream_QueryInterface(ISequentialStream *iface, REFIID riid, void **obj)
static void _reader_set_input(unsigned line, IXmlReader *reader, const char *xml)
static void test_WriteStartElement(void)
static void test_WriteRawChars(void)
static void check_output_raw(IStream *stream, const void *expected, SIZE_T size, int line)
static void test_WriteAttributes(void)
static void test_indentation(void)
static HRESULT WINAPI teststream_Write(ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written)
static void test_writestartdocument(void)
static void test_writeenddocument(void)
static void test_WriteProcessingInstruction(void)
static ULONG WINAPI teststream_AddRef(ISequentialStream *iface)
static const IUnknownVtbl testoutputvtbl
static IUnknown testoutput
#define reader_set_input(a, b)
static void _expect_ref(IUnknown *obj, ULONG ref, int line)
static void check_output(IStream *stream, const char *expected, BOOL todo, int line)
static void test_WriteComment(void)
static void test_WriteSurrogateCharEntity(void)
static void test_omitxmldeclaration(void)
static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
#define CHECK_OUTPUT_TODO(stream, expected)
static void test_WriteRaw(void)
static ULONG WINAPI testoutput_Release(IUnknown *iface)
static const ISequentialStreamVtbl teststreamvtbl
static void test_bom(void)
static IStream * writer_set_output(IXmlWriter *writer)
static IStream * create_stream_on_data(const void *data, unsigned int size)
static void test_WriteNodeShallow(void)
static void test_flush(void)
static void test_WriteDocType(void)
static void test_WriteString(void)
#define CHECK_OUTPUT_RAW(stream, expected, size)
static ULONG WINAPI teststream_Release(ISequentialStream *iface)
static void test_WriteElementString(void)
static HRESULT WINAPI teststream_Read(ISequentialStream *iface, void *pv, ULONG cb, ULONG *pread)
#define EXPECT_REF(obj, ref)
static void test_WriteNode(void)
#define CHECK_OUTPUT(stream, expected)
static void test_WriteCData(void)
static ULONG WINAPI testoutput_AddRef(IUnknown *iface)
static void test_WriteFullEndElement(void)
static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
static void test_WriteWhitespace(void)
static void test_WriteAttributeString(void)
static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
static void test_WriteChars(void)
static void test_WriteCharEntity(void)
static HRESULT WINAPI testoutput_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
static void test_WriteEndElement(void)
static void test_writer_create(void)
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
Character const *const prefix
@ WR_E_XMLPREFIXDECLARATION
@ WR_E_DUPLICATEATTRIBUTE
@ WR_E_XMLNSURIDECLARATION
@ WR_E_INVALIDSURROGATEPAIR
@ WR_E_XMLNSPREFIXDECLARATION
@ WR_E_NSPREFIXWITHEMPTYNSURI
@ XmlWriterProperty_ConformanceLevel
@ XmlWriterProperty_OmitXmlDeclaration
@ XmlWriterProperty_ByteOrderMark
@ XmlWriterProperty_Indent
@ XmlConformanceLevel_Document
@ XmlConformanceLevel_Auto
@ XmlNodeType_ProcessingInstruction
@ XmlNodeType_XmlDeclaration