summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-03-13 18:07:26 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-03-16 18:10:18 +0100
commit9fa3f055e43ec07e0c0198647d3454a585c32db7 (patch)
tree08f9d2477c22be1653cb7307d109499cdfab3b9e
parent272db68e131a20652c98453b75b9c743cda2b327 (diff)
downloadlibrest-9fa3f055e43ec07e0c0198647d3454a585c32db7.tar.gz
Don't dump XML parsing errors to stderr/stdout by default
These errors should only be shown if REST_DEBUG=xml-parser is set.
-rw-r--r--rest/rest-xml-parser.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/rest/rest-xml-parser.c b/rest/rest-xml-parser.c
index 4447a1a..4dec10d 100644
--- a/rest/rest-xml-parser.c
+++ b/rest/rest-xml-parser.c
@@ -40,6 +40,15 @@ rest_xml_parser_init (RestXmlParser *self)
{
}
+static void
+rest_xml_parser_xml_reader_error (void *arg,
+ const char *msg,
+ xmlParserSeverities severity,
+ xmlTextReaderLocatorPtr locator)
+{
+ REST_DEBUG(XML_PARSER, "%s", msg);
+}
+
/**
* rest_xml_parser_new:
*
@@ -93,6 +102,7 @@ rest_xml_parser_parse_from_data (RestXmlParser *parser,
NULL, /* URL? */
NULL, /* encoding */
XML_PARSE_RECOVER | XML_PARSE_NOCDATA);
+ xmlTextReaderSetErrorHandler(reader, rest_xml_parser_xml_reader_error, NULL);
while (xmlTextReaderRead (reader) == 1)
{