Subject: | Won't compile with Libxml that doesn't have HTML parser. htmlDocPtr undefined |
One of the possible configuration of Libxml2 is without the HTML parser. Libxml.xs doesn't tolerate this.
The attached patch removes the 3 HTML parse functions when Libxml2 doesn't have them.
diff --unif --rec XML-LibXML-1.58/LibXML.xs XML-LibXML/LibXML.xs
--- XML-LibXML-1.58/LibXML.xs 2004-03-24 23:06:14.000000000 +0000
+++ XML-LibXML/LibXML.xs 2005-12-06 07:24:19.000000000 +0000
@@ -1346,19 +1346,26 @@
SV * self
SV * string
PREINIT:
+#ifdef LIBXML_HTML_ENABLED
STRLEN len;
char * ptr;
SV * saved_error;
HV * real_obj;
htmlDocPtr real_doc;
int recover = 0;
+#endif
INIT:
+#ifdef LIBXML_HTML_ENABLED
ptr = SvPV(string, len);
if (len <= 0) {
croak("Empty string");
XSRETURN_UNDEF;
}
+#else
+ croak("HTML parser not implemented in this XML::LibXML");
+#endif
CODE:
+#ifdef LIBXML_HTML_ENABLED
RETVAL = &PL_sv_undef;
LibXML_init_error(&saved_error);
real_obj = LibXML_init_parser(self);
@@ -1381,6 +1388,7 @@
LibXML_cleanup_callbacks();
LibXML_cleanup_parser();
LibXML_report_error(saved_error, recover);
+#endif
OUTPUT:
RETVAL
@@ -1389,12 +1397,19 @@
SV * self
SV * fh
PREINIT:
+#ifdef LIBXML_HTML_ENABLED
SV * saved_error;
HV * real_obj;
htmlDocPtr real_doc;
int well_formed;
int recover = 0;
+#endif
+ INIT:
+#ifndef LIBXML_HTML_ENABLED
+ croak("HTML parser not implemented in this XML::LibXML");
+#endif
CODE:
+#ifdef LIBXML_HTML_ENABLED
RETVAL = &PL_sv_undef;
LibXML_init_error(&saved_error);
real_obj = LibXML_init_parser(self);
@@ -1457,6 +1472,7 @@
LibXML_cleanup_callbacks();
LibXML_cleanup_parser();
LibXML_report_error(saved_error, recover);
+#endif
OUTPUT:
RETVAL
@@ -1465,19 +1481,26 @@
SV * self
SV * filename_sv
PREINIT:
+#ifdef LIBXML_HTML_ENABLED
STRLEN len;
char * filename;
SV * saved_error;
HV * real_obj;
htmlDocPtr real_doc;
int recover = 0;
+#endif
INIT:
+#ifdef LIBXML_HTML_ENABLED
filename = SvPV(filename_sv, len);
if (len <= 0) {
croak("Empty filename");
XSRETURN_UNDEF;
}
+#else
+ croak("HTML parser not implemented in this XML::LibXML");
+#endif
CODE:
+#ifdef LIBXML_HTML_ENABLED
RETVAL = &PL_sv_undef;
LibXML_init_error(&saved_error);
real_obj = LibXML_init_parser(self);
@@ -1495,6 +1518,7 @@
LibXML_cleanup_callbacks();
LibXML_cleanup_parser();
LibXML_report_error(saved_error, recover);
+#endif
OUTPUT:
RETVAL