diff options
author | randomdan <randomdan@localhost> | 2013-03-20 14:12:04 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-03-20 14:12:04 +0000 |
commit | 0de1e84821146b5103af9ec22dc023050d0cf68e (patch) | |
tree | 680b8de9f974a35502b2412c21d465a269b31c7d | |
parent | Have xml cache documents owned by a xmlpp instance (diff) | |
download | project2-0de1e84821146b5103af9ec22dc023050d0cf68e.tar.bz2 project2-0de1e84821146b5103af9ec22dc023050d0cf68e.tar.xz project2-0de1e84821146b5103af9ec22dc023050d0cf68e.zip |
Really dirty hack to make libxmlpp not crash with HTML docs
-rw-r--r-- | project2/xml/xmlDocumentCache.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/project2/xml/xmlDocumentCache.cpp b/project2/xml/xmlDocumentCache.cpp index 96848e7..cbc13ed 100644 --- a/project2/xml/xmlDocumentCache.cpp +++ b/project2/xml/xmlDocumentCache.cpp @@ -50,6 +50,13 @@ class XmlDocumentCachePopulator : public CurlCompleteCallback { XmlDocumentCache::documents.insert(XmlDocumentCache::Documents::value_type(url, boost::bind(helperThrow<XmlParseError>, std::string(xmlGetLastError()->message)))); } + + // Dirty hack alert + // xmlpp doesn't play nicely with HTML documents... + // sooo ummm, lie and hope it doesn't break something else + doc->type = XML_DOCUMENT_NODE; + // end hack + XmlDocumentCache::documents.insert(XmlDocumentCache::Documents::value_type(url, boost::bind(helperReturnDocument, XmlDocumentCache::DocumentPtr(new xmlpp::Document(doc))))); Logger()->messagebf(LOG_DEBUG, "Download of '%s' completed, stored", url); @@ -101,6 +108,7 @@ class XmlDocumentCacheClearer : public ComponentLoader { { Logger()->messagef(LOG_DEBUG, "%s: Clearing XML document cache", __PRETTY_FUNCTION__); XmlDocumentCache::documents.clear(); + Logger()->messagef(LOG_DEBUG, "%s: Cleared XML document cache", __PRETTY_FUNCTION__); } }; DECLARE_CUSTOM_COMPONENT_LOADER("XmlDocumentCacheClearer", XmlDocumentCacheClearer, XmlDocumentCacheClearer, ComponentLoader); |