mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-26 21:58:39 +01:00
merged with mangle-dev branch
This commit is contained in:
parent
9e7dbd3e26
commit
59dee666d8
8 changed files with 116 additions and 24 deletions
|
@ -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)
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<SAX::DeclHandler&>(myHandler));
|
||||
parser.setProperty(pNames.lexicalHandler, static_cast<SAX::LexicalHandler&>(myHandler));
|
||||
}
|
||||
catch(SAX::SAXException& e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
} // catch
|
||||
parser.setDeclHandler(myHandler);
|
||||
parser.setLexicalHandler(myHandler);
|
||||
|
||||
std::string file(argv[i]);
|
||||
|
||||
|
|
|
@ -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)
|
|
@ -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@
|
||||
|
||||
|
|
12
examples/XSLT/Makefile.am
Executable file
12
examples/XSLT/Makefile.am
Executable file
|
@ -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)
|
||||
|
||||
|
||||
|
93
examples/XSLT/mangle.cpp
Executable file
93
examples/XSLT/mangle.cpp
Executable file
|
@ -0,0 +1,93 @@
|
|||
|
||||
#pragma warning(disable : 4250)
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <SAX/InputSource.h>
|
||||
#include <DOM/SAX2DOM/SAX2DOM.h>
|
||||
#include <XSLT/XSLT.hpp>
|
||||
|
||||
void test_suite(int argc, const char* argv[]);
|
||||
DOM::Document<std::string> 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<Arabica::XSLT::Stylesheet> 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<std::string> 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<std::string> buildDOM(const std::string& filename)
|
||||
{
|
||||
SAX::InputSource is(filename);
|
||||
SAX2DOM::Parser<std::string> 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<std::string> string_adaptor;
|
||||
|
||||
void test_suite(int argc, const char* argv[])
|
||||
{
|
||||
TestRunner runner;
|
||||
|
||||
runner.addTest("ScopeTest", ScopeTest_suite<string_type, string_adaptor>());
|
||||
|
||||
runner.run(argc-1, argv+1);
|
||||
} // test_suite
|
||||
*/
|
Loading…
Reference in a new issue