Normalize xml processing
[anna.git] / source / html / DocumentMemory.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <anna/core/tracing/Logger.hpp>
10 #include <anna/core/tracing/TraceMethod.hpp>
11 #include <anna/config/defines.hpp>
12 #include <anna/core/functions.hpp>
13
14 #include <libxml/HTMLparser.h>
15
16 #include <anna/html/DocumentMemory.hpp>
17
18 using namespace std;
19 using namespace anna;
20
21 _xmlDoc* html::DocumentMemory::do_initialize(const char* content)
22 throw(RuntimeException) {
23   LOGMETHOD(TraceMethod tf("html::DocumentMemory", "do_initialize", ANNA_FILE_LOCATION));
24   setContent(content);
25   _xmlDoc* result = NULL;
26   LOGDEBUG(
27     string msg("xml::DocumentMemory::do_initialize | Content (char*): ");
28     msg += content;
29     Logger::debug(msg, ANNA_FILE_LOCATION);
30   );
31   result = htmlParseDoc((xmlChar*) content, NULL);
32
33   if(result == NULL)
34     throw RuntimeException(functions::asString("Error analizando documento HTML:\n%s", content), ANNA_FILE_LOCATION);
35
36   return result;
37 }
38
39 _xmlDoc* html::DocumentMemory::do_initialize(const anna::DataBlock& contain)
40 throw(RuntimeException) {
41   throw RuntimeException("html::DocumentMemory::do_initialize | Not implemented", ANNA_FILE_LOCATION);
42   return NULL;
43 }
44