For now, build a shonky libxml tree. Later, rewrite save_complete for libdom

svn path=/trunk/netsurf/; revision=13664
This commit is contained in:
Daniel Silverstone 2012-03-25 10:13:53 +00:00
parent 99701232b2
commit ef238c17fe

View File

@ -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();*/
/* 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);
}
}
/* copy document */
doc = xmlCopyDoc(html_get_document(c), 1);
if (doc == NULL) {
warn_user("NoMemory", 0);
return false;