diff options
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | src/render_xml.cc | 31 | ||||
-rw-r--r-- | src/xsl_processor.cc | 76 | ||||
-rw-r--r-- | src/xsl_processor.hh | 28 |
5 files changed, 0 insertions, 144 deletions
diff --git a/Makefile.am b/Makefile.am index 091e050..c9849cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,14 +20,6 @@ bin_sudo_users_SCRIPTS += scripts/vyatta-show-log-file bin_sudo_users_SCRIPTS += scripts/vyatta-show-dmesg bin_sudo_users_SCRIPTS += scripts/vyatta-show-dmesg-all -sbin_PROGRAMS = src/render_xml - -src_render_xml_SOURCES = src/render_xml.cc -src_render_xml_SOURCES += src/xsl_processor.cc -src_render_xml_SOURCES += src/xsl_processor.hh -src_render_xml_CPPFLAGS = -I$(srcdir)/src -src_render_xml_LDADD = -lsablot - cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \ cpio -0pd diff --git a/debian/control b/debian/control index 63b5611..1cc05f7 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,6 @@ Depends: bash (>= 3.1), lsof, coreutils (>= 5.97-5.3), host, - libsablot0 Suggests: util-linux (>= 2.13-5), net-tools, ncurses-bin (>= 5.5-5), diff --git a/src/render_xml.cc b/src/render_xml.cc deleted file mode 100644 index a213387..0000000 --- a/src/render_xml.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include <stdio.h> -#include <unistd.h> -#include <iostream> -#include <string> - -#include "xsl_processor.hh" - -using namespace std; - -int -main(int argc, char* argv[]) -{ - if (argc < 2) { - printf("usage: %s <xsl_file>\n", argv[0]); - printf(" (takes XML from stdin)\n"); - exit(1); - } - - char buf[2048]; - string xml_str = ""; - while (fgets(buf, 2048, stdin) != NULL) { - xml_str += buf; - } - - string xsl_file(argv[1]); - list<pair<string,string> > listParams; - XSLProcessor xsl_processor(false); - cout << xsl_processor.transform(xml_str, xsl_file, listParams) << endl; - - exit(0); -} diff --git a/src/xsl_processor.cc b/src/xsl_processor.cc deleted file mode 100644 index f40b611..0000000 --- a/src/xsl_processor.cc +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Module: xsl_processor.cc - * - * Author: Michael Larson - * Date: 2005 - */ -#include <string> -#include <iostream> -#include <sablot.h> -#include "xsl_processor.hh" - -using namespace std; - -/** - * - **/ -XSLProcessor::XSLProcessor(bool debug) : _debug(debug) -{ - -} - -/** - * - **/ -XSLProcessor::~XSLProcessor() -{ - -} - -/** - * - **/ -std::string -XSLProcessor::transform(const string &input, const string &xsl, const list<pair<string,string> > & listParams) -{ - if (_debug) { - cout << "input to xsl processor: " << endl << input << endl << xsl << endl; - } - - //for now we'll dump this into a file, but this will have to change soon. - string formatted_output; - - //example below from http://www.gingerall.org/ga/html/sablot/sparse-frameset.html - SablotSituation S; - SablotHandle proc; - SDOM_Document xml; - - SablotCreateSituation(&S); - - SablotParseBuffer(S, input.c_str(), &xml); - - SablotCreateProcessorForSituation(S, &proc); - SablotAddArgTree(S, proc, "data", xml); - list<pair<string, string> >::const_iterator i = listParams.begin(); - list<pair<string, string> >::const_iterator iEnd = listParams.end(); - while (i != iEnd) { - SablotAddParam(S, proc, i->first.c_str(), i->second.c_str()); - i++; - } - SablotRunProcessorGen(S, proc, xsl.c_str(), "arg:/data", "arg:/out"); - - char *result; - SablotGetResultArg(proc, "arg:/out", &result); - - formatted_output = result; - - //now strip away the first line - int pos = formatted_output.find("\n"); - formatted_output = formatted_output.substr(pos + 1, formatted_output.length() - pos - 1); - - SablotFree(result); - SablotDestroyProcessor(proc); - SablotDestroySituation(S); - - return formatted_output; -} diff --git a/src/xsl_processor.hh b/src/xsl_processor.hh deleted file mode 100644 index ac9b047..0000000 --- a/src/xsl_processor.hh +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Module: xsl_processor.hh - * - * Author: Michael Larson - * Date: 2005 - */ -#ifndef __XSL_PROCESSOR_HH__ -#define __XSL_PROCESSOR_HH__ - -#include <list> -#include <string> -#include <utility> - - -class XSLProcessor -{ -public: - XSLProcessor(bool debug); - ~XSLProcessor(); - - std::string - transform(const std::string &input, const std::string &xsl, const std::list<std::pair<std::string, std::string> > & listParams); - -private: - bool _debug; -}; - -#endif //__XSL_PROCESSOR_HH__ |