Skip to content

Commit e4a54ae

Browse files
authored
Fix compilation with libxml2 2.12.0 (#417)
Fixes #418
1 parent bc5fa30 commit e4a54ae

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# xml2 (development version)
22

3+
* Now compatible with limxml2 2.12.0 and later (@KNnut).
4+
35
* Fix format string issues detected in R-devel.
46

57
* `xml_serialize()` now includes the document type so that `xml_unserialize()` works also for HTML documents (#407, @HenrikBengtsson).

src/xml2_init.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
#include <string>
1111
#include "xml2_utils.h"
1212

13+
/* * *
14+
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
15+
* Date: Tue, 24 Oct 2023 15:02:36 +0200
16+
* https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
17+
*
18+
* error: Make more xmlError structs constant
19+
*/
20+
#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
21+
void handleStructuredError(void* userData, const xmlError* error) {
22+
#else
1323
void handleStructuredError(void* userData, xmlError* error) {
24+
#endif
1425

1526
BEGIN_CPP
1627
std::string message = std::string(error->message);

src/xml2_schema.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
#include "xml2_types.h"
1010
#include "xml2_utils.h"
1111

12+
/* * *
13+
* Author: Nick Wellnhofer <wellnhofer@aevum.de>
14+
* Date: Tue, 24 Oct 2023 15:02:36 +0200
15+
* https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
16+
*
17+
* error: Make more xmlError structs constant
18+
*/
19+
#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200)
20+
void handleSchemaError(void* userData, const xmlError* error) {
21+
#else
1222
void handleSchemaError(void* userData, xmlError* error) {
23+
#endif
1324
std::vector<std::string> * vec = (std::vector<std::string> *) userData;
1425
std::string message = std::string(error->message);
1526
message.resize(message.size() - 1);
@@ -22,8 +33,6 @@ extern "C" SEXP doc_validate(SEXP doc_sxp, SEXP schema_sxp) {
2233
XPtrDoc doc(doc_sxp);
2334
XPtrDoc schema(schema_sxp);
2435

25-
xmlLineNumbersDefault(1);
26-
2736
BEGIN_CPP
2837

2938
std::vector<std::string> vec;

0 commit comments

Comments
 (0)