From 08adf78fbff30d213891a533fbf43d91816b166a Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 30 Apr 2015 23:35:19 +0000 Subject: Recovered from parsing errors against an empty XML file. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@524 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 5 +++++ src/common/xml.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b10dc29..3349302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 15-05-01 Cyrille Bagard + * src/common/xml.c: + Recover from parsing errors against an empty XML file. + +15-05-01 Cyrille Bagard + * plugins/mobicore/mclf.c: * src/analysis/db/cdb.c: * src/format/dex/dex.c: diff --git a/src/common/xml.c b/src/common/xml.c index d01ae9b..1e2871b 100644 --- a/src/common/xml.c +++ b/src/common/xml.c @@ -145,7 +145,15 @@ void close_xml_file(xmlDocPtr xdoc, xmlXPathContextPtr context) gboolean open_xml_file(const char *filename, xmlDoc **xdoc, xmlXPathContextPtr *xpathCtx) { - *xdoc = xmlParseFile(filename); + /** + * On s'autorise à récupérer des erreurs de fichier vide, ie ne contenant que : + * + * + * + * On espère que la récupération d'autres situations d'erreurs est bien gérée. + */ + + *xdoc = xmlReadFile(filename, NULL, XML_PARSE_RECOVER); if (*xdoc == NULL) { -- cgit v0.11.2-87-g4458