Hi there,
"make check" für current APR trunk fails in testxml when used with libxml2:
testxml : Line 298: expected <20014>, but saw <73>
73 probably cpomes from here:
include/libxml2/libxml/xmlerror.h: XML_ERR_GT_REQUIRED, /* 73 */
and the 20014 is the expected APR_EGENERAL.
The expat implementation contains in xml/apr_xml_expat.c:
45 static apr_status_t do_parse(apr_xml_parser *parser,
46 const char *data, apr_size_t len,
47 int is_final)
48 {
...
53 int rv = XML_Parse(parser->xp, data, (int)len, is_final);
54
55 if (rv == 0) {
56 parser->error = APR_XML_ERROR_EXPAT;
...
59 }
60 }
61
62 /* ### better error code? */
63 return parser->error ? APR_EGENERAL : APR_SUCCESS;
64 }
65
66
67 static XMLParserImpl xml_parser_expat = {
68 do_parse,
69 cleanup_parser
70 };
For libxml2 we have in xml/apr_xml_libxml2.c:
39 static int libxml2_parse(apr_xml_parser* parser, const char* data,
40 apr_size_t sz, int final)
41 {
42 parser->xp_err = xmlParseChunk(parser->xp, data, sz, final);
43 if (parser->xp_err != 0) {
44 xmlErrorPtr errptr = xmlCtxtGetLastError(parser->xp);
45 parser->xp_msg = errptr->message;
46 /* this misnomer is used as a test for (any) parser error. */
47 parser->error = APR_XML_ERROR_EXPAT;
48 }
49 return parser->xp_err;
50 }
51 static XMLParserImpl xml_parser_libxml2 = {
52 libxml2_parse,
53 cleanup_parser
54 };
55
So the libxml2 implementation returns native libxml2 error codes, the
expat impl returns APR error codes. Since in the xml interface the
declaration is
apr_status_t (*Parse)(apr_xml_parser*, const char*, apr_size_t, int);
I think the libxml2 impl needs fixing.
Best regards,
Rainer