summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@netsurf-browser.org>2012-03-25 10:13:53 +0000
committerDaniel Silverstone <dsilvers@netsurf-browser.org>2012-03-25 10:13:53 +0000
commitef238c17fe17cc1e35d65758d837cb470ed9af66 (patch)
treea2016f497761339892468f6866790f23ef6ff6c4
parent99701232b2a363c0303923b580aec806e9e3a91d (diff)
downloadnetsurf-ef238c17fe17cc1e35d65758d837cb470ed9af66.tar.gz
netsurf-ef238c17fe17cc1e35d65758d837cb470ed9af66.tar.bz2
For now, build a shonky libxml tree. Later, rewrite save_complete for libdom
svn path=/trunk/netsurf/; revision=13664
-rw-r--r--desktop/save_complete.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 4703c8d55..33234ce2c 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -118,7 +118,7 @@ bool save_complete_html(hlcache_handle *c, const char *path, bool index,
struct content_html_object *object;
char filename[256];
unsigned int i, count;
- xmlDocPtr doc;
+ xmlDocPtr doc = NULL;
bool res;
if (content_get_type(c) != CONTENT_HTML)
@@ -240,10 +240,24 @@ bool save_complete_html(hlcache_handle *c, const char *path, bool index,
return false;
}
- /*save_complete_list_dump();*/
-
- /* copy document */
- doc = xmlCopyDoc(html_get_document(c), 1);
+ /* create shiny XML document from the content source */
+
+ {
+ unsigned long html_size;
+ const char *html_source;
+ xmlChar *terminated_html_source;
+ html_source = content_get_source_data(c, &html_size);
+
+ terminated_html_source = malloc(html_size + 1);
+ if (terminated_html_source != NULL) {
+ memcpy(terminated_html_source, html_source, html_size);
+ terminated_html_source[html_size] = '\0';
+ doc = htmlParseDoc(terminated_html_source, NULL);
+ free(terminated_html_source);
+ }
+
+ }
+
if (doc == NULL) {
warn_user("NoMemory", 0);
return false;