diff --git a/expat/doc/reference.html b/expat/doc/reference.html index 131b1df6..d2b0f60c 100644 --- a/expat/doc/reference.html +++ b/expat/doc/reference.html @@ -19,6 +19,7 @@ Copyright (c) 2021 Tomas Korbar Copyright (c) 2021 Nicolas Cavallari Copyright (c) 2022 Thijs Schreijer + Copyright (c) 2023 Sony Corporation / Snild Dolkow Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -1078,6 +1079,11 @@ exceed the maximum integer value. Input data at the end of a buffer will remain unprocessed if it is part of an XML token for which the end is not part of that buffer.

+

The application must make a concluding +XML_Parse or +XML_ParseBuffer call +with isFinal set to XML_TRUE.

+

XML_Parse

 enum XML_Status XMLCALL
@@ -1104,6 +1110,10 @@ piece of the document. Frequently, the last piece is empty (i.e.
 len is zero.)
 If a parse error occurred, it returns XML_STATUS_ERROR.
 Otherwise it returns XML_STATUS_OK value.
+Note that regardless of the return value, there is no guarantee that all
+provided input has been parsed; only after the
+concluding call will all handler callbacks and parsing errors have
+happened.
 
 
 

XML_ParseBuffer

diff --git a/expat/tests/basic_tests.c b/expat/tests/basic_tests.c index 71a5c0d3..31e02335 100644 --- a/expat/tests/basic_tests.c +++ b/expat/tests/basic_tests.c @@ -18,6 +18,7 @@ Copyright (c) 2019 David Loffredo Copyright (c) 2020 Tim Gates Copyright (c) 2021 Dong-hee Na + Copyright (c) 2023 Sony Corporation / Snild Dolkow Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -613,7 +614,7 @@ START_TEST(test_column_number_after_parse) { const char *text = ""; XML_Size colno; - if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) + if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(g_parser); colno = XML_GetCurrentColumnNumber(g_parser); @@ -664,7 +665,7 @@ START_TEST(test_line_number_after_error) { " \n" " "; /* missing */ XML_Size lineno; - if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) + if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE) != XML_STATUS_ERROR) fail("Expected a parse error"); @@ -684,7 +685,7 @@ START_TEST(test_column_number_after_error) { " \n" " "; /* missing */ XML_Size colno; - if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) + if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_TRUE) != XML_STATUS_ERROR) fail("Expected a parse error"); diff --git a/expat/tests/ns_tests.c b/expat/tests/ns_tests.c index 826018b6..5ecb09ac 100644 --- a/expat/tests/ns_tests.c +++ b/expat/tests/ns_tests.c @@ -18,6 +18,7 @@ Copyright (c) 2019 David Loffredo Copyright (c) 2020 Tim Gates Copyright (c) 2021 Dong-hee Na + Copyright (c) 2023 Sony Corporation / Snild Dolkow Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -81,13 +82,13 @@ START_TEST(test_return_ns_triplet) { if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) == XML_STATUS_ERROR) xml_failure(g_parser); - if (! g_triplet_start_flag) - fail("triplet_start_checker not invoked"); /* Check that unsetting "return triplets" fails while still parsing */ XML_SetReturnNSTriplet(g_parser, XML_FALSE); if (_XML_Parse_SINGLE_BYTES(g_parser, epilog, (int)strlen(epilog), XML_TRUE) == XML_STATUS_ERROR) xml_failure(g_parser); + if (! g_triplet_start_flag) + fail("triplet_start_checker not invoked"); if (! g_triplet_end_flag) fail("triplet_end_checker not invoked"); if (get_dummy_handler_flags()