diff --git a/NEWS.md b/NEWS.md index ae4ca56..f8e422a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,8 @@ * `xml_find_int()` analogous to `xml_find_num()` for returning integers matched by an XPath (#365, @michaelchirico). +* Now compatible with limxml2 2.12.0 and later (@KNnut). + * Fix format string issues detected in R-devel. * `xml_serialize()` now includes the document type so that `xml_unserialize()` works also for HTML documents (#407, @HenrikBengtsson). diff --git a/src/xml2_init.cpp b/src/xml2_init.cpp index 906dbc9..25fb031 100644 --- a/src/xml2_init.cpp +++ b/src/xml2_init.cpp @@ -10,7 +10,18 @@ #include #include "xml2_utils.h" +/* * * + * Author: Nick Wellnhofer + * Date: Tue, 24 Oct 2023 15:02:36 +0200 + * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711 + * + * error: Make more xmlError structs constant + */ +#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) +void handleStructuredError(void* userData, const xmlError* error) { +#else void handleStructuredError(void* userData, xmlError* error) { +#endif BEGIN_CPP std::string message = std::string(error->message); diff --git a/src/xml2_schema.cpp b/src/xml2_schema.cpp index 345ca50..3870e76 100644 --- a/src/xml2_schema.cpp +++ b/src/xml2_schema.cpp @@ -9,7 +9,18 @@ #include "xml2_types.h" #include "xml2_utils.h" +/* * * + * Author: Nick Wellnhofer + * Date: Tue, 24 Oct 2023 15:02:36 +0200 + * https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711 + * + * error: Make more xmlError structs constant + */ +#if defined(LIBXML_VERSION) && (LIBXML_VERSION >= 21200) +void handleSchemaError(void* userData, const xmlError* error) { +#else void handleSchemaError(void* userData, xmlError* error) { +#endif std::vector * vec = (std::vector *) userData; std::string message = std::string(error->message); message.resize(message.size() - 1); @@ -22,8 +33,6 @@ extern "C" SEXP doc_validate(SEXP doc_sxp, SEXP schema_sxp) { XPtrDoc doc(doc_sxp); XPtrDoc schema(schema_sxp); - xmlLineNumbersDefault(1); - BEGIN_CPP std::vector vec;