diff --git a/examples/DOM/Makefile.am b/examples/DOM/Makefile.am index 82d210bd..a68a50f6 100755 --- a/examples/DOM/Makefile.am +++ b/examples/DOM/Makefile.am @@ -1,8 +1,8 @@ -bin_PROGRAMS = domwriter +noinst_PROGRAMS = domwriter +AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS) LIBARABICA = $(top_builddir)/src/libarabica.la domwriter_SOURCES = DOMWriter.cpp domwriter_LDADD = $(LIBARABICA) -INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) \ No newline at end of file diff --git a/examples/Makefile.am b/examples/Makefile.am index 54715a65..c102c9f8 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -3,8 +3,6 @@ if WANT_DOM SUBDIRS += DOM endif if WANT_XPATH - SUBDIRS += XPath + SUBDIRS += XPath XSLT endif -install: - echo "Nothing to install here" diff --git a/examples/SAX/Makefile.am b/examples/SAX/Makefile.am index f8b29bc5..6acc332b 100755 --- a/examples/SAX/Makefile.am +++ b/examples/SAX/Makefile.am @@ -1,5 +1,6 @@ -bin_PROGRAMS = pyx simple_handler writer xmlbase +noinst_PROGRAMS = pyx simple_handler writer xmlbase +AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS) LIBARABICA = $(top_builddir)/src/libarabica.la pyx_SOURCES = pyx.cpp @@ -14,4 +15,3 @@ writer_LDADD = $(LIBARABICA) xmlbase_SOURCES = xmlbase.cpp xmlbase_LDADD = $(LIBARABICA) -INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) diff --git a/examples/SAX/wrapper.cpp b/examples/SAX/wrapper.cpp index 3471c94a..55ff3aeb 100644 --- a/examples/SAX/wrapper.cpp +++ b/examples/SAX/wrapper.cpp @@ -42,16 +42,8 @@ int main(int argc, char* argv[]) parser.setDTDHandler(myHandler); parser.setErrorHandler(myHandler); parser.setEntityResolver(myHandler); - - try - { - parser.setProperty(pNames.declHandler, static_cast(myHandler)); - parser.setProperty(pNames.lexicalHandler, static_cast(myHandler)); - } - catch(SAX::SAXException& e) - { - std::cout << e.what() << std::endl; - } // catch + parser.setDeclHandler(myHandler); + parser.setLexicalHandler(myHandler); std::string file(argv[i]); diff --git a/examples/Utils/Makefile.am b/examples/Utils/Makefile.am index a2e030cd..747538ab 100755 --- a/examples/Utils/Makefile.am +++ b/examples/Utils/Makefile.am @@ -1,8 +1,8 @@ -bin_PROGRAMS = transcode +noinst_PROGRAMS = transcode +AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS) LIBARABICA = $(top_builddir)/src/libarabica.la transcode_SOURCES = transcode.cpp transcode_LDADD = $(LIBARABICA) -INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) \ No newline at end of file diff --git a/examples/XPath/Makefile.am b/examples/XPath/Makefile.am index 7defba23..4311bdd7 100755 --- a/examples/XPath/Makefile.am +++ b/examples/XPath/Makefile.am @@ -1,12 +1,9 @@ -bin_PROGRAMS = xgrep +noinst_PROGRAMS = xgrep +AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@ LIBARABICA = $(top_builddir)/src/libarabica.la xgrep_SOURCES = xgrep.cpp xgrep_LDADD = $(LIBARABICA) -INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) - -jez: - echo @top_builddir@ diff --git a/examples/XSLT/Makefile.am b/examples/XSLT/Makefile.am new file mode 100755 index 00000000..eb81e1df --- /dev/null +++ b/examples/XSLT/Makefile.am @@ -0,0 +1,12 @@ +bin_PROGRAMS = mangle + +AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@ +LIBARABICA = $(top_builddir)/src/libarabica.la + +mangle_SOURCES = mangle.cpp \ + scope_test.hpp \ + xslt_test.hpp +mangle_LDADD = $(LIBARABICA) + + + diff --git a/examples/XSLT/mangle.cpp b/examples/XSLT/mangle.cpp new file mode 100755 index 00000000..b06626dd --- /dev/null +++ b/examples/XSLT/mangle.cpp @@ -0,0 +1,93 @@ + +#pragma warning(disable : 4250) + +#include +#include +#include + +#include +#include +#include + +void test_suite(int argc, const char* argv[]); +DOM::Document buildDOM(const std::string& xml); + +int main(int argc, const char* argv[]) +{ +/* + if((argc >= 2) && (std::string("test") == argv[1])) + { + test_suite(argc, argv); + return 0; + } // if ... +*/ + + if(argc != 3) + { + std::cout << "mangle is an (in-development) XSLT processor\n" + << argv[0] << " xmlfile xsltfile" << std::endl; + return 0; + } // if ... + + Arabica::XSLT::StylesheetCompiler compiler; + std::ostringstream errors; + try + { + SAX::InputSource source(argv[2]); + std::auto_ptr stylesheet = compiler.compile(source); + if(stylesheet.get() == 0) + { + std::cerr << "Couldn't compile stylesheet: " << compiler.error() << std::endl; + return -1; + } // if ... + + stylesheet->set_error_output(errors); + + DOM::Document document = buildDOM(argv[1]); + if(document == 0) + { + std::cerr << "Could not parse XML source" << std::endl; + return 0; + } // if ... + document.normalize(); + stylesheet->execute(document); + } + catch(const std::runtime_error& ex) + { + std::cerr << ex.what() << std::endl; + } // catch + + std::cerr << "\n\n" << errors.str() << std::endl; + + return 0; +} // main + +DOM::Document buildDOM(const std::string& filename) +{ + SAX::InputSource is(filename); + SAX2DOM::Parser parser; + parser.parse(is); + + return parser.getDocument(); +} // buildDOM + +/* +/////////////////////////////////////////////// +#include "../src/test/CppUnit/TestRunner.hpp" +#include "../src/test/CppUnit/framework/Test.h" +#include "../src/test/CppUnit/framework/TestSuite.h" + +#include "tests/scope_test.hpp" + +typedef std::string string_type; +typedef Arabica::default_string_adaptor string_adaptor; + +void test_suite(int argc, const char* argv[]) +{ + TestRunner runner; + + runner.addTest("ScopeTest", ScopeTest_suite()); + + runner.run(argc-1, argv+1); +} // test_suite +*/