[librest] Don't dump XML parsing errors to stderr/stdout by default
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest] Don't dump XML parsing errors to stderr/stdout by default
- Date: Tue, 17 Mar 2015 14:02:27 +0000 (UTC)
commit 9fa3f055e43ec07e0c0198647d3454a585c32db7
Author: Christophe Fergeau <cfergeau redhat com>
Date: Fri Mar 13 18:07:26 2015 +0100
Don't dump XML parsing errors to stderr/stdout by default
These errors should only be shown if REST_DEBUG=xml-parser is set.
rest/rest-xml-parser.c | 10 ++++++++++
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]