1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #include <libxml/parser.h>
11 #include <anna/core/tracing/Logger.hpp>
12 #include <anna/core/tracing/TraceMethod.hpp>
13 #include <anna/config/defines.hpp>
14 #include <anna/core/functions.hpp>
16 #include <anna/xml/DocumentMemory.hpp>
20 using namespace anna::xml;
22 _xmlDoc* DocumentMemory::do_initialize(const char* content)
23 throw(RuntimeException) {
24 LOGMETHOD(TraceMethod tf("anna::xml::DocumentMemory", "do_initialize (char*)", ANNA_FILE_LOCATION));
28 string msg("xml::DocumentMemory::do_initialize | Content (char*): ");
30 Logger::debug(msg, ANNA_FILE_LOCATION);
33 if((result = xmlParseMemory(content, anna_strlen(content))) == NULL) {
34 string msg("xml::DocumentMemory::do_initialize | Content: ");
36 msg += " | Error parsing";
37 throw RuntimeException(msg, ANNA_FILE_LOCATION);
43 _xmlDoc* DocumentMemory::do_initialize(const anna::DataBlock& content)
44 throw(RuntimeException) {
45 LOGMETHOD(TraceMethod tf("anna::xml::DocumentMemory", "do_initialize (DataBlock)", ANNA_FILE_LOCATION));
49 string msg("xml::DocumentMemory::do_initialize | Content: ");
50 msg += functions::asString(content, 24);
51 Logger::debug(msg, ANNA_FILE_LOCATION);
54 if((result = xmlParseMemory(content.getData(), content.getSize())) == NULL) {
55 string msg("xml::DocumentMemory::do_initialize | Content: ");
56 msg += functions::asString(content, 24);
57 msg += " | Error parsing";
58 throw RuntimeException(msg, ANNA_FILE_LOCATION);