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 //
13 #include <anna/core/core.hpp>
14 #include <anna/xml/xml.hpp>
16 #include <anna/app/Application.hpp>
18 class Test : public app::Application {
23 void run () throw (anna::RuntimeException);
28 int main (int argc, const char** argv)
30 CommandLine& commandLine (CommandLine::instantiate ());
33 xml::functions::initialize ();
36 commandLine.initialize (argv, argc);
37 commandLine.verify ();
39 Logger::setLevel (Logger::Debug);
40 Logger::initialize ("XML", new TraceWriter ("file.trace", 2048000));
44 catch (Exception& ex) {
45 cout << ex.asString () << endl;
52 app::Application ("testfunctions", "Checking xml binary", "1.0")
54 CommandLine& commandLine (CommandLine::instantiate ());
56 commandLine.add ("xml", CommandLine::Argument::Mandatory, "XML document");
60 throw (RuntimeException)
62 CommandLine& commandLine (CommandLine::instantiate ());
64 xml::DocumentFile xmlDoc;
66 xmlDoc.initialize (commandLine.getValue ("xml"));
68 xml::Compressor compressor;
69 const DataBlock& dataBlock = compressor.apply (xmlDoc);
71 Logger::debug (anna::functions::asString (dataBlock, 24), ANNA_FILE_LOCATION);
72 cout << "Compression: " << anna::functions::asString (dataBlock, 24) << endl;
73 cout << dataBlock.getSize () << " bytes" << endl << endl;
75 xml::Decompressor decompressor;
76 const xml::Document& xmlDoc2 = decompressor.apply (dataBlock);
77 cout << "DeCompression: " << anna::functions::asString (xmlDoc2.getContent (), 24) << endl;