[libgepub] Ignore HTML entities parse error when loading xml



commit 395779ecfde60fbc887474862fc40b9670113692
Author: Daniel Garcia Moreno <danigm wadobo com>
Date:   Sat Jun 25 22:08:05 2016 +0200

    Ignore HTML entities parse error when loading xml
    
    We use libxml to load the xhtml and replace each resource path with a
    custom epub:// path. Libxml shows error in the stderr when the xhtml has
    html entities:
    
    Entity: line 21: parser error : Entity 'copy' not defined
    
    We don't mind html entities in this case, because we only want to replace
    resources path so I've replaced xmlRecoverMemory by xmlReadMemory to pass
    the parser options XML_PARSE_NOWARNING and XML_PARSE_NOERROR and we won't
    see the error in the console anymore.

 libgepub/gepub-utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libgepub/gepub-utils.c b/libgepub/gepub-utils.c
index 2f81f33..d120ffd 100644
--- a/libgepub/gepub-utils.c
+++ b/libgepub/gepub-utils.c
@@ -230,7 +230,7 @@ gepub_utils_replace_resources (GBytes *content, const gchar *path)
     gsize bufsize;
 
     data = g_bytes_get_data (content, &bufsize);
-    doc = xmlRecoverMemory (data, bufsize);
+    doc = xmlReadMemory (data, bufsize, "", NULL, XML_PARSE_NOWARNING | XML_PARSE_NOERROR);
     root_element = xmlDocGetRootElement (doc);
 
     // replacing css resources


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]