You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(18) |
Dec
(18) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(8) |
Feb
(8) |
Mar
|
Apr
(2) |
May
(8) |
Jun
(5) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(5) |
| 2010 |
Jan
|
Feb
(4) |
Mar
(8) |
Apr
(6) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
(39) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <vac...@us...> - 2009-06-02 16:42:52
|
Revision: 150
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=150&view=rev
Author: vaclavslavik
Date: 2009-06-02 16:42:51 +0000 (Tue, 02 Jun 2009)
Log Message:
-----------
make extern "C" callback functions static so that they are not exported as globally visible symbols
Modified Paths:
--------------
trunk/src/libxml/dtd_impl.cxx
trunk/src/libxml/event_parser.cxx
trunk/src/libxml/init.cxx
trunk/src/libxml/tree_parser.cxx
trunk/src/libxslt/init.cxx
trunk/src/libxslt/stylesheet.cxx
Modified: trunk/src/libxml/dtd_impl.cxx
===================================================================
--- trunk/src/libxml/dtd_impl.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxml/dtd_impl.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -51,10 +51,24 @@
using namespace xml::impl;
//####################################################################
-namespace {
- extern "C" void dtd_error (void *ctxt, const char *message, ...);
- extern "C" void dtd_warning (void *ctxt, const char*, ...);
-} // end anonymous namespace
+extern "C"
+{
+ //####################################################################
+ static void dtd_error (void *ctxt, const char *message, ...) {
+ dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
+
+ va_list ap;
+ va_start(ap, message);
+ printf2string(dtd->error_, message, ap);
+ va_end(ap);
+ }
+ //####################################################################
+ static void dtd_warning (void *ctxt, const char*, ...) {
+ dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
+ ++dtd->warnings_;
+ }
+ //####################################################################
+}
//####################################################################
dtd_impl::dtd_impl (const char *filename) : warnings_(0), dtd_(0) {
if ( (dtd_ = xmlParseDTD(0, reinterpret_cast<const xmlChar*>(filename))) == 0) {
@@ -89,22 +103,3 @@
dtd_ = 0;
return xmldtd;
}
-//####################################################################
-namespace {
- //####################################################################
- extern "C" void dtd_error (void *ctxt, const char *message, ...) {
- dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
-
- va_list ap;
- va_start(ap, message);
- printf2string(dtd->error_, message, ap);
- va_end(ap);
- }
- //####################################################################
- extern "C" void dtd_warning (void *ctxt, const char*, ...) {
- dtd_impl *dtd = static_cast<dtd_impl*>(ctxt);
- ++dtd->warnings_;
- }
- //####################################################################
-}
-//####################################################################
Modified: trunk/src/libxml/event_parser.cxx
===================================================================
--- trunk/src/libxml/event_parser.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxml/event_parser.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -70,18 +70,8 @@
//####################################################################
namespace {
const std::size_t const_buffer_size = 4096;
+}
- extern "C" xmlEntityPtr cb_get_entity (void *, const xmlChar *name);
- extern "C" void cb_start_element (void *parser, const xmlChar *tag, const xmlChar **props);
- extern "C" void cb_end_element (void *parser, const xmlChar *tag);
- extern "C" void cb_text (void *parser, const xmlChar *text, int length);
- extern "C" void cb_pi (void *parser, const xmlChar *target, const xmlChar *data);
- extern "C" void cb_comment (void *parser, const xmlChar *text);
- extern "C" void cb_cdata (void *parser, const xmlChar *text, int length);
- extern "C" void cb_warning (void *parser, const char *message, ...);
- extern "C" void cb_error (void *parser, const char *message, ...);
- extern "C" void cb_ignore (void*, const xmlChar*, int);
-} // end anonymous namespace
//####################################################################
struct xml::impl::epimpl {
public:
@@ -107,6 +97,55 @@
epimpl (const epimpl&);
epimpl& operator= (const epimpl&);
};
+
+extern "C"
+{
+ //####################################################################
+ static void cb_start_element (void *parser, const xmlChar *tag, const xmlChar **props)
+ { static_cast<epimpl*>(parser)->event_start_element(tag, props); }
+ //####################################################################
+ static void cb_end_element (void *parser, const xmlChar *tag)
+ { static_cast<epimpl*>(parser)->event_end_element(tag); }
+ //####################################################################
+ static void cb_text (void *parser, const xmlChar *text, int length)
+ { static_cast<epimpl*>(parser)->event_text(text, length); }
+ //####################################################################
+ static void cb_pi (void *parser, const xmlChar *target, const xmlChar *data)
+ { static_cast<epimpl*>(parser)->event_pi(target, data); }
+ //####################################################################
+ static void cb_comment (void *parser, const xmlChar *text)
+ { static_cast<epimpl*>(parser)->event_comment(text); }
+ //####################################################################
+ static void cb_cdata (void *parser, const xmlChar *text, int length)
+ { static_cast<epimpl*>(parser)->event_cdata(text, length); }
+ //####################################################################
+ static void cb_warning (void *parser, const char *message, ...) {
+ std::string complete_message;
+
+ va_list ap;
+ va_start(ap, message);
+ printf2string(complete_message, message, ap);
+ va_end(ap);
+
+ static_cast<epimpl*>(parser)->event_warning(complete_message);
+ }
+ //####################################################################
+ static void cb_error (void *parser, const char *message, ...) {
+ std::string complete_message;
+
+ va_list ap;
+ va_start(ap, message);
+ printf2string(complete_message, message, ap);
+ va_end(ap);
+
+ static_cast<epimpl*>(parser)->event_error(complete_message);
+ }
+ //####################################################################
+ static void cb_ignore (void*, const xmlChar*, int) {
+ return;
+ }
+} // extern "C"
+
//####################################################################
xml::event_parser::event_parser (void) {
pimpl_ = new epimpl(*this);
@@ -302,53 +341,3 @@
parser_status_ = false;
xmlStopParser(parser_context_);
}
-//####################################################################
-namespace {
- //####################################################################
- extern "C" xmlEntityPtr cb_get_entity (void *, const xmlChar *name)
- { return xmlGetPredefinedEntity(name); }
- //####################################################################
- extern "C" void cb_start_element (void *parser, const xmlChar *tag, const xmlChar **props)
- { static_cast<epimpl*>(parser)->event_start_element(tag, props); }
- //####################################################################
- extern "C" void cb_end_element (void *parser, const xmlChar *tag)
- { static_cast<epimpl*>(parser)->event_end_element(tag); }
- //####################################################################
- extern "C" void cb_text (void *parser, const xmlChar *text, int length)
- { static_cast<epimpl*>(parser)->event_text(text, length); }
- //####################################################################
- extern "C" void cb_pi (void *parser, const xmlChar *target, const xmlChar *data)
- { static_cast<epimpl*>(parser)->event_pi(target, data); }
- //####################################################################
- extern "C" void cb_comment (void *parser, const xmlChar *text)
- { static_cast<epimpl*>(parser)->event_comment(text); }
- //####################################################################
- extern "C" void cb_cdata (void *parser, const xmlChar *text, int length)
- { static_cast<epimpl*>(parser)->event_cdata(text, length); }
- //####################################################################
- extern "C" void cb_warning (void *parser, const char *message, ...) {
- std::string complete_message;
-
- va_list ap;
- va_start(ap, message);
- printf2string(complete_message, message, ap);
- va_end(ap);
-
- static_cast<epimpl*>(parser)->event_warning(complete_message);
- }
- //####################################################################
- extern "C" void cb_error (void *parser, const char *message, ...) {
- std::string complete_message;
-
- va_list ap;
- va_start(ap, message);
- printf2string(complete_message, message, ap);
- va_end(ap);
-
- static_cast<epimpl*>(parser)->event_error(complete_message);
- }
- //####################################################################
- extern "C" void cb_ignore (void*, const xmlChar*, int) {
- return;
- }
-} // end anonymous namespace
Modified: trunk/src/libxml/init.cxx
===================================================================
--- trunk/src/libxml/init.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxml/init.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -43,8 +43,12 @@
#include <libxml/parser.h>
//####################################################################
-namespace {
- extern "C" void xml_error (void *, const char*, ...);
+extern "C"
+{
+ static void xml_error (void *, const char*, ...)
+ {
+ // don't do anything
+ }
}
//####################################################################
int xml::init::ms_counter = 0;
@@ -98,8 +102,3 @@
xmlDoValidityCheckingDefaultValue = flag ? 1 : 0;
}
//####################################################################
-namespace {
- extern "C" void xml_error (void*, const char*, ...)
- { /* don't do anything */ }
-}
-//####################################################################
Modified: trunk/src/libxml/tree_parser.cxx
===================================================================
--- trunk/src/libxml/tree_parser.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxml/tree_parser.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -67,11 +67,14 @@
//####################################################################
namespace {
const char const_default_error[] = "unknown XML parsing error";
+}
- extern "C" void cb_tree_error (void *v, const char *message, ...);
- extern "C" void cb_tree_warning (void *v, const char *, ...);
- extern "C" void cb_tree_ignore (void*, const xmlChar*, int);
+extern "C" {
+ static void cb_tree_error (void *v, const char *message, ...);
+ static void cb_tree_warning (void *v, const char *, ...);
+ static void cb_tree_ignore (void*, const xmlChar*, int);
}
+
//####################################################################
struct xml::impl::tree_impl {
tree_impl (void) : last_error_(const_default_error), warnings_(false), okay_(false) {
@@ -91,7 +94,46 @@
bool warnings_;
bool okay_;
};
+
//####################################################################
+extern "C"
+{
+//####################################################################
+static void cb_tree_error (void *v, const char *message, ...) {
+try {
+
+ xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
+ tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
+ if (!p) return; // handle bug in older versions of libxml
+
+ va_list ap;
+ va_start(ap, message);
+ printf2string(p->last_error_, message, ap);
+ va_end(ap);
+
+ xmlStopParser(ctxt);
+} catch (...) { }
+}
+//####################################################################
+static void cb_tree_warning (void *v, const char *, ...) {
+try {
+
+ xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
+ tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
+ if (!p) return; // handle bug in older versions of libxml
+
+ p->warnings_ = true;
+
+} catch (...) { }
+}
+//####################################################################
+static void cb_tree_ignore (void*, const xmlChar*, int) {
+return;
+}
+
+} // extern "C"
+
+//####################################################################
xml::tree_parser::tree_parser (const char *name, bool allow_exceptions) {
std::auto_ptr<tree_impl> ap(pimpl_ = new tree_impl);
@@ -162,40 +204,3 @@
const xml::document& xml::tree_parser::get_document (void) const {
return pimpl_->doc_;
}
-//####################################################################
-namespace {
- //####################################################################
- extern "C" void cb_tree_error (void *v, const char *message, ...) {
- try {
-
- xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
- tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
- if (!p) return; // handle bug in older versions of libxml
-
- va_list ap;
- va_start(ap, message);
- printf2string(p->last_error_, message, ap);
- va_end(ap);
-
- xmlStopParser(ctxt);
- } catch (...) { }
- }
- //####################################################################
- extern "C" void cb_tree_warning (void *v, const char *, ...) {
- try {
-
- xmlParserCtxtPtr ctxt = static_cast<xmlParserCtxtPtr>(v);
- tree_impl *p = static_cast<tree_impl*>(ctxt->_private);
- if (!p) return; // handle bug in older versions of libxml
-
- p->warnings_ = true;
-
- } catch (...) { }
- }
- //####################################################################
- extern "C" void cb_tree_ignore (void*, const xmlChar*, int) {
- return;
- }
- //####################################################################
-}
-//####################################################################
Modified: trunk/src/libxslt/init.cxx
===================================================================
--- trunk/src/libxslt/init.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxslt/init.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -44,16 +44,16 @@
#include <libxslt/xsltutils.h>
#include <libexslt/exslt.h>
-namespace
+extern "C"
{
-extern "C" void xslt_error(void *, const char*, ...)
+static void xslt_error(void *, const char*, ...)
{
// don't do anything; we install context-specific error handler to
// catch errors while applying a stylesheet
}
-} // anonymous namespace
+} // extern "C"
int xslt::init::ms_counter = 0;
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2009-06-02 16:20:11 UTC (rev 149)
+++ trunk/src/libxslt/stylesheet.cxx 2009-06-02 16:42:51 UTC (rev 150)
@@ -121,8 +121,11 @@
}
-extern "C" void xsltwrapp_error_cb(void *c, const char *message, ...)
+extern "C"
{
+
+static void error_cb(void *c, const char *message, ...)
+{
xsltTransformContextPtr ctxt = static_cast<xsltTransformContextPtr>(c);
xslt::stylesheet::pimpl *impl = static_cast<xslt::stylesheet::pimpl*>(ctxt->_private);
@@ -146,6 +149,7 @@
impl->error_.append(formatted);
}
+} // extern "C"
xmlDocPtr apply_stylesheet(xslt::stylesheet::pimpl *impl,
xmlDocPtr doc,
@@ -159,7 +163,7 @@
xsltTransformContextPtr ctxt = xsltNewTransformContext(style, doc);
ctxt->_private = impl;
- xsltSetTransformErrorFunc(ctxt, ctxt, xsltwrapp_error_cb);
+ xsltSetTransformErrorFunc(ctxt, ctxt, error_cb);
// clear the error flag before applying the stylesheet
impl->errors_occured_ = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-06-02 16:20:13
|
Revision: 149
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=149&view=rev
Author: vaclavslavik
Date: 2009-06-02 16:20:11 +0000 (Tue, 02 Jun 2009)
Log Message:
-----------
Fixed xslt::stylesheet::apply() to detect and report errors.
Modified Paths:
--------------
trunk/NEWS
trunk/include/xsltwrapp/stylesheet.h
trunk/src/libxslt/init.cxx
trunk/src/libxslt/stylesheet.cxx
trunk/tests/xslt/test_xslt.cxx
Added Paths:
-----------
trunk/tests/xslt/data/with_errors.xsl
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-31 18:54:31 UTC (rev 148)
+++ trunk/NEWS 2009-06-02 16:20:11 UTC (rev 149)
@@ -5,6 +5,8 @@
Converted test suite to Boost Test.
+ Fixed xslt::stylesheet::apply() to detect and report errors.
+
Version 0.6.0
Fixed libxmlwrapp to not depend on libxslt if XSLT support
Modified: trunk/include/xsltwrapp/stylesheet.h
===================================================================
--- trunk/include/xsltwrapp/stylesheet.h 2009-05-31 18:54:31 UTC (rev 148)
+++ trunk/include/xsltwrapp/stylesheet.h 2009-06-02 16:20:11 UTC (rev 149)
@@ -58,6 +58,8 @@
class stylesheet
{
public:
+ struct pimpl;
+
/// Type for passing parameters to the stylesheet
typedef std::map<std::string, std::string> param_type;
@@ -160,7 +162,6 @@
const std::string& get_error_message() const;
private:
- struct pimpl;
pimpl *pimpl_;
// an xslt::stylesheet cannot yet be copied or assigned to.
Modified: trunk/src/libxslt/init.cxx
===================================================================
--- trunk/src/libxslt/init.cxx 2009-05-31 18:54:31 UTC (rev 148)
+++ trunk/src/libxslt/init.cxx 2009-06-02 16:20:11 UTC (rev 149)
@@ -49,7 +49,8 @@
extern "C" void xslt_error(void *, const char*, ...)
{
- // don't do anything
+ // don't do anything; we install context-specific error handler to
+ // catch errors while applying a stylesheet
}
} // anonymous namespace
@@ -79,7 +80,8 @@
// set some defautls
process_xincludes(true);
- // keep libxslt silent
+ // keep libxslt silent; we install context-specific error handler to
+ // catch errors while applying a stylesheet
xsltSetGenericErrorFunc(0, xslt_error);
xsltSetGenericDebugFunc(0, xslt_error);
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:54:31 UTC (rev 148)
+++ trunk/src/libxslt/stylesheet.cxx 2009-06-02 16:20:11 UTC (rev 149)
@@ -57,6 +57,17 @@
#include <vector>
#include <map>
+
+struct xslt::stylesheet::pimpl
+{
+ pimpl (void) : ss_(0), errors_occured_(false) { }
+
+ xsltStylesheetPtr ss_;
+ xml::document doc_;
+ std::string error_;
+ bool errors_occured_;
+};
+
namespace
{
@@ -110,35 +121,76 @@
}
-xmlDocPtr apply_stylesheet(xsltStylesheetPtr s, xmlDocPtr d,
+extern "C" void xsltwrapp_error_cb(void *c, const char *message, ...)
+{
+ xsltTransformContextPtr ctxt = static_cast<xsltTransformContextPtr>(c);
+ xslt::stylesheet::pimpl *impl = static_cast<xslt::stylesheet::pimpl*>(ctxt->_private);
+
+ impl->errors_occured_ = true;
+
+ // tell the processor to stop when it gets a chance:
+ if ( ctxt->state == XSLT_STATE_OK )
+ ctxt->state = XSLT_STATE_STOPPED;
+
+ // concatenate all error messages:
+ if ( impl->errors_occured_ )
+ impl->error_.append("\n");
+
+ std::string formatted;
+
+ va_list ap;
+ va_start(ap, message);
+ xml::impl::printf2string(formatted, message, ap);
+ va_end(ap);
+
+ impl->error_.append(formatted);
+}
+
+
+xmlDocPtr apply_stylesheet(xslt::stylesheet::pimpl *impl,
+ xmlDocPtr doc,
const xslt::stylesheet::param_type *p = NULL)
{
- /*
- * TODO TODO TODO TODO
- *
- * use a transform context to capture error messages
- *
- * TODO TODO TODO TODO
- */
+ xsltStylesheetPtr style = impl->ss_;
+
std::vector<const char*> v;
if (p)
make_vector_param(v, *p);
- return xsltApplyStylesheet(s, d, p ? &v[0] : 0);
-}
-} // end of anonymous namespace
+ xsltTransformContextPtr ctxt = xsltNewTransformContext(style, doc);
+ ctxt->_private = impl;
+ xsltSetTransformErrorFunc(ctxt, ctxt, xsltwrapp_error_cb);
+ // clear the error flag before applying the stylesheet
+ impl->errors_occured_ = false;
-struct xslt::stylesheet::pimpl
-{
- pimpl (void) : ss_(0) { }
+ xmlDocPtr result =
+ xsltApplyStylesheetUser(style, doc, p ? &v[0] : 0, NULL, NULL, ctxt);
- xsltStylesheetPtr ss_;
- xml::document doc_;
- std::string error_;
-};
+ xsltFreeTransformContext(ctxt);
+ // it's possible there was an error that didn't prevent creation of some
+ // (incorrect) document
+ if ( result && impl->errors_occured_ )
+ {
+ xmlFreeDoc(result);
+ return NULL;
+ }
+ if ( !result )
+ {
+ // set generic error message if nothing more specific is known
+ if ( impl->error_.empty() )
+ impl->error_ = "unknown XSLT transformation error";
+ return NULL;
+ }
+
+ return result;
+}
+
+} // end of anonymous namespace
+
+
xslt::stylesheet::stylesheet(const char *filename)
{
std::auto_ptr<pimpl> ap(pimpl_ = new pimpl);
@@ -192,7 +244,7 @@
bool xslt::stylesheet::apply(const xml::document &doc, xml::document &result)
{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input);
if (xmldoc)
{
@@ -208,7 +260,7 @@
const param_type &with_params)
{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input, &with_params);
if (xmldoc)
{
@@ -223,14 +275,10 @@
xml::document& xslt::stylesheet::apply(const xml::document &doc)
{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input);
- if (xmldoc == 0)
- {
- if (pimpl_->error_.empty())
- pimpl_->error_ = "unknown XSLT transformation error";
+ if ( !xmldoc )
throw std::runtime_error(pimpl_->error_);
- }
pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
return pimpl_->doc_;
@@ -241,14 +289,10 @@
const param_type &with_params)
{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input, &with_params);
- if (xmldoc == 0)
- {
- if (pimpl_->error_.empty())
- pimpl_->error_ = "unknown XSLT transformation error";
+ if ( !xmldoc )
throw std::runtime_error(pimpl_->error_);
- }
pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
return pimpl_->doc_;
Added: trunk/tests/xslt/data/with_errors.xsl
===================================================================
--- trunk/tests/xslt/data/with_errors.xsl (rev 0)
+++ trunk/tests/xslt/data/with_errors.xsl 2009-06-02 16:20:11 UTC (rev 149)
@@ -0,0 +1,19 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml"/>
+
+ <xsl:template name="foo">
+ <output>
+ <xsl:value-of select="$x"/>
+ </output>
+ <!-- this is intentionally invalid: the parameters must be declared
+ at the top of the template -->
+ <xsl:param name="x"/>
+ </xsl:template>
+
+ <xsl:template match="/">
+ <xsl:call-template name="foo">
+ <xsl:with-param name="x">42</xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+</xsl:stylesheet>
Modified: trunk/tests/xslt/test_xslt.cxx
===================================================================
--- trunk/tests/xslt/test_xslt.cxx 2009-05-31 18:54:31 UTC (rev 148)
+++ trunk/tests/xslt/test_xslt.cxx 2009-06-02 16:20:11 UTC (rev 149)
@@ -131,4 +131,30 @@
}
+/*
+ * Tests libxslt errors reporting
+ */
+
+BOOST_AUTO_TEST_CASE( xsl_with_errors )
+{
+ xslt::stylesheet style(test_file_path("xslt/data/with_errors.xsl").c_str());
+ xml::tree_parser parser(test_file_path("xslt/data/input.xml").c_str());
+
+ xml::document result;
+ BOOST_CHECK( !style.apply(parser.get_document(), result) );
+}
+
+BOOST_AUTO_TEST_CASE( xsl_with_errors_throw )
+{
+ xslt::stylesheet style(test_file_path("xslt/data/with_errors.xsl").c_str());
+ xml::tree_parser parser(test_file_path("xslt/data/input.xml").c_str());
+
+ BOOST_CHECK_THROW
+ (
+ style.apply(parser.get_document()),
+ std::exception
+ );
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-31 18:54:40
|
Revision: 148
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=148&view=rev
Author: vaclavslavik
Date: 2009-05-31 18:54:31 +0000 (Sun, 31 May 2009)
Log Message:
-----------
reverted r145, it was a mistake
Modified Paths:
--------------
trunk/src/libxslt/init.cxx
trunk/src/libxslt/stylesheet.cxx
Modified: trunk/src/libxslt/init.cxx
===================================================================
--- trunk/src/libxslt/init.cxx 2009-05-31 18:49:03 UTC (rev 147)
+++ trunk/src/libxslt/init.cxx 2009-05-31 18:54:31 UTC (rev 148)
@@ -39,6 +39,7 @@
#include "xsltwrapp/init.h"
#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <libexslt/exslt.h>
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:49:03 UTC (rev 147)
+++ trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:54:31 UTC (rev 148)
@@ -46,6 +46,7 @@
// libxslt includes
#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-31 18:49:10
|
Revision: 147
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=147&view=rev
Author: vaclavslavik
Date: 2009-05-31 18:49:03 +0000 (Sun, 31 May 2009)
Log Message:
-----------
don't use tabs in NEWS file
Modified Paths:
--------------
trunk/NEWS
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-31 18:47:25 UTC (rev 146)
+++ trunk/NEWS 2009-05-31 18:49:03 UTC (rev 147)
@@ -1,282 +1,282 @@
- Added Visual C++ 200x projects and fixed VC6 project.
+ Added Visual C++ 200x projects and fixed VC6 project.
- Fixed xml::event_parser::parse_stream() to return false on empty
- input (Michael Grundberg, #2787836).
+ Fixed xml::event_parser::parse_stream() to return false on empty
+ input (Michael Grundberg, #2787836).
- Converted test suite to Boost Test.
+ Converted test suite to Boost Test.
Version 0.6.0
- Fixed libxmlwrapp to not depend on libxslt if XSLT support
- is enabled (Vadim Zeitlin, #1927398).
+ Fixed libxmlwrapp to not depend on libxslt if XSLT support
+ is enabled (Vadim Zeitlin, #1927398).
- Ported Unix build system to Autotools.
+ Ported Unix build system to Autotools.
- Split pkg-config file xmlwrapp.pc into xmlwrapp.pc and
- xsltwrapp.pc. Applications that use libxsltwrapp need to be
- updated to use the latter (too).
+ Split pkg-config file xmlwrapp.pc into xmlwrapp.pc and
+ xsltwrapp.pc. Applications that use libxsltwrapp need to be
+ updated to use the latter (too).
- Input document to xslt::stylesheet::apply() is now passed as
- const reference instead of non-const one.
+ Input document to xslt::stylesheet::apply() is now passed as
+ const reference instead of non-const one.
- It is no longer necessary to instantiate xml/xslt::init object before
- using the library; this is now done automatically (thread safety is
- preserved) and new code shouldn't do it. Moreover, creating multiple
- xml/xslt::init object instances is now possible and doesn't result in
- multiple initialization/shutdown of the library.
+ It is no longer necessary to instantiate xml/xslt::init object before
+ using the library; this is now done automatically (thread safety is
+ preserved) and new code shouldn't do it. Moreover, creating multiple
+ xml/xslt::init object instances is now possible and doesn't result in
+ multiple initialization/shutdown of the library.
- Configuration methods of xml/xslt::init classes are now static.
+ Configuration methods of xml/xslt::init classes are now static.
- The previously separate manual was merged with Doxygen documentation so
- that all documentation is available in single place. As a consequence,
- PDF version of the manual is no longer provided, use HTML documentation
- included with xmlwrapp source distribution.
+ The previously separate manual was merged with Doxygen documentation so
+ that all documentation is available in single place. As a consequence,
+ PDF version of the manual is no longer provided, use HTML documentation
+ included with xmlwrapp source distribution.
- Added xml::node::get_namespace() function.
+ Added xml::node::get_namespace() function.
- Added new constructor to the xml::node class for creating text nodes,
- using xml::node::text helper struct.
+ Added new constructor to the xml::node class for creating text nodes,
+ using xml::node::text helper struct.
- Improved iterators performance (only if Boost.Pool is available).
+ Improved iterators performance (only if Boost.Pool is available).
- Added xml::node::elements() methods for efficient iteration over child
- elements. In most cases, this is a better alternative to find().
+ Added xml::node::elements() methods for efficient iteration over child
+ elements. In most cases, this is a better alternative to find().
Version 0.5.1
- Various compilation fixes.
+ Various compilation fixes.
Version 0.5.0
- Fixed a null pointer dereference problem in
- xml::attributes, Bug ID 20. Thanks goes to John K. Hohm
- for finding this and providing a working patch.
+ Fixed a null pointer dereference problem in
+ xml::attributes, Bug ID 20. Thanks goes to John K. Hohm
+ for finding this and providing a working patch.
- Added three new constructors to the xml::node class for creating
- CDATA sections, XML comments, and XML processing instructions. This
- is done using three new helper structs, xml::node::cdata,
- xml::node::comment, and xml::node::pi.
+ Added three new constructors to the xml::node class for creating
+ CDATA sections, XML comments, and XML processing instructions. This
+ is done using three new helper structs, xml::node::cdata,
+ xml::node::comment, and xml::node::pi.
- Added new member functions to the xml::node class.
- They are: size and empty.
+ Added new member functions to the xml::node class.
+ They are: size and empty.
- Added new member functions to the xml::document class.
- They are: size, push_back, insert, replace, and erase.
+ Added new member functions to the xml::document class.
+ They are: size, push_back, insert, replace, and erase.
- Added the ability to compress XML files saved with the
- xml::document::save_to_file member function (Bug ID 19).
+ Added the ability to compress XML files saved with the
+ xml::document::save_to_file member function (Bug ID 19).
- Major clean ups in the test harness. Test code should be a lot easier
- to write now.
+ Major clean ups in the test harness. Test code should be a lot easier
+ to write now.
Version 0.4.4
- Small changes so that xmlwrapp can work with libxml2
- version 2.6.0. Thanks goes to Craig Wiesen and Jonathan
- Wakely for finding this. (Bug ID 18).
+ Small changes so that xmlwrapp can work with libxml2
+ version 2.6.0. Thanks goes to Craig Wiesen and Jonathan
+ Wakely for finding this. (Bug ID 18).
- Fixed a typo in the manual. Thanks goes to Bill
- Luoma. (Bug ID 16).
+ Fixed a typo in the manual. Thanks goes to Bill
+ Luoma. (Bug ID 16).
Version 0.4.3
- Fixed a build problem on Linux (bug 10). This happens when
- libxslt was installed in /usr. configure.pl could not find
- libxslt because xslt-config does not list /usr/include.
+ Fixed a build problem on Linux (bug 10). This happens when
+ libxslt was installed in /usr. configure.pl could not find
+ libxslt because xslt-config does not list /usr/include.
- Updated the TODO list.
+ Updated the TODO list.
Version 0.4.2
- Version 0.4.2 is a maintenance release. A few small bugs were
- fixed and a work around for a bug in Perl 5.8 was added.
+ Version 0.4.2 is a maintenance release. A few small bugs were
+ fixed and a work around for a bug in Perl 5.8 was added.
- Updated Perl scripts to work around a bug in the Perl 5.8
- regex parser. Thanks goes to Andy Chou.
+ Updated Perl scripts to work around a bug in the Perl 5.8
+ regex parser. Thanks goes to Andy Chou.
- Added an encoding patch from Dmitriy Nikitinskiy.
+ Added an encoding patch from Dmitriy Nikitinskiy.
Version 0.4.1
- Version 0.4.1 fixes a few small bugs and also includes some new
- features. It is binary compatible with version 0.4.0.
+ Version 0.4.1 fixes a few small bugs and also includes some new
+ features. It is binary compatible with version 0.4.0.
- Typos in the doxygen documentation were fixed thanks to Jonathan
- Wakely, Stephen Blake and Chris de Hoop.
+ Typos in the doxygen documentation were fixed thanks to Jonathan
+ Wakely, Stephen Blake and Chris de Hoop.
- Fixed a bug in configure.pl that caused a bad xmlwrapp-config to
- be generated when XSLT was enabled.
+ Fixed a bug in configure.pl that caused a bad xmlwrapp-config to
+ be generated when XSLT was enabled.
- Added support for pkg-config and the xmlwrapp.pc file.
+ Added support for pkg-config and the xmlwrapp.pc file.
- Added support for libexslt.
+ Added support for libexslt.
- Added the xml::init::remove_whitespace member function to skip
- ignorable whitespace from parsed XML documents. Default value is
- false, so whitespace is included in the node tree by default.
+ Added the xml::init::remove_whitespace member function to skip
+ ignorable whitespace from parsed XML documents. Default value is
+ false, so whitespace is included in the node tree by default.
- Added the xml::node::self and xml::node::parent member
- functions. They return @code{xml::node::iterator} or
- xml::node::const_iterator objects.
+ Added the xml::node::self and xml::node::parent member
+ functions. They return @code{xml::node::iterator} or
+ xml::node::const_iterator objects.
- Added a new version of the xml::node::insert member function that
- does not require a location iterator, but instead inserts at the
- end of the child list like the xml::node::push_back member
- function does.
+ Added a new version of the xml::node::insert member function that
+ does not require a location iterator, but instead inserts at the
+ end of the child list like the xml::node::push_back member
+ function does.
- Added a range version of the xml::node::erase member function and
- a version that takes the name of a node to erase. All nodes with
- matching names will be removed from the child list.
+ Added a range version of the xml::node::erase member function and
+ a version that takes the name of a node to erase. All nodes with
+ matching names will be removed from the child list.
- Added two versions of the xml::node::sort member function. The
- first, will sort child nodes with the given name using one of
- their attributes as a sort key. The other, uses a user supplied
- function object to sort the child nodes.
+ Added two versions of the xml::node::sort member function. The
+ first, will sort child nodes with the given name using one of
+ their attributes as a sort key. The other, uses a user supplied
+ function object to sort the child nodes.
Version 0.4.0
- Version 0.4.0 is a feature release. xmlwrapp now supports XSLT via
- libxslt. This support is called xsltwrapp and is optional.
+ Version 0.4.0 is a feature release. xmlwrapp now supports XSLT via
+ libxslt. This support is called xsltwrapp and is optional.
- Added the xslt::init and xslt::stylesheet classes to support XSLT.
+ Added the xslt::init and xslt::stylesheet classes to support XSLT.
- Added the xml::init::load_external_subsets member function to make
- libxml load external subsets by default.
+ Added the xml::init::load_external_subsets member function to make
+ libxml load external subsets by default.
Version 0.3.0
- This version contains a lot of new features. Because of this,
- certain API calls have been changed or removed. The following list
- should help you update code that is using xmlwrapp.
+ This version contains a lot of new features. Because of this,
+ certain API calls have been changed or removed. The following list
+ should help you update code that is using xmlwrapp.
- Changed configure.pl to require at least version 2.4.28 of
- libxml2.
+ Changed configure.pl to require at least version 2.4.28 of
+ libxml2.
- The xml::tree_parser constructors can now throw exceptions if
- there was an error during parsing. This is optional, and is
- controlled by a bool flag passed to the constructors. This also
- means that xml::tree_parser will now prevent libxml2 from sending
- error messages to standard error. The new default behavior is to
- throw an exception.
+ The xml::tree_parser constructors can now throw exceptions if
+ there was an error during parsing. This is optional, and is
+ controlled by a bool flag passed to the constructors. This also
+ means that xml::tree_parser will now prevent libxml2 from sending
+ error messages to standard error. The new default behavior is to
+ throw an exception.
- Some of the xml::event_parser callback member functions have
- changed. There are also new callbacks so that you can catch CDATA
- sections, processing instructions and XML comments.
+ Some of the xml::event_parser callback member functions have
+ changed. There are also new callbacks so that you can catch CDATA
+ sections, processing instructions and XML comments.
- It is now safe to throw exceptions from within an
- xml::event_parser callback. The exception will not be passed up
- the stack to the caller of one of the parsing member
- functions. Instead, it will stop the parsing and set an error
- condition.
+ It is now safe to throw exceptions from within an
+ xml::event_parser callback. The exception will not be passed up
+ the stack to the caller of one of the parsing member
+ functions. Instead, it will stop the parsing and set an error
+ condition.
- There is a new xml::document class that allows you to set XML
- document variables such as the encoding and version. The document
- class also supports saving itself to a file, string or a
- std::ostream. It also includes functions for validating a document
- against an internal or external DTD.
+ There is a new xml::document class that allows you to set XML
+ document variables such as the encoding and version. The document
+ class also supports saving itself to a file, string or a
+ std::ostream. It also includes functions for validating a document
+ against an internal or external DTD.
- The xml::tree_parser class no longer contains a get_root_node()
- member function. It has been replaced with get_document() which
- will return a reference to a xml::document object. That object can
- then be used to call get_root_node().
+ The xml::tree_parser class no longer contains a get_root_node()
+ member function. It has been replaced with get_document() which
+ will return a reference to a xml::document object. That object can
+ then be used to call get_root_node().
- Another new class, xml::attributes, for getting and setting the
- attributes of a node. This class replaces all the member functions
- of xml::node that dealt with attributes. This class is much better
- than using the old xml::node member functions because it supports
- iterators and functions like find.
+ Another new class, xml::attributes, for getting and setting the
+ attributes of a node. This class replaces all the member functions
+ of xml::node that dealt with attributes. This class is much better
+ than using the old xml::node member functions because it supports
+ iterators and functions like find.
- The xml::init class will prevent libxml2 from sending any messages
- to stderr. This should not be a problem since most classes will
- catch the message and use it in an exception or store it for later
- use.
+ The xml::init class will prevent libxml2 from sending any messages
+ to stderr. This should not be a problem since most classes will
+ catch the message and use it in an exception or store it for later
+ use.
- xml::init will now set some default libxml2 global
- variables. Indenting of output XML text is turned on. Default
- substitution of entities on turned on. Validating of all
- documents by default is turned off. There are new member functions
- you can use to change these defaults.
+ xml::init will now set some default libxml2 global
+ variables. Indenting of output XML text is turned on. Default
+ substitution of entities on turned on. Validating of all
+ documents by default is turned off. There are new member functions
+ you can use to change these defaults.
- Compiler flags will no longer contain quotes around directory
- names. This was added for cygwin when people have a space in the
- current working directory path. It was removed because it was
- causing problems on other platforms.
+ Compiler flags will no longer contain quotes around directory
+ names. This was added for cygwin when people have a space in the
+ current working directory path. It was removed because it was
+ causing problems on other platforms.
- There is a new header file, xmlwrapp/xmlwrapp.h, that includes all
- of the other xmlwrapp header files.
+ There is a new header file, xmlwrapp/xmlwrapp.h, that includes all
+ of the other xmlwrapp header files.
- A real working test harness has been added with several tests.
+ A real working test harness has been added with several tests.
- New member functions for xml::node.
+ New member functions for xml::node.
- 4 different versions of xml::node::find.
+ 4 different versions of xml::node::find.
- xml::node::insert.
+ xml::node::insert.
- xml::node::replace.
+ xml::node::replace.
- xml::node::erase.
+ xml::node::erase.
- xml::node::get_attributes.
+ xml::node::get_attributes.
- xml::node::get_type.
+ xml::node::get_type.
Version 0.2.2
- Version 0.2.2 was a bug fix release.
+ Version 0.2.2 was a bug fix release.
- Changed include guards so that they don't violate the C++
- standard. Thanks to Greg Chicares.
+ Changed include guards so that they don't violate the C++
+ standard. Thanks to Greg Chicares.
- Include <cstddef> to get std::size_t and std::ptrdiff_t. Thanks to
- Greg Chicares.
+ Include <cstddef> to get std::size_t and std::ptrdiff_t. Thanks to
+ Greg Chicares.
- Fix a major bug where a pimpl was not created in
- xml::tree_parser. Thanks to Greg Chicares.
+ Fix a major bug where a pimpl was not created in
+ xml::tree_parser. Thanks to Greg Chicares.
- Added a call to xmlKeepBlanksDefault(0) in xml::init constructor
- to produce better looking XML. If this causes any problems we will
- have to remove it. This was suggested by Daniel Evison.
+ Added a call to xmlKeepBlanksDefault(0) in xml::init constructor
+ to produce better looking XML. If this causes any problems we will
+ have to remove it. This was suggested by Daniel Evison.
- Fixed an issue with command quoting in the configure.pl script.
+ Fixed an issue with command quoting in the configure.pl script.
Version 0.2.1
- Version 0.2.1 was a bug fix release.
+ Version 0.2.1 was a bug fix release.
- Fixed a bug in the xml::event_parser class that caused parsing to
- continue even when one of the event member functions returned
- false. Thanks to Michael Grabner for finding this one.
+ Fixed a bug in the xml::event_parser class that caused parsing to
+ continue even when one of the event member functions returned
+ false. Thanks to Michael Grabner for finding this one.
- There were a few reports that xmlwrapp could be compiled using
- MSVC on Win32. A project file for MSVC was added so that no one
- would have to do this again. The STLport is needed on the Win32
- platform.
+ There were a few reports that xmlwrapp could be compiled using
+ MSVC on Win32. A project file for MSVC was added so that no one
+ would have to do this again. The STLport is needed on the Win32
+ platform.
- The get_namespace and set_namespace functions were removed from
- the xml::node class since they were defined but not yet
- implemented.
+ The get_namespace and set_namespace functions were removed from
+ the xml::node class since they were defined but not yet
+ implemented.
Version 0.2.0
- Version 0.2.0 of xmlwrapp was the first public release. It
- included the following changes from version 0.1.0.
+ Version 0.2.0 of xmlwrapp was the first public release. It
+ included the following changes from version 0.1.0.
- First draft of the documentation.
+ First draft of the documentation.
- Added example programs.
+ Added example programs.
- Changed operator<< for xml::node from a template function to a
- normal function that takes a std::ostream. This allows xmlwrapp
- to compile with GCC < 3.0.
+ Changed operator<< for xml::node from a template function to a
+ normal function that takes a std::ostream. This allows xmlwrapp
+ to compile with GCC < 3.0.
- Replaced calls to std::free with xmlFree in the libxml2 backend
- wrapper.
+ Replaced calls to std::free with xmlFree in the libxml2 backend
+ wrapper.
Version 0.1.0
- Version 0.1.0 was the first packaged version. It was packaged for
- <http://pmade.org/software/clo++/,clo++>.
+ Version 0.1.0 was the first packaged version. It was packaged for
+ <http://pmade.org/software/clo++/,clo++>.
- It included no documentation or examples, and was not intended for
- use by other developers.
+ It included no documentation or examples, and was not intended for
+ use by other developers.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-31 18:47:34
|
Revision: 146
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=146&view=rev
Author: vaclavslavik
Date: 2009-05-31 18:47:25 +0000 (Sun, 31 May 2009)
Log Message:
-----------
forgot to include test_document.cxx in r143
Added Paths:
-----------
trunk/tests/document/test_document.cxx
Added: trunk/tests/document/test_document.cxx
===================================================================
--- trunk/tests/document/test_document.cxx (rev 0)
+++ trunk/tests/document/test_document.cxx 2009-05-31 18:47:25 UTC (rev 146)
@@ -0,0 +1,437 @@
+/*
+ * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * Copyright (C) 2009 Vaclav Slavik (vs...@fa...)
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "../test.h"
+
+#include <boost/iostreams/filtering_stream.hpp>
+#include <boost/iostreams/filter/gzip.hpp>
+
+BOOST_AUTO_TEST_SUITE( document )
+
+/*
+ * This test checks xml::document iteration.
+ */
+
+BOOST_AUTO_TEST_CASE( dump_type )
+{
+ xml::init::substitute_entities(false);
+
+ xml::tree_parser parser(test_file_path("document/data/01.xml").c_str());
+
+ std::ostringstream ostr;
+ xml::node::iterator i = parser.get_document().begin(),
+ end = parser.get_document().end();
+ for (; i!=end; ++i)
+ dump_node_type(ostr, *i);
+
+ BOOST_CHECK( is_same_as_file(ostr, "document/data/01.out") );
+}
+
+
+/*
+ * This test checks xml::document default constructor.
+ */
+
+BOOST_AUTO_TEST_CASE( default_ctor )
+{
+ xml::document doc;
+ BOOST_CHECK( is_same_as_file( doc, "document/data/02.out") );
+}
+
+
+/*
+ * This test checks xml::document constructor that takes the name of the root
+ * node.
+ */
+
+BOOST_AUTO_TEST_CASE( ctor_root_name )
+{
+ xml::document doc("root");
+ BOOST_CHECK( is_same_as_file( doc, "document/data/03.out") );
+}
+
+
+/*
+ * This test checks xml::document constructor that takes a node.
+ */
+
+BOOST_AUTO_TEST_CASE( ctor_root_node )
+{
+ xml::node n("root", "pcdata");
+ xml::document doc(n);
+ BOOST_CHECK( is_same_as_file( doc, "document/data/04.out") );
+}
+
+
+/*
+ * This test checks xml::document copy constructor.
+ */
+
+BOOST_AUTO_TEST_CASE( copy_ctor )
+{
+ xml::node n("root", "pcdata");
+ xml::document doc(n);
+
+ xml::document doc_copy(doc);
+
+ BOOST_CHECK( is_same_as_file( doc_copy, "document/data/04.out") );
+}
+
+
+/*
+ * This test checks xml::document assignment operator.
+ */
+
+BOOST_AUTO_TEST_CASE( assignment_operator )
+{
+ xml::node n("root", "pcdata");
+ xml::document doc(n);
+
+ xml::document doc_copy;
+ doc_copy = doc;
+
+ BOOST_CHECK( is_same_as_file( doc_copy, "document/data/04.out") );
+}
+
+
+/*
+ * This test checks xml::document::get_root_node.
+ */
+
+BOOST_AUTO_TEST_CASE( get_root_node )
+{
+ xml::node n("root", "pcdata");
+ xml::document doc(n);
+
+ BOOST_CHECK( is_same_as_file( doc.get_root_node(), "document/data/04.out") );
+}
+
+
+/*
+ * This test checks xml::document::set_root_node().
+ */
+
+BOOST_AUTO_TEST_CASE( set_root_node )
+{
+ std::ostringstream ostr;
+
+ xml::node n("root", "pcdata");
+
+ xml::document doc;
+ ostr << doc; // blank document
+
+ doc.set_root_node(n);
+ ostr << doc;
+
+ BOOST_CHECK( is_same_as_file( ostr, "document/data/08.out") );
+}
+
+
+/*
+ * This test checks xml::document::get_version().
+ */
+
+BOOST_AUTO_TEST_CASE( get_version )
+{
+ xml::tree_parser parser(test_file_path("document/data/09.xml").c_str());
+
+ BOOST_CHECK_EQUAL( parser.get_document().get_version(), "1.1" );
+}
+
+
+/*
+ * This test checks xml::document::set_version().
+ */
+
+BOOST_AUTO_TEST_CASE( set_version )
+{
+ xml::document doc("root");
+ doc.set_version("1.1");
+
+ BOOST_CHECK( is_same_as_file( doc, "document/data/10.out") );
+}
+
+
+/*
+ * This test checks xml::document::get_encoding().
+ */
+
+BOOST_AUTO_TEST_CASE( get_encoding )
+{
+ xml::tree_parser parser(test_file_path("document/data/11.xml").c_str());
+
+ BOOST_CHECK_EQUAL( parser.get_document().get_encoding(), "UTF-8" );
+}
+
+
+/*
+ * This test checks xml::document::set_encoding().
+ */
+
+BOOST_AUTO_TEST_CASE( set_encoding )
+{
+ xml::document doc("root");
+ doc.set_encoding("UTF-8");
+
+ BOOST_CHECK( is_same_as_file( doc, "document/data/12.out") );
+}
+
+
+/*
+ * This test checks xml::document::get_is_standalone().
+ */
+
+BOOST_AUTO_TEST_CASE( get_is_standalone )
+{
+ xml::tree_parser parser1(test_file_path("document/data/13a.xml").c_str());
+ BOOST_CHECK_EQUAL( parser1.get_document().get_is_standalone(), false );
+
+ xml::tree_parser parser2(test_file_path("document/data/13b.xml").c_str());
+ BOOST_CHECK_EQUAL( parser2.get_document().get_is_standalone(), true );
+}
+
+
+/*
+ * This test checks xml::document::set_is_standalone().
+ */
+
+BOOST_AUTO_TEST_CASE( set_is_standalone )
+{
+ xml::document doc1("root");
+ doc1.set_is_standalone(true);
+ BOOST_CHECK( is_same_as_file( doc1, "document/data/13a.out") );
+
+ xml::document doc2("root");
+ doc2.set_is_standalone(false);
+ BOOST_CHECK( is_same_as_file( doc2, "document/data/13b.out") );
+}
+
+
+/*
+ * This test checks xml::document::process_xinclude()
+ */
+BOOST_AUTO_TEST_CASE( process_xinclude )
+{
+ xml::tree_parser parser(test_file_path("document/data/14.xml").c_str());
+
+ BOOST_CHECK( parser.get_document().process_xinclude() );
+ BOOST_CHECK( is_same_as_file( parser.get_document(), "document/data/14.out") );
+}
+
+
+/*
+ * This test checks xml::document::size()
+ */
+
+BOOST_AUTO_TEST_CASE( size )
+{
+ xml::document doc_01("root");
+ BOOST_CHECK_EQUAL( doc_01.size(), 1 );
+
+ doc_01.push_back(xml::node(xml::node::comment("This is a comment")));
+ BOOST_CHECK_EQUAL( doc_01.size(), 2 );
+
+ xml::document doc_02(doc_01);
+ BOOST_CHECK_EQUAL( doc_02.size(), 2 );
+
+ xml::document doc_03;
+ BOOST_CHECK_EQUAL( doc_03.size(), 1 );
+
+ xml::node n("root");
+ xml::document doc_04(n);
+ BOOST_CHECK_EQUAL( doc_04.size(), 1 );
+}
+
+
+/*
+ * This test checks xml::document::push_back and insert
+ */
+
+BOOST_AUTO_TEST_CASE( push_back_and_insert )
+{
+ xml::document doc("root");
+
+ doc.push_back(xml::node(xml::node::comment(" Comment From push_back ")));
+
+ xml::node::iterator n(doc.insert(xml::node(xml::node::comment("This Will Be Changed"))));
+ n->set_content(" Comment From insert ");
+
+ n = doc.insert(doc.begin(), xml::node(xml::node::pi("test")));
+ n->set_content("one=\"1\"");
+
+ BOOST_CHECK( is_same_as_file( doc, "document/data/17.out") );
+}
+
+
+/*
+ * This test checks xml::document::push_back and insert to make sure they
+ * throw exceptions
+ */
+
+BOOST_AUTO_TEST_CASE( push_back_and_insert_throw )
+{
+ xml::document doc("root");
+
+ BOOST_CHECK_THROW
+ (
+ doc.push_back(xml::node("noway")),
+ std::exception
+ );
+
+ BOOST_CHECK_THROW
+ (
+ doc.insert(xml::node("noway")),
+ std::exception
+ );
+
+ BOOST_CHECK_THROW
+ (
+ doc.insert(doc.end(), xml::node("noway")),
+ std::exception
+ );
+}
+
+
+/*
+ * This test checks xml::document::replace()
+ */
+
+BOOST_AUTO_TEST_CASE( replace )
+{
+ xml::document doc("root");
+
+ xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced "))));
+ doc.replace(n, xml::node(xml::node::comment(" This is the replacement comment ")));
+
+ BOOST_CHECK( is_same_as_file( doc, "document/data/19.out") );
+}
+
+
+/*
+ * This test checks xml::document::replace() to make sure it throws exceptions
+ */
+
+BOOST_AUTO_TEST_CASE( replace_throw )
+{
+ xml::document doc("root");
+ xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" To Be Replaced "))));
+
+ BOOST_CHECK_THROW
+ (
+ doc.replace(n, xml::node("noway")),
+ std::exception
+ );
+
+ BOOST_CHECK_THROW
+ (
+ doc.replace(doc.begin(), xml::node(xml::node::comment(" no way "))),
+ std::exception
+ );
+}
+
+
+/*
+ * This test checks xml::document::erase().
+ */
+
+BOOST_AUTO_TEST_CASE( erase )
+{
+ xml::document doc("root");
+ doc.push_back(xml::node(xml::node::comment(" Comment from push_back ")));
+
+ xml::node::iterator n(doc.insert(xml::node(xml::node::comment(" You should not see me "))));
+ doc.erase(n);
+
+ BOOST_CHECK( is_same_as_file(doc, "document/data/21.out") );
+}
+
+/*
+ * This test checks xml::document::erase() to make sure it throws an
+ * exception.
+ */
+
+BOOST_AUTO_TEST_CASE( cant_erase_root )
+{
+ xml::document doc("root");
+ doc.push_back(xml::node(xml::node::comment(" Comment from push_back ")));
+
+ BOOST_CHECK_THROW
+ (
+ doc.erase(doc.begin(), doc.end()),
+ std::exception
+ );
+}
+
+
+static const char *TEST_FILE = "test_temp_file";
+
+/*
+ * These tests check xml::docment::save_to_file()
+ */
+
+BOOST_AUTO_TEST_CASE( save_to_file )
+{
+ xml::document doc("root");
+ doc.get_root_node().push_back(xml::node("child"));
+
+ doc.save_to_file(TEST_FILE);
+
+ std::ifstream stream(TEST_FILE);
+ BOOST_CHECK( is_same_as_file(read_file_into_string(stream), "document/data/15.out") );
+
+ remove(TEST_FILE);
+}
+
+
+BOOST_AUTO_TEST_CASE( save_to_file_gzip )
+{
+ xml::document doc("root");
+ doc.get_root_node().push_back(xml::node("child"));
+
+ doc.save_to_file(TEST_FILE, 9);
+
+ // verify that the file was can be read back as compressed
+ std::ifstream stream(TEST_FILE);
+ boost::iostreams::filtering_stream<boost::iostreams::input> filter;
+ filter.push(boost::iostreams::gzip_decompressor());
+ filter.push(stream);
+ BOOST_CHECK( is_same_as_file(read_file_into_string(filter), "document/data/15.out") );
+
+ // ...and by libxml2 directly too
+ xml::tree_parser parser(TEST_FILE);
+
+ remove(TEST_FILE);
+}
+
+
+BOOST_AUTO_TEST_SUITE_END()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-31 18:22:52
|
Revision: 145
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=145&view=rev
Author: vaclavslavik
Date: 2009-05-31 18:22:48 +0000 (Sun, 31 May 2009)
Log Message:
-----------
don't needlessly include xsltInternals.h header, it isn't part of the guaranteed API
Modified Paths:
--------------
trunk/src/libxslt/init.cxx
trunk/src/libxslt/stylesheet.cxx
Modified: trunk/src/libxslt/init.cxx
===================================================================
--- trunk/src/libxslt/init.cxx 2009-05-31 18:19:17 UTC (rev 144)
+++ trunk/src/libxslt/init.cxx 2009-05-31 18:22:48 UTC (rev 145)
@@ -39,7 +39,6 @@
#include "xsltwrapp/init.h"
#include <libxslt/xslt.h>
-#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <libexslt/exslt.h>
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:19:17 UTC (rev 144)
+++ trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:22:48 UTC (rev 145)
@@ -46,7 +46,6 @@
// libxslt includes
#include <libxslt/xslt.h>
-#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-31 18:19:25
|
Revision: 144
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=144&view=rev
Author: vaclavslavik
Date: 2009-05-31 18:19:17 +0000 (Sun, 31 May 2009)
Log Message:
-----------
pretified xsltwrapp code formatting; no real changes
Modified Paths:
--------------
trunk/include/xsltwrapp/init.h
trunk/include/xsltwrapp/stylesheet.h
trunk/include/xsltwrapp/xsltwrapp.h
trunk/src/libxslt/init.cxx
trunk/src/libxslt/result.h
trunk/src/libxslt/stylesheet.cxx
Modified: trunk/include/xsltwrapp/init.h
===================================================================
--- trunk/include/xsltwrapp/init.h 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/include/xsltwrapp/init.h 2009-05-31 18:19:17 UTC (rev 144)
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
* All Rights Reserved
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -30,10 +30,12 @@
* SUCH DAMAGE.
*/
-/** @file
- * This file contains the definition of the xslt::init class.
-**/
+/**
+ @file
+ This file contains the definition of the xslt::init class.
+ */
+
#ifndef _xsltwrapp_init_h_
#define _xsltwrapp_init_h_
@@ -41,41 +43,41 @@
#include "xmlwrapp/init.h"
/// XSLT library namespace
-namespace xslt {
+namespace xslt
+{
/**
- * The xslt::init class is used to configure the XSLT engine.
- *
- * If you want to use any of the xslt::init member functions, do so before
- * you start any threads or use any other part of xsltwrapp. The member
- * functions may alter global and/or static variables. In other words, this
- * class is not thread safe.
- *
- * @note In xmlwrapp versions prior to 0.6.0, this class was used to initialize
- * the library and exactly one instance had to be created before first
- * use. This is no longer true: user code doesn't have to create any
- * instances, but it @em can create as many instances as it wants.
-**/
-class init : public xml::init {
+ The xslt::init class is used to configure the XSLT engine.
+
+ If you want to use any of the xslt::init member functions, do so before
+ you start any threads or use any other part of xsltwrapp. The member
+ functions may alter global and/or static variables. In other words, this
+ class is not thread safe.
+
+ @note In xmlwrapp versions prior to 0.6.0, this class was used to initialize
+ the library and exactly one instance had to be created before first
+ use. This is no longer true: user code doesn't have to create any
+ instances, but it @em can create as many instances as it wants.
+ */
+class init : public xml::init
+{
public:
- init (void);
- ~init (void);
+ init();
+ ~init();
- //####################################################################
- /**
- * This function controls whether or not the XSLT engine will process
- * XInclusions by default while parsing the stylesheet. The default is
- * true.
- *
- * @param flag True to enable XInclusing processing; False otherwise.
- * @author Peter Jones
- **/
- //####################################################################
- static void process_xincludes (bool flag);
+ /**
+ This function controls whether or not the XSLT engine will process
+ XInclusions by default while parsing the stylesheet. The default is
+ true.
+ @param flag True to enable XInclusing processing; False otherwise.
+ @author Peter Jones
+ */
+ static void process_xincludes(bool flag);
+
private:
- init (const init&);
- init& operator= (const init&);
+ init(const init&);
+ init& operator=(const init&);
void init_library();
void shutdown_library();
@@ -83,11 +85,14 @@
static int ms_counter;
}; // end xslt::init class
+
// use a "nifty counter" to ensure that any source file that uses xsltwrapp
// will initialize the library prior to its first use
-namespace {
- xslt::init g_xsltwrapp_initializer;
+namespace
+{
+xslt::init g_xsltwrapp_initializer;
}
} // end xslt namespace
-#endif
+
+#endif // _xsltwrapp_init_h_
Modified: trunk/include/xsltwrapp/stylesheet.h
===================================================================
--- trunk/include/xsltwrapp/stylesheet.h 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/include/xsltwrapp/stylesheet.h 2009-05-31 18:19:17 UTC (rev 144)
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
* All Rights Reserved
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -30,10 +30,12 @@
* SUCH DAMAGE.
*/
-/** @file
- * This file contains the definition of the xslt::stylesheet class.
-**/
+/**
+ @file
+ This file contains the definition of the xslt::stylesheet class.
+ */
+
#ifndef _xsltwrapp_stylesheet_h_
#define _xsltwrapp_stylesheet_h_
@@ -45,139 +47,127 @@
#include <map>
#include <string>
-namespace xslt {
+namespace xslt
+{
/**
- * The xslt::stylesheet class is used to hold information about an XSLT
- * stylesheet. You can use it to load in a stylesheet and then use that
- * stylesheet to transform an XML document to something else.
-**/
-class stylesheet {
+ The xslt::stylesheet class is used to hold information about an XSLT
+ stylesheet. You can use it to load in a stylesheet and then use that
+ stylesheet to transform an XML document to something else.
+ */
+class stylesheet
+{
public:
/// Type for passing parameters to the stylesheet
typedef std::map<std::string, std::string> param_type;
- //####################################################################
- /**
- * Create a new xslt::stylesheet object and load and parse the
- * stylesheet in the given filename.
- *
- * @param filename The name of the file that contains the stylesheet.
- * @author Peter Jones
- **/
- //####################################################################
- explicit stylesheet (const char *filename);
+ /**
+ Create a new xslt::stylesheet object and load and parse the
+ stylesheet in the given filename.
- //####################################################################
- /**
- * Create a new xslt::stylesheet object from an xml::document object
- * that contains the parsed stylesheet. The given xml::document is
- * passed by value. This is needed because the stylesheet will own the
- * document and free it.
- *
- * @param doc The parsed stylesheet.
- * @author Peter Jones
- **/
- //####################################################################
- explicit stylesheet (xml::document doc);
+ @param filename The name of the file that contains the stylesheet.
+ @author Peter Jones
+ */
+ explicit stylesheet(const char *filename);
- //####################################################################
- /**
- * Clean up after an xslt::stylesheet.
- *
- * @author Peter Jones
- **/
- //####################################################################
- ~stylesheet (void);
+ /**
+ Create a new xslt::stylesheet object from an xml::document object
+ that contains the parsed stylesheet. The given xml::document is
+ passed by value. This is needed because the stylesheet will own the
+ document and free it.
- //####################################################################
- /**
- * Apply this stylesheet to the given XML document. The result document
- * is placed in the second document parameter.
- *
- * @param doc The XML document to transform.
- * @param result The result tree after applying this stylesheet.
- * @return True if the transformation was successful and the results placed in result.
- * @return False if there was an error, result is not modified.
- * @author Peter Jones
- **/
- //####################################################################
- bool apply (const xml::document &doc, xml::document &result);
+ @param doc The parsed stylesheet.
+ @author Peter Jones
+ */
+ explicit stylesheet(xml::document doc);
- //####################################################################
- /**
- * Apply this stylesheet to the given XML document. The result document
- * is placed in the second document parameter.
+ /**
+ Clean up after an xslt::stylesheet.
- * @param doc The XML document to transform.
- * @param result The result tree after applying this stylesheet.
- * @param with_params Override xsl:param elements using the given key/value map
- * @return True if the transformation was successful and the results placed in result.
- * @return False if there was an error, result is not modified.
- * @author Peter Jones
- **/
- //####################################################################
- bool apply (const xml::document &doc, xml::document &result, const param_type &with_params);
+ @author Peter Jones
+ */
+ ~stylesheet();
- //####################################################################
- /**
- * Apply this stylesheet to the given XML document. The results document
- * is returned. If there is an error during transformation, this
- * function will throw a std::runtime_error exception.
- *
- * Each time you call this member function, the xml::document object
- * that was returned from the last call becomes invalid. That is, of
- * course, unless you copied it first.
- *
- * @param doc The XML document to transform.
- * @return A reference to the result tree.
- * @author Peter Jones
- **/
- //####################################################################
- xml::document& apply (const xml::document &doc);
+ /**
+ Apply this stylesheet to the given XML document. The result document
+ is placed in the second document parameter.
- //####################################################################
- /**
- * Apply this stylesheet to the given XML document. The results document
- * is returned. If there is an error during transformation, this
- * function will throw a std::runtime_error exception.
- *
- * Each time you call this member function, the xml::document object
- * that was returned from the last call becomes invalid. That is, of
- * course, unless you copied it first.
- *
- * @param doc The XML document to transform.
- * @param with_params Override xsl:param elements using the given key/value map
- * @return A reference to the result tree.
- * @author Peter Jones
- **/
- //####################################################################
- xml::document& apply (const xml::document &doc, const param_type &with_params);
+ @param doc The XML document to transform.
+ @param result The result tree after applying this stylesheet.
+ @return True if the transformation was successful and the results placed in result.
+ @return False if there was an error, result is not modified.
+ @author Peter Jones
+ */
+ bool apply(const xml::document& doc, xml::document& result);
- //####################################################################
- /**
- * If you used one of the xslt::stylesheet::apply member functions that
- * return a bool, you can use this function to get the text message for
- * the transformation error.
- *
- * If you are using one of the apply member functions that throws
- * exceptions, this function should not be used. The text message for
- * the transformation error will be given to the std::runtime_error
- * constructor.
- *
- * @return The last error message.
- * @author Peter Jones
- **/
- //####################################################################
- const std::string& get_error_message (void) const;
+ /**
+ Apply this stylesheet to the given XML document. The result document
+ is placed in the second document parameter.
+ @param doc The XML document to transform.
+ @param result The result tree after applying this stylesheet.
+ @param with_params Override xsl:param elements using the given key/value map
+ @return True if the transformation was successful and the results placed in result.
+ @return False if there was an error, result is not modified.
+ @author Peter Jones
+ */
+ bool apply(const xml::document& doc, xml::document& result, const param_type& with_params);
+
+ /**
+ Apply this stylesheet to the given XML document. The results document
+ is returned. If there is an error during transformation, this
+ function will throw a std::runtime_error exception.
+
+ Each time you call this member function, the xml::document object
+ that was returned from the last call becomes invalid. That is, of
+ course, unless you copied it first.
+
+ @param doc The XML document to transform.
+ @return A reference to the result tree.
+ @author Peter Jones
+ */
+ xml::document& apply(const xml::document& doc);
+
+ /**
+ Apply this stylesheet to the given XML document. The results document
+ is returned. If there is an error during transformation, this
+ function will throw a std::runtime_error exception.
+
+ Each time you call this member function, the xml::document object
+ that was returned from the last call becomes invalid. That is, of
+ course, unless you copied it first.
+
+ @param doc The XML document to transform.
+ @param with_params Override xsl:param elements using the given key/value map
+ @return A reference to the result tree.
+ @author Peter Jones
+ */
+ xml::document& apply(const xml::document& doc, const param_type& with_params);
+
+ /**
+ If you used one of the xslt::stylesheet::apply member functions that
+ return a bool, you can use this function to get the text message for
+ the transformation error.
+
+ If you are using one of the apply member functions that throws
+ exceptions, this function should not be used. The text message for
+ the transformation error will be given to the std::runtime_error
+ constructor.
+
+ @return The last error message.
+ @author Peter Jones
+ */
+ const std::string& get_error_message() const;
+
private:
- struct pimpl; pimpl *pimpl_;
+ struct pimpl;
+ pimpl *pimpl_;
// an xslt::stylesheet cannot yet be copied or assigned to.
- stylesheet (const stylesheet&);
- stylesheet& operator= (const stylesheet&);
+ stylesheet(const stylesheet&);
+ stylesheet& operator=(const stylesheet&);
}; // end xslt::stylesheet class
-
+
} // end xslt namespace
-#endif
+
+#endif // _xsltwrapp_stylesheet_h_
Modified: trunk/include/xsltwrapp/xsltwrapp.h
===================================================================
--- trunk/include/xsltwrapp/xsltwrapp.h 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/include/xsltwrapp/xsltwrapp.h 2009-05-31 18:19:17 UTC (rev 144)
@@ -5,7 +5,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
Modified: trunk/src/libxslt/init.cxx
===================================================================
--- trunk/src/libxslt/init.cxx 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/src/libxslt/init.cxx 2009-05-31 18:19:17 UTC (rev 144)
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
* All Rights Reserved
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -30,38 +30,50 @@
* SUCH DAMAGE.
*/
-/** @file
- * This file contains the implementation of the xslt::init class.
-**/
+/**
+ @file
-// defintion include
+ This file contains the implementation of the xslt::init class.
+ */
+
#include "xsltwrapp/init.h"
-// libxslt includes
#include <libxslt/xslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <libexslt/exslt.h>
-//####################################################################
-namespace {
- extern "C" void xslt_error (void *, const char*, ...);
+namespace
+{
+
+extern "C" void xslt_error(void *, const char*, ...)
+{
+ // don't do anything
}
-//####################################################################
+
+} // anonymous namespace
+
+
int xslt::init::ms_counter = 0;
-//####################################################################
-xslt::init::init (void) {
+
+
+xslt::init::init()
+{
if ( ms_counter++ == 0 )
init_library();
}
-//####################################################################
-xslt::init::~init (void) {
+
+
+xslt::init::~init(void)
+{
if ( --ms_counter == 0 )
shutdown_library();
}
-//####################################################################
-void xslt::init::init_library() {
+
+
+void xslt::init::init_library()
+{
xsltInit();
// set some defautls
@@ -74,17 +86,15 @@
// load EXSLT
exsltRegisterAll();
}
-//####################################################################
-void xslt::init::shutdown_library() {
+
+
+void xslt::init::shutdown_library()
+{
xsltCleanupGlobals();
}
-//####################################################################
-void xslt::init::process_xincludes (bool flag) {
+
+
+void xslt::init::process_xincludes(bool flag)
+{
xsltSetXIncludeDefault(flag ? 1 : 0);
}
-//####################################################################
-namespace {
- extern "C" void xslt_error (void*, const char*, ...)
- { /* don't do anything */ }
-}
-//####################################################################
Modified: trunk/src/libxslt/result.h
===================================================================
--- trunk/src/libxslt/result.h 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/src/libxslt/result.h 2009-05-31 18:19:17 UTC (rev 144)
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2008 Vadim Zeitlin (va...@ze...)
* All Rights Reserved
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -30,10 +30,12 @@
* SUCH DAMAGE.
*/
-/** @file
- * This file contains the declaration of the xslt::result class.
-**/
+/**
+ @file
+ This file contains the declaration of the xslt::result class.
+ */
+
#ifndef _xsltwrapp_result_h_
#define _xsltwrapp_result_h_
@@ -43,57 +45,55 @@
// forward declarations
typedef struct _xmlDoc *xmlDocPtr;
-namespace xslt {
+namespace xslt
+{
-namespace impl {
+namespace impl
+{
/**
- * The xslt::result class is used as a callback by xml::document to allow
- * special treatment of XML documents which were created by XSLT.
- *
- * This class is only meant to be used internally by the library and is
- * necessary to avoid the dependency of xml::document, which is part of
- * libxmlwrapp, on libxslt which should be only a dependency of libxsltwrapp
- * as this precludes calling the XSLT functions which must be used with such
- * "result" documents directly from xml::document code.
- *
- * @author Vadim Zeitlin
- * @internal
-**/
-class result {
+ @internal
+
+ The xslt::result class is used as a callback by xml::document to allow
+ special treatment of XML documents which were created by XSLT.
+
+ This class is only meant to be used internally by the library and is
+ necessary to avoid the dependency of xml::document, which is part of
+ libxmlwrapp, on libxslt which should be only a dependency of libxsltwrapp
+ as this precludes calling the XSLT functions which must be used with such
+ "result" documents directly from xml::document code.
+
+ @author Vadim Zeitlin
+ */
+class result
+{
public:
- //####################################################################
/**
- * Save the contents of the given XML document in the provided string.
- *
- * @param s The string to place the XML text data.
- **/
- //####################################################################
+ Save the contents of the given XML document in the provided string.
+
+ @param s The string to place the XML text data.
+ */
virtual void save_to_string(std::string &s) const = 0;
- //####################################################################
- /**
- * Save the contents of the given XML document in the provided filename.
- *
- * @param filename The name of the file to place the XML text data into.
- * @param compression_level 0 is no compression, 1-9 allowed, where 1 is for better speed, and 9 is for smaller size
- * @return True if the data was saved successfully.
- * @return False otherwise.
- **/
- //####################################################################
- virtual bool save_to_file (const char *filename,
- int compression_level) const = 0;
+ /**
+ Save the contents of the given XML document in the provided filename.
- //####################################################################
- /**
- * Trivial but virtual base class destructor.
- **/
- //####################################################################
- virtual ~result (void) { }
+ @param filename
+ The name of the file to place the XML text data into.
+ @param compression_level
+ 0 is no compression, 1-9 allowed, where 1 is for better speed,
+ and 9 is for smaller size
+ @return True if the data was saved successfully, false otherwise.
+ */
+ virtual bool save_to_file(const char *filename,
+ int compression_level) const = 0;
+
+ /// Trivial but virtual base class destructor.
+ virtual ~result() {}
};
} // end impl namespace
} // end xslt namespace
-#endif
+#endif // _xsltwrapp_result_h_
Modified: trunk/src/libxslt/stylesheet.cxx
===================================================================
--- trunk/src/libxslt/stylesheet.cxx 2009-05-30 18:55:52 UTC (rev 143)
+++ trunk/src/libxslt/stylesheet.cxx 2009-05-31 18:19:17 UTC (rev 144)
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
* All Rights Reserved
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@@ -15,7 +15,7 @@
* 3. Neither the name of the Author nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -30,10 +30,12 @@
* SUCH DAMAGE.
*/
-/** @file
- * This file contains the implementation of the xslt::stylesheet class.
-**/
+/**
+ @file
+ This file contains the implementation of the xslt::stylesheet class.
+ */
+
// xmlwrapp includes
#include "xsltwrapp/stylesheet.h"
#include "xmlwrapp/document.h"
@@ -55,33 +57,35 @@
#include <vector>
#include <map>
-namespace {
+namespace
+{
// implementation of xslt::result using xslt::stylesheet: we pass this object
// to xml::document for the documents obtained via XSLT so that some operations
// (currently only saving) could be done differently for them
-class result_impl : public xslt::impl::result {
+class result_impl : public xslt::impl::result
+{
public:
// We don't own the pointers given to us, their lifetime must be greater
// than the lifetime of this object.
- result_impl(xmlDocPtr doc, xsltStylesheetPtr ss) : doc_(doc), ss_(ss) { }
+ result_impl(xmlDocPtr doc, xsltStylesheetPtr ss) : doc_(doc), ss_(ss) {}
virtual void save_to_string(std::string &s) const
{
- xmlChar *xml_string;
- int xml_string_length;
+ xmlChar *xml_string;
+ int xml_string_length;
- if (xsltSaveResultToString(&xml_string, &xml_string_length, doc_, ss_) >= 0)
- {
- xml::impl::xmlchar_helper helper(xml_string);
- if (xml_string_length) s.assign(helper.get(), xml_string_length);
- }
+ if (xsltSaveResultToString(&xml_string, &xml_string_length, doc_, ss_) >= 0)
+ {
+ xml::impl::xmlchar_helper helper(xml_string);
+ if (xml_string_length) s.assign(helper.get(), xml_string_length);
+ }
}
virtual bool
- save_to_file (const char *filename, int /* compression_level */) const
+ save_to_file(const char *filename, int /* compression_level */) const
{
- return xsltSaveResultToFilename(filename, doc_, ss_, 0) >= 0;
+ return xsltSaveResultToFilename(filename, doc_, ss_, 0) >= 0;
}
private:
@@ -89,145 +93,169 @@
xsltStylesheetPtr ss_;
};
+
+void make_vector_param(std::vector<const char*> &v,
+ const xslt::stylesheet::param_type &p)
+{
+ v.reserve(p.size());
+
+ xslt::stylesheet::param_type::const_iterator i = p.begin(), end = p.end();
+ for (; i != end; ++i)
+ {
+ v.push_back(i->first.c_str());
+ v.push_back(i->second.c_str());
+ }
+
+ v.push_back(static_cast<const char*>(0));
+}
+
+
+xmlDocPtr apply_stylesheet(xsltStylesheetPtr s, xmlDocPtr d,
+ const xslt::stylesheet::param_type *p = NULL)
+{
+ /*
+ * TODO TODO TODO TODO
+ *
+ * use a transform context to capture error messages
+ *
+ * TODO TODO TODO TODO
+ */
+ std::vector<const char*> v;
+ if (p)
+ make_vector_param(v, *p);
+ return xsltApplyStylesheet(s, d, p ? &v[0] : 0);
+}
+
} // end of anonymous namespace
-//####################################################################
-namespace {
- void make_vector_param (std::vector<const char*> &v, const xslt::stylesheet::param_type &p);
- xmlDocPtr apply_stylesheet (xsltStylesheetPtr s, xmlDocPtr d, const xslt::stylesheet::param_type *p=0);
-}
-//####################################################################
-struct xslt::stylesheet::pimpl {
+
+struct xslt::stylesheet::pimpl
+{
pimpl (void) : ss_(0) { }
xsltStylesheetPtr ss_;
xml::document doc_;
std::string error_;
};
-//####################################################################
-xslt::stylesheet::stylesheet (const char *filename) {
+
+
+xslt::stylesheet::stylesheet(const char *filename)
+{
std::auto_ptr<pimpl> ap(pimpl_ = new pimpl);
xml::tree_parser parser(filename);
xmlDocPtr xmldoc = static_cast<xmlDocPtr>(parser.get_document().get_doc_data());
- if ( (pimpl_->ss_ = xsltParseStylesheetDoc(xmldoc)) == 0) {
- // TODO error_ can't get set yet. Need changes from libxslt first
- if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT parser error";
- throw std::runtime_error(pimpl_->error_);
+ if ( (pimpl_->ss_ = xsltParseStylesheetDoc(xmldoc)) == 0)
+ {
+ // TODO error_ can't get set yet. Need changes from libxslt first
+ if (pimpl_->error_.empty())
+ pimpl_->error_ = "unknown XSLT parser error";
+ throw std::runtime_error(pimpl_->error_);
}
- /*
- * if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is
- * now owned by the stylesheet and will be cleaned up in our destructor.
- */
+ // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is
+ // now owned by the stylesheet and will be cleaned up in our destructor.
parser.get_document().release_doc_data();
ap.release();
}
-//####################################################################
-xslt::stylesheet::stylesheet (xml::document doc) {
+
+
+xslt::stylesheet::stylesheet(xml::document doc)
+{
xmlDocPtr xmldoc = static_cast<xmlDocPtr>(doc.get_doc_data());
std::auto_ptr<pimpl> ap(pimpl_ = new pimpl);
- if ( (pimpl_->ss_ = xsltParseStylesheetDoc(xmldoc)) == 0) {
- // TODO error_ can't get set yet. Need changes from libxslt first
- if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT parser error";
- throw std::runtime_error(pimpl_->error_);
+ if ( (pimpl_->ss_ = xsltParseStylesheetDoc(xmldoc)) == 0)
+ {
+ // TODO error_ can't get set yet. Need changes from libxslt first
+ if (pimpl_->error_.empty())
+ pimpl_->error_ = "unknown XSLT parser error";
+ throw std::runtime_error(pimpl_->error_);
}
- /*
- * if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is
- * now owned by the stylesheet and will be cleaned up in our destructor.
- */
+ // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is
+ // now owned by the stylesheet and will be cleaned up in our destructor.
doc.release_doc_data();
ap.release();
}
-//####################################################################
-xslt::stylesheet::~stylesheet (void) {
- if (pimpl_->ss_) xsltFreeStylesheet(pimpl_->ss_);
+
+
+xslt::stylesheet::~stylesheet()
+{
+ if (pimpl_->ss_)
+ xsltFreeStylesheet(pimpl_->ss_);
delete pimpl_;
}
-//####################################################################
-bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result) {
+
+
+bool xslt::stylesheet::apply(const xml::document &doc, xml::document &result)
+{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input);
- if (xmldoc) {
- result.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
- return true;
+ if (xmldoc)
+ {
+ result.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
+ return true;
}
return false;
}
-//####################################################################
-bool xslt::stylesheet::apply (const xml::document &doc, xml::document &result, const param_type &with_params) {
+
+
+bool xslt::stylesheet::apply(const xml::document &doc, xml::document &result,
+ const param_type &with_params)
+{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
- xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params);
+ xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params);
- if (xmldoc) {
- result.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
- return true;
+ if (xmldoc)
+ {
+ result.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
+ return true;
}
return false;
}
-//####################################################################
-xml::document& xslt::stylesheet::apply (const xml::document &doc) {
+
+
+xml::document& xslt::stylesheet::apply(const xml::document &doc)
+{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input);
- if (xmldoc == 0) {
- if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT transformation error";
- throw std::runtime_error(pimpl_->error_);
+ if (xmldoc == 0)
+ {
+ if (pimpl_->error_.empty())
+ pimpl_->error_ = "unknown XSLT transformation error";
+ throw std::runtime_error(pimpl_->error_);
}
pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
return pimpl_->doc_;
}
-//####################################################################
-xml::document& xslt::stylesheet::apply (const xml::document &doc, const param_type &with_params) {
+
+
+xml::document& xslt::stylesheet::apply(const xml::document &doc,
+ const param_type &with_params)
+{
xmlDocPtr input = static_cast<xmlDocPtr>(doc.get_doc_data_read_only());
xmlDocPtr xmldoc = apply_stylesheet(pimpl_->ss_, input, &with_params);
- if (xmldoc == 0) {
- if (pimpl_->error_.empty()) pimpl_->error_ = "unknown XSLT transformation error";
- throw std::runtime_error(pimpl_->error_);
+ if (xmldoc == 0)
+ {
+ if (pimpl_->error_.empty())
+ pimpl_->error_ = "unknown XSLT transformation error";
+ throw std::runtime_error(pimpl_->error_);
}
pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_));
return pimpl_->doc_;
}
-//####################################################################
-const std::string& xslt::stylesheet::get_error_message (void) const {
- return pimpl_->error_;
-}
-//####################################################################
-namespace {
- //####################################################################
- void make_vector_param (std::vector<const char*> &v, const xslt::stylesheet::param_type &p) {
- v.reserve(p.size());
- xslt::stylesheet::param_type::const_iterator i=p.begin(), end=p.end();
- for (; i!=end; ++i) {
- v.push_back(i->first.c_str());
- v.push_back(i->second.c_str());
- }
- v.push_back(static_cast<const char*>(0));
- }
- //####################################################################
- xmlDocPtr apply_stylesheet (xsltStylesheetPtr s, xmlDocPtr d, const xslt::stylesheet::param_type *p) {
- /*
- * TODO TODO TODO TODO
- *
- * use a transform context to capture error messages
- *
- * TODO TODO TODO TODO
- */
- std::vector<const char*> v;
- if (p) make_vector_param(v, *p);
- return xsltApplyStylesheet(s, d, p ? &v[0] : 0);
- }
- //####################################################################
+const std::string& xslt::stylesheet::get_error_message() const
+{
+ return pimpl_->error_;
}
-//####################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-30 18:56:16
|
Revision: 143
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=143&view=rev
Author: vaclavslavik
Date: 2009-05-30 18:55:52 +0000 (Sat, 30 May 2009)
Log Message:
-----------
Converted test suite to Boost Test.
Modified Paths:
--------------
trunk/NEWS
trunk/tests/Makefile.am
trunk/tests/document/data/13a.out
trunk/tests/document/data/13b.out
trunk/tests/document/data/14.out
trunk/tests/node/data/07a.out
trunk/tests/node/data/07b.out
trunk/tests/node/data/08a.out
Added Paths:
-----------
trunk/tests/attributes/test_attributes.cxx
trunk/tests/event/test_event.cxx
trunk/tests/node/data/01.out
trunk/tests/node/data/empty.xml
trunk/tests/node/test_node.cxx
trunk/tests/test.h
trunk/tests/test_main.cxx
trunk/tests/tree/data/
trunk/tests/tree/data/bad.xml
trunk/tests/tree/data/good.xml
trunk/tests/tree/data/output
trunk/tests/tree/test_tree.cxx
trunk/tests/xslt/data/input.xml
trunk/tests/xslt/test_xslt.cxx
Removed Paths:
-------------
trunk/tests/attributes/Makefile.am
trunk/tests/attributes/data/05.xml
trunk/tests/attributes/data/05a.out
trunk/tests/attributes/data/05b.out
trunk/tests/attributes/data/05c.out
trunk/tests/attributes/data/05d.out
trunk/tests/attributes/data/06a.out
trunk/tests/attributes/data/06b.out
trunk/tests/attributes/data/07a.out
trunk/tests/attributes/data/07b.out
trunk/tests/attributes/data/07c.out
trunk/tests/attributes/data/07d.out
trunk/tests/attributes/data/09a.out
trunk/tests/attributes/data/09b.out
trunk/tests/attributes/data/09c.out
trunk/tests/attributes/data/10.out
trunk/tests/attributes/runtest.pl
trunk/tests/attributes/test_attr-01.cxx
trunk/tests/attributes/test_attr-02.cxx
trunk/tests/attributes/test_attr-03.cxx
trunk/tests/attributes/test_attr-04.cxx
trunk/tests/attributes/test_attr-05.cxx
trunk/tests/attributes/test_attr-06.cxx
trunk/tests/attributes/test_attr-07.cxx
trunk/tests/attributes/test_attr-08.cxx
trunk/tests/attributes/test_attr-09.cxx
trunk/tests/attributes/test_attr-10.cxx
trunk/tests/document/Makefile.am
trunk/tests/document/data/05.out
trunk/tests/document/data/06.out
trunk/tests/document/data/07.out
trunk/tests/document/data/09.out
trunk/tests/document/data/10.xml
trunk/tests/document/data/11.out
trunk/tests/document/data/12.xml
trunk/tests/document/data/16.out
trunk/tests/document/data/18a.out
trunk/tests/document/data/18b.out
trunk/tests/document/data/18c.out
trunk/tests/document/data/20.out
trunk/tests/document/data/22.out
trunk/tests/document/runtest.pl
trunk/tests/document/test_document-01.cxx
trunk/tests/document/test_document-02.cxx
trunk/tests/document/test_document-03.cxx
trunk/tests/document/test_document-04.cxx
trunk/tests/document/test_document-05.cxx
trunk/tests/document/test_document-06.cxx
trunk/tests/document/test_document-07.cxx
trunk/tests/document/test_document-08.cxx
trunk/tests/document/test_document-09.cxx
trunk/tests/document/test_document-10.cxx
trunk/tests/document/test_document-11.cxx
trunk/tests/document/test_document-12.cxx
trunk/tests/document/test_document-13.cxx
trunk/tests/document/test_document-14.cxx
trunk/tests/document/test_document-15.cxx
trunk/tests/document/test_document-16.cxx
trunk/tests/document/test_document-17.cxx
trunk/tests/document/test_document-18.cxx
trunk/tests/document/test_document-19.cxx
trunk/tests/document/test_document-20.cxx
trunk/tests/document/test_document-21.cxx
trunk/tests/document/test_document-22.cxx
trunk/tests/event/Makefile.am
trunk/tests/event/runtest.pl
trunk/tests/event/test_event-01.cxx
trunk/tests/event/test_event-02.cxx
trunk/tests/event/test_event-03.cxx
trunk/tests/harness/
trunk/tests/node/Makefile.am
trunk/tests/node/data/01.xml
trunk/tests/node/data/02b.out
trunk/tests/node/data/02d.out
trunk/tests/node/data/02e.out
trunk/tests/node/data/02f.out
trunk/tests/node/data/02h.out
trunk/tests/node/data/12.out
trunk/tests/node/data/13.out
trunk/tests/node/runtest.pl
trunk/tests/node/test_node-01.cxx
trunk/tests/node/test_node-02a.cxx
trunk/tests/node/test_node-02b.cxx
trunk/tests/node/test_node-02c.cxx
trunk/tests/node/test_node-02d.cxx
trunk/tests/node/test_node-02e.cxx
trunk/tests/node/test_node-02f.cxx
trunk/tests/node/test_node-02g.cxx
trunk/tests/node/test_node-02h.cxx
trunk/tests/node/test_node-03a.cxx
trunk/tests/node/test_node-03b.cxx
trunk/tests/node/test_node-04a.cxx
trunk/tests/node/test_node-04b.cxx
trunk/tests/node/test_node-05a.cxx
trunk/tests/node/test_node-05b.cxx
trunk/tests/node/test_node-05c.cxx
trunk/tests/node/test_node-05d.cxx
trunk/tests/node/test_node-06.cxx
trunk/tests/node/test_node-07.cxx
trunk/tests/node/test_node-08.cxx
trunk/tests/node/test_node-09.cxx
trunk/tests/node/test_node-10.cxx
trunk/tests/node/test_node-11.cxx
trunk/tests/node/test_node-12.cxx
trunk/tests/node/test_node-13.cxx
trunk/tests/node/test_node-14.cxx
trunk/tests/tree/Makefile.am
trunk/tests/tree/runtest.pl
trunk/tests/tree/test_tree-01.cxx
trunk/tests/tree/test_tree-02.cxx
trunk/tests/tree/test_tree-03.cxx
trunk/tests/tree/test_tree-04.cxx
trunk/tests/tree/test_tree-05.cxx
trunk/tests/tree/test_tree-06.cxx
trunk/tests/xslt/Makefile.am
trunk/tests/xslt/data/02a.xml
trunk/tests/xslt/data/03a.xml
trunk/tests/xslt/data/04a.out
trunk/tests/xslt/data/04a.xml
trunk/tests/xslt/data/04a.xsl
trunk/tests/xslt/data/05a.out
trunk/tests/xslt/data/05a.xml
trunk/tests/xslt/data/05a.xsl
trunk/tests/xslt/runtest.pl
trunk/tests/xslt/test_xslt-01.cxx
trunk/tests/xslt/test_xslt-02.cxx
trunk/tests/xslt/test_xslt-03.cxx
trunk/tests/xslt/test_xslt-04.cxx
trunk/tests/xslt/test_xslt-05.cxx
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/NEWS 2009-05-30 18:55:52 UTC (rev 143)
@@ -3,6 +3,8 @@
Fixed xml::event_parser::parse_stream() to return false on empty
input (Michael Grundberg, #2787836).
+ Converted test suite to Boost Test.
+
Version 0.6.0
Fixed libxmlwrapp to not depend on libxslt if XSLT support
Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,10 +1,22 @@
-SUBDIRS = \
- attributes \
- document \
- event \
- node \
- tree \
- xslt
+TESTS = test
-EXTRA_DIST = harness/harness.pm
+AM_CPPFLAGS = -I$(top_srcdir)/include
+LIBS = $(top_builddir)/src/libxmlwrapp.la \
+ -lboost_unit_test_framework \
+ -lboost_iostreams
+
+noinst_PROGRAMS = test
+
+test_SOURCES = \
+ test_main.cxx \
+ attributes/test_attributes.cxx \
+ document/test_document.cxx \
+ event/test_event.cxx \
+ node/test_node.cxx \
+ tree/test_tree.cxx
+
+if WITH_XSLT
+LIBS += $(top_builddir)/src/libxsltwrapp.la
+test_SOURCES += xslt/test_xslt.cxx
+endif
Deleted: trunk/tests/attributes/Makefile.am
===================================================================
--- trunk/tests/attributes/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,30 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-LIBS = ../../src/libxmlwrapp.la
-
-TESTS = runtest.pl
-
-noinst_PROGRAMS = \
- test_attr-01 \
- test_attr-02 \
- test_attr-03 \
- test_attr-04 \
- test_attr-05 \
- test_attr-06 \
- test_attr-07 \
- test_attr-08 \
- test_attr-09 \
- test_attr-10
-
-test_attr_01_SOURCES = test_attr-01.cxx
-test_attr_02_SOURCES = test_attr-02.cxx
-test_attr_03_SOURCES = test_attr-03.cxx
-test_attr_04_SOURCES = test_attr-04.cxx
-test_attr_05_SOURCES = test_attr-05.cxx
-test_attr_06_SOURCES = test_attr-06.cxx
-test_attr_07_SOURCES = test_attr-07.cxx
-test_attr_08_SOURCES = test_attr-08.cxx
-test_attr_09_SOURCES = test_attr-09.cxx
-test_attr_10_SOURCES = test_attr-10.cxx
-
-EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml $(srcdir)/data/*.dtd runtest.pl
Deleted: trunk/tests/attributes/data/05.xml
===================================================================
--- trunk/tests/attributes/data/05.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-<root attr_one="one" attr_two="two" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05a.out
===================================================================
--- trunk/tests/attributes/data/05a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_two="two" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05b.out
===================================================================
--- trunk/tests/attributes/data/05b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05c.out
===================================================================
--- trunk/tests/attributes/data/05c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_two="two" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05d.out
===================================================================
--- trunk/tests/attributes/data/05d.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05d.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_two="two" attr_three="three"/>
Deleted: trunk/tests/attributes/data/06a.out
===================================================================
--- trunk/tests/attributes/data/06a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/06a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1
Deleted: trunk/tests/attributes/data/06b.out
===================================================================
--- trunk/tests/attributes/data/06b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/06b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-0
Deleted: trunk/tests/attributes/data/07a.out
===================================================================
--- trunk/tests/attributes/data/07a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-0
Deleted: trunk/tests/attributes/data/07b.out
===================================================================
--- trunk/tests/attributes/data/07b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1
Deleted: trunk/tests/attributes/data/07c.out
===================================================================
--- trunk/tests/attributes/data/07c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-2
Deleted: trunk/tests/attributes/data/07d.out
===================================================================
--- trunk/tests/attributes/data/07d.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07d.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-3
Deleted: trunk/tests/attributes/data/09a.out
===================================================================
--- trunk/tests/attributes/data/09a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-1
-notend
-end
Deleted: trunk/tests/attributes/data/09b.out
===================================================================
--- trunk/tests/attributes/data/09b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-two
-notend
-end
Deleted: trunk/tests/attributes/data/09c.out
===================================================================
--- trunk/tests/attributes/data/09c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-three
-notend
-end
Deleted: trunk/tests/attributes/data/10.out
===================================================================
--- trunk/tests/attributes/data/10.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/10.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-****END****
Deleted: trunk/tests/attributes/runtest.pl
===================================================================
--- trunk/tests/attributes/runtest.pl 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/runtest.pl 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,141 +0,0 @@
-#!/usr/bin/perl
-###########################################################################
-# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
-# All Rights Reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name of the Author nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-###########################################################################
-
-use strict;
-use lib qw(../harness);
-use harness;
-
-my $test = harness->new("xml::attributes");
-runtests();
-
-###########################################################################
-sub runtests {
- my $actual_result;
- my $good_result;
-
- ###########################################################################
- foreach (qw(01a 01b 01c)) {
- $test->start("iteration ($_)");
- $actual_result = `./test_attr-01 data/$_.xml 2>&1`;
-
- if ($? != 0) {
- $test->fail("test process returned $?");
- } else {
- $good_result = $test->slurp_file("data/$_.out");
-
- my $hash_a = make_hash($actual_result);
- my $hash_b = make_hash($good_result);
-
- if (not comp_hash($hash_a, $hash_b)) {
- $test->fail('output did not match expected value');
- } else {
- $test->pass();
- }
- }
- }
- ###########################################################################
- $test->regression("insert(name, value) (02)", "./test_attr-02 data/02.xml", "data/02.out");
- ###########################################################################
- foreach my $pair ((['one', 0], ['two', 0], ['three', 0], ['missing', 1], ['also_missing', 1])) {
- $test->run_test_exit_status("find(name) (03)", "./test_attr-03 data/03.xml $pair->[0]", $pair->[1]);
- }
- ###########################################################################
- foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) {
- $test->regression("remove(iterator) (04$pair->[0])", "./test_attr-04 data/04.xml $pair->[1]", "data/04$pair->[0].out");
- }
- ###########################################################################
- foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) {
- $test->regression("remove(const char*) (05$pair->[0])", "./test_attr-05 data/05.xml $pair->[1]", "data/05$pair->[0].out");
- }
- ###########################################################################
- foreach (qw(a b)) {
- $test->regression("empty (06$_)", "./test_attr-06 data/06$_.xml", "data/06$_.out");
- }
- ###########################################################################
- foreach (qw(a b c d)) {
- $test->regression("size (07$_)", "./test_attr-07 data/07$_.xml", "data/07$_.out");
- }
- ###########################################################################
- $test->start("copy constructor (08)");
- $actual_result = `./test_attr-08 data/08.xml 2>&1`;
-
- if ($? != 0) {
- $test->fail("test process returned $?");
- } else {
- $good_result = $test->slurp_file("data/08.out");
-
- my $hash_a = make_hash($actual_result);
- my $hash_b = make_hash($good_result);
-
- if (not comp_hash($hash_a, $hash_b)) {
- $test->fail('output did not match expected value');
- } else {
- $test->pass();
- }
- }
- ###########################################################################
- foreach ((['a', 'one'], ['b', 'two'], ['c', 'three'])) {
- $test->regression("dtd attr (09$_->[0])", "./test_attr-09 data/09.xml $_->[1]", "data/09$_->[0].out");
- }
- ###########################################################################
- $test->regression("dtd implied (10)", "./test_attr-10 data/10.xml optional", "data/10.out");
- ###########################################################################
-}
-###########################################################################
-sub make_hash {
- my $data = shift;
- my ($key, $value);
- my %hash;
-
- foreach my $line (split(/\n/, $data)) {
- my ($key, $value) = split(/=/, $line, 2);
- next if not defined $key or not defined $value;
- $hash{$key} = $value;
- }
-
- return \%hash;
-}
-###########################################################################
-sub comp_hash {
- my $hash_a = shift;
- my $hash_b = shift;
-
- if (scalar keys %$hash_a != scalar keys %$hash_b) { return 0; }
- foreach my $key (keys %$hash_a) {
- if (not exists $hash_b->{$key}) { return 0; }
- if ($hash_a->{$key} ne $hash_b->{$key}) { return 0; }
- }
-
- return 1;
-}
-###########################################################################
Deleted: trunk/tests/attributes/test_attr-01.cxx
===================================================================
--- trunk/tests/attributes/test_attr-01.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-01.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes function can see all the attributes of
- * a node.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
- for (; i!=end; ++i) { std::cout << i->get_name() << "=" << i->get_value() << "\n"; }
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-02.cxx
===================================================================
--- trunk/tests/attributes/test_attr-02.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-02.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::insert function works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- attrs.insert("b", "b");
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-03.cxx
===================================================================
--- trunk/tests/attributes/test_attr-03.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-03.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::find works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) return 1;
- return 0;
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-04.cxx
===================================================================
--- trunk/tests/attributes/test_attr-04.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-04.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::remove(iterator) works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) return 1;
- attrs.erase(i);
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-05.cxx
===================================================================
--- trunk/tests/attributes/test_attr-05.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-05.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::remove(const char*) works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- attrs.erase(argv[2]);
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-06.cxx
===================================================================
--- trunk/tests/attributes/test_attr-06.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-06.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::empty() works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- std::cout << attrs.empty() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-07.cxx
===================================================================
--- trunk/tests/attributes/test_attr-07.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-07.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::size() works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- std::cout << attrs.size() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-08.cxx
===================================================================
--- trunk/tests/attributes/test_attr-08.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-08.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes copy constructor works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- /* MAKE A COPY! */
- xml::attributes attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
- for (; i!=end; ++i) std::cout << i->get_name() << "=" << i->get_value() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-09.cxx
===================================================================
--- trunk/tests/attributes/test_attr-09.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-09.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::find() can see DTD default attributes
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) {
- std::cerr << "xml not valid\n";
- return 1;
- }
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- std::cout << i->get_value() << "\n";
- std::cout << (i == attrs.end() ? "end" : "notend") << "\n";
-
- ++i;
-
- std::cout << (i == attrs.end() ? "end" : "notend") << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-10.cxx
===================================================================
--- trunk/tests/attributes/test_attr-10.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-10.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::find() will die when DTD default
- * attributes are really implied.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) {
- std::cerr << "xml not valid\n";
- return 1;
- }
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) std::cout << "****END****\n";
- else std::cout << i->get_value() << "\n";
-
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Added: trunk/tests/attributes/test_attributes.cxx
===================================================================
--- trunk/tests/attributes/test_attributes.cxx (rev 0)
+++ trunk/tests/attributes/test_attributes.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * Copyright (C) 2009 Vaclav Slavik (vs...@fa...)
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "../test.h"
+
+
+BOOST_AUTO_TEST_SUITE( attributes )
+
+/*
+ * Test to see if the xml::attributes function can see all the attributes of
+ * a node.
+ */
+
+static void do_attr_read(const std::string& prefix)
+{
+ std::ostringstream ostr;
+
+ xml::tree_parser parser(test_file_path(prefix + ".xml").c_str());
+
+ const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
+ for (; i!=end; ++i)
+ {
+ ostr << i->get_name() << "=" << i->get_value() << "\n";
+ }
+
+ BOOST_CHECK( is_same_as_file(ostr, prefix + ".out") );
+}
+
+BOOST_AUTO_TEST_CASE( read )
+{
+ do_attr_read("attributes/data/01a");
+ do_attr_read("attributes/data/01b");
+ do_attr_read("attributes/data/01c");
+}
+
+
+/*
+ * Test to see if the xml::attributes::insert function works.
+ */
+
+BOOST_AUTO_TEST_CASE( insert )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/02.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ attrs.insert("b", "b");
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), "attributes/data/02.out") );
+}
+
+
+/*
+ * Test to see if the xml::attributes::find works.
+ */
+
+static bool do_attr_find(const xml::document& doc,
+ const char *to_find,
+ const char *expected_value)
+{
+ const xml::attributes &attrs = doc.get_root_node().get_attributes();
+ xml::attributes::const_iterator i = attrs.find(to_find);
+
+ if ( i == attrs.end() )
+ return false;
+
+ BOOST_CHECK_EQUAL( i->get_name(), to_find );
+ BOOST_CHECK_EQUAL( i->get_value(), expected_value );
+
+ return true;
+}
+
+BOOST_AUTO_TEST_CASE( find )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/03.xml").c_str());
+ const xml::document& doc = parser.get_document();
+
+ BOOST_CHECK( do_attr_find(doc, "one", "1") == true );
+ BOOST_CHECK( do_attr_find(doc, "two", "2") == true );
+ BOOST_CHECK( do_attr_find(doc, "three", "3") == true );
+ BOOST_CHECK( do_attr_find(doc, "missing", NULL) == false );
+ BOOST_CHECK( do_attr_find(doc, "also_missing", NULL) == false );
+}
+
+
+/*
+ * Test to see if the xml::attributes::remove(iterator) works.
+ */
+
+static void do_remove_by_iter(const char *name, const char *outfile)
+{
+ xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::iterator i = attrs.find(name);
+
+ BOOST_REQUIRE( i != attrs.end() );
+ attrs.erase(i);
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) );
+}
+
+BOOST_AUTO_TEST_CASE( remove_by_iter )
+{
+ do_remove_by_iter("attr_one", "attributes/data/04a.out");
+ do_remove_by_iter("attr_two", "attributes/data/04b.out");
+ do_remove_by_iter("attr_three", "attributes/data/04c.out");
+ do_remove_by_iter("attr_four", "attributes/data/04d.out");
+}
+
+
+/*
+ * Test to see if the xml::attributes::remove(const char*) works.
+ */
+
+static void do_remove_by_name(const char *name, const char *outfile)
+{
+ xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ attrs.erase(name);
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) );
+}
+
+BOOST_AUTO_TEST_CASE( remove_by_name )
+{
+ do_remove_by_name("attr_one", "attributes/data/04a.out");
+ do_remove_by_name("attr_two", "attributes/data/04b.out");
+ do_remove_by_name("attr_three", "attributes/data/04c.out");
+ do_remove_by_name("attr_four", "attributes/data/04d.out");
+}
+
+
+/*
+ * Test to see if xml::attributes::find() can see DTD default attributes
+ */
+
+BOOST_AUTO_TEST_CASE( find_dtd_default_attr )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/09.xml").c_str());
+
+ BOOST_CHECK( parser.get_document().has_internal_subset() );
+ BOOST_CHECK( parser.get_document().validate() );
+
+ const xml::attributes &attrs =
+ parser.get_document().get_root_node().get_attributes();
+
+ {
+ xml::attributes::const_iterator i = attrs.find("one");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "1" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+
+ {
+ xml::attributes::const_iterator i = attrs.find("two");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "two" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+
+ {
+ xml::attributes::const_iterator i = attrs.find("three");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "three" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+}
+
+
+/*
+ * Test to see if xml::attributes::find() will die when DTD default
+ * attributes are really implied.
+ */
+
+BOOST_AUTO_TEST_CASE( dtd_implied )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/10.xml").c_str());
+
+ BOOST_CHECK( parser.get_document().has_internal_subset() );
+ BOOST_CHECK( parser.get_document().validate() );
+
+ const xml::attributes &attrs =
+ parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( attrs.find("optional") == attrs.end() );
+}
+
+
+/*
+ * Test to see if the xml::attributes copy constructor works.
+ */
+
+BOOST_AUTO_TEST_CASE( attr_copy_ctor )
+{
+ std::ostringstream ostr;
+ xml::tree_parser parser(test_file_path("attributes/data/08.xml").c_str());
+
+ // make a copy
+ xml::attributes attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::const_iterator i = attrs.begin(), end = attrs.end();
+
+ for ( ; i != end; ++i )
+ ostr << i->get_name() << "=" << i->get_value() << "\n";
+
+ BOOST_CHECK( is_same_as_file(ostr, "attributes/data/08.out") );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+
+/*
+ * Test to see if the xml::attributes::empty() works.
+ */
+
+BOOST_AUTO_TEST_CASE( attr_empty_a )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/06a.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( attrs.empty() );
+}
+
+BOOST_AUTO_TEST_CASE( attr_empty_b )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/06b.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( !attrs.empty() );
+}
+
+
+/*
+ * Test to see if xml::attributes::size() works.
+ */
+
+static int do_get_attr_size(const char *testfile)
+{
+ xml::tree_parser parser(test_file_path(testfile).c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ return attrs.size();
+}
+
+BOOST_AUTO_TEST_CASE( attr_size )
+{
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07a.xml"), 0 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07b.xml"), 1 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07c.xml"), 2 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07d.xml"), 3 );
+}
Deleted: trunk/tests/document/Makefile.am
===================================================================
--- trunk/tests/document/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,54 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-LIBS = ../../src/libxmlwrapp.la
-
-TESTS = runtest.pl
-
-noinst_PROGRAMS = \
- test_document-01 \
- test_document-02 \
- test_document-03 \
- test_document-04 \
- test_document-05 \
- test_document-06 \
- test_document-07 \
- test_document-08 \
- test_document-09 \
- test_document-10 \
- test_document-11 \
- test_document-12 \
- test_document-13 \
- test_document-14 \
- test_document-15 \
- test_document-16 \
- test_document-17 \
- test_document-18 \
- test_document-19 \
- test_document-20 \
- test_document-21 \
- test_document-22
-
-test_document_01_SOURCES = test_document-01.cxx
-test_document_02_SOURCES = test_document-02.cxx
-test_document_03_SOURCES = test_document-03.cxx
-test_document_04_SOURCES = test_document-04.cxx
-test_document_05_SOURCES = test_document-05.cxx
-test_document_06_SOURCES = test_document-06.cxx
-test_document_07_SOURCES = test_document-07.cxx
-test_document_08_SOURCES = test_document-08.cxx
-test_document_09_SOURCES = test_document-09.cxx
-test_document_10_SOURCES = test_document-10.cxx
-test_document_11_SOURCES = test_document-11.cxx
-test_document_12_SOURCES = test_document-12.cxx
-test_document_13_SOURCES = test_document-13.cxx
-test_document_14_SOURCES = test_document-14.cxx
-test_document_15_SOURCES = test_document-15.cxx
-test_document_16_SOURCES = test_document-16.cxx
-test_document_17_SOURCES = test_document-17.cxx
-test_document_18_SOURCES = test_document-18.cxx
-test_document_19_SOURCES = test_document-19.cxx
-test_document_20_SOURCES = test_document-20.cxx
-test_document_21_SOURCES = test_document-21.cxx
-test_document_22_SOURCES = test_document-22.cxx
-
-EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl
Deleted: trunk/tests/document/data/05.out
===================================================================
--- trunk/tests/document/data/05.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/05.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/06.out
===================================================================
--- trunk/tests/document/data/06.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/06.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/07.out
===================================================================
--- trunk/tests/document/data/07.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/07.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/09.out
===================================================================
--- trunk/tests/document/data/09.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/09.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1.1
Deleted: trunk/tests/document/data/10.xml
===================================================================
--- trunk/tests/document/data/10.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/10.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.1"?>
-<root/>
Deleted: trunk/tests/document/data/11.out
===================================================================
--- trunk/tests/document/data/11.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/11.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-UTF-8
Deleted: trunk/tests/document/data/12.xml
===================================================================
--- trunk/tests/document/data/12.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/12.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-<root/>
Modified: trunk/tests/document/data/13a.out
===================================================================
--- trunk/tests/document/data/13a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/13a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +1,2 @@
-0
<?xml version="1.0" standalone="yes"?>
<root/>
Modified: trunk/tests/document/data/13b.out
===================================================================
--- trunk/tests/document/data/13b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/13b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +1,2 @@
-1
<?xml version="1.0" standalone="no"?>
<root/>
Modified: trunk/tests/document/data/14.out
===================================================================
--- trunk/tests/document/data/14.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/14.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,4 +1,3 @@
-1
<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<child>
Deleted: trunk/tests/document/data/16.out
===================================================================
--- trunk/tests/document/data/16.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/16.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,5 +0,0 @@
-1
-2
-2
-1
-1
Deleted: trunk/tests/document/data/18a.out
===================================================================
--- trunk/tests/document/data/18a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::push_back can't take element type nodes
Deleted: trunk/tests/document/data/18b.out
===================================================================
--- trunk/tests/document/data/18b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::insert can't take element type nodes
Deleted: trunk/tests/document/data/18c.out
===================================================================
--- trunk/tests/document/data/18c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::insert can't take element type nodes
Deleted: trunk/tests/document/data/20.out
===================================================================
--- trunk/tests/document/data/20.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/20.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::replace can't replace element type nodes
Deleted: trunk/tests/document/data/22.out
===================================================================
--- trunk/tests/document/data/22.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/22.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::erase can't erase element type nodes
Deleted: trunk/tests/document/runtest.pl
===================================================================
--- trunk/tests/document/runtest.pl 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/runtest.pl 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,89 +0,0 @@
-#!/usr/bin/perl
-###########################################################################
-# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
-# All Rights Reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions ...
[truncated message content] |
|
From: <vac...@us...> - 2009-05-17 18:56:31
|
Revision: 142
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=142&view=rev
Author: vaclavslavik
Date: 2009-05-17 18:56:30 +0000 (Sun, 17 May 2009)
Log Message:
-----------
fixed event_parser::parse_stream() to return false on empty input (patch #2787836 by Michael Grundberg)
Modified Paths:
--------------
trunk/AUTHORS
trunk/NEWS
trunk/src/libxml/event_parser.cxx
Modified: trunk/AUTHORS
===================================================================
--- trunk/AUTHORS 2009-05-16 15:04:35 UTC (rev 141)
+++ trunk/AUTHORS 2009-05-17 18:56:30 UTC (rev 142)
@@ -13,3 +13,4 @@
Daniel Evison
Frank Grimm
Gary Passero
+ Michael Grundberg <mgr...@us...>
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-16 15:04:35 UTC (rev 141)
+++ trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142)
@@ -1,5 +1,8 @@
Added Visual C++ 200x projects and fixed VC6 project.
+ Fixed xml::event_parser::parse_stream() to return false on empty
+ input (Michael Grundberg, #2787836).
+
Version 0.6.0
Fixed libxmlwrapp to not depend on libxslt if XSLT support
Modified: trunk/src/libxml/event_parser.cxx
===================================================================
--- trunk/src/libxml/event_parser.cxx 2009-05-16 15:04:35 UTC (rev 141)
+++ trunk/src/libxml/event_parser.cxx 2009-05-17 18:56:30 UTC (rev 142)
@@ -124,6 +124,13 @@
bool xml::event_parser::parse_stream (std::istream &stream) {
char buffer[const_buffer_size];
+ if (stream && (stream.eof() || stream.peek() == std::istream::traits_type::eof()))
+ {
+ pimpl_->parser_status_ = false;
+ pimpl_->last_error_message_ = "empty xml document";
+ return false;
+ }
+
while (pimpl_->parser_status_ && (stream.read(buffer, const_buffer_size) || stream.gcount()))
pimpl_->parser_status_ = parse_chunk(buffer, stream.gcount());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-05-16 15:04:50
|
Revision: 141
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=141&view=rev
Author: vaclavslavik
Date: 2009-05-16 15:04:35 +0000 (Sat, 16 May 2009)
Log Message:
-----------
tagged 0.6.0 release
Added Paths:
-----------
tags/release-0.6.0/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-04-27 18:43:10
|
Revision: 140
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=140&view=rev
Author: vaclavslavik
Date: 2009-04-27 18:43:00 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
added Bakefile-generated VC++ projects; changed VC6 project file to be generated too
Modified Paths:
--------------
trunk/Makefile.am
trunk/NEWS
trunk/README
Added Paths:
-----------
trunk/platform/Win32/Bakefiles.bkgen
trunk/platform/Win32/README
trunk/platform/Win32/xmlwrapp.bkl
Removed Paths:
-------------
trunk/platform/Win32/xmlwrapp.dsp
trunk/platform/Win32/xmlwrapp.dsw
Property Changed:
----------------
trunk/platform/Win32/
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-04-17 13:07:32 UTC (rev 139)
+++ trunk/Makefile.am 2009-04-27 18:43:00 UTC (rev 140)
@@ -11,5 +11,13 @@
bin_SCRIPTS = xmlwrapp-config
-EXTRA_DIST = LICENSE bootstrap \
- $(srcdir)/platform/Win32/*.dsp $(srcdir)/platform/Win32/*.dsw
+EXTRA_DIST = \
+ LICENSE bootstrap \
+ $(srcdir)/platform/Win32/README \
+ $(srcdir)/platform/Win32/*.dsp \
+ $(srcdir)/platform/Win32/Bakefiles.bkgen \
+ $(srcdir)/platform/Win32/*.bkl
+
+dist-hook:
+ (cd $(distdir)/platform/Win32 ; bakefile_gen)
+ rm -f $(distdir)/platform/Win32/.bakefile_gen.state
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-04-17 13:07:32 UTC (rev 139)
+++ trunk/NEWS 2009-04-27 18:43:00 UTC (rev 140)
@@ -1,3 +1,5 @@
+ Added Visual C++ 200x projects and fixed VC6 project.
+
Version 0.6.0
Fixed libxmlwrapp to not depend on libxslt if XSLT support
Modified: trunk/README
===================================================================
--- trunk/README 2009-04-17 13:07:32 UTC (rev 139)
+++ trunk/README 2009-04-27 18:43:00 UTC (rev 140)
@@ -25,7 +25,9 @@
----------------------
At this time, only building with Visual C++ compiler is supported. The required
-project files are located in platform/Win32 directory.
+project files are located in platform/Win32 directory. You will need libxml
+and libxslt libraries built for Windows, e.g. the binaries from
+http://www.zlatkovic.com/libxml.en.html.
4. Using xmlwrapp
Property changes on: trunk/platform/Win32
___________________________________________________________________
Added: svn:ignore
+ Debug
Release
xmlwrapp_vc?_xmlwrapp.vcproj*
xmlwrapp_vc?_xsltwrapp.vcproj*
xmlwrapp_vc?.sln
*.ncb
*.suo
.bakefile_gen.state
Added: trunk/platform/Win32/Bakefiles.bkgen
===================================================================
--- trunk/platform/Win32/Bakefiles.bkgen (rev 0)
+++ trunk/platform/Win32/Bakefiles.bkgen 2009-04-27 18:43:00 UTC (rev 140)
@@ -0,0 +1,23 @@
+<?xml version="1.0" ?>
+
+<bakefile-gen xmlns="http://www.bakefile.org/schema/bakefile-gen">
+
+ <input>
+ xmlwrapp.bkl
+ </input>
+
+ <add-formats>
+ msvc6prj,msvs2003prj,msvs2005prj,msvs2008prj
+ </add-formats>
+
+ <add-flags formats="msvs2003prj">
+ -o $(INPUT_FILE_DIR)/$(INPUT_FILE_BASENAME_NOEXT)_vc7.sln
+ </add-flags>
+ <add-flags formats="msvs2005prj">
+ -o $(INPUT_FILE_DIR)/$(INPUT_FILE_BASENAME_NOEXT)_vc8.sln
+ </add-flags>
+ <add-flags formats="msvs2008prj">
+ -o $(INPUT_FILE_DIR)/$(INPUT_FILE_BASENAME_NOEXT)_vc9.sln
+ </add-flags>
+
+</bakefile-gen>
Added: trunk/platform/Win32/README
===================================================================
--- trunk/platform/Win32/README (rev 0)
+++ trunk/platform/Win32/README 2009-04-27 18:43:00 UTC (rev 140)
@@ -0,0 +1,3 @@
+
+Please use Bakefile (http://www.bakefile.org) to generate Visual C++ project
+files.
Added: trunk/platform/Win32/xmlwrapp.bkl
===================================================================
--- trunk/platform/Win32/xmlwrapp.bkl (rev 0)
+++ trunk/platform/Win32/xmlwrapp.bkl 2009-04-27 18:43:00 UTC (rev 140)
@@ -0,0 +1,66 @@
+<?xml version="1.0" ?>
+
+<makefile>
+ <set-srcdir>../..</set-srcdir>
+
+ <include file="presets/simple.bkl"/>
+
+ <template id="xmlwrapp_lib" template="simple">
+ </template>
+
+
+ <lib id="xmlwrapp" template="xmlwrapp_lib">
+ <headers>
+ include/xmlwrapp/attributes.h
+ include/xmlwrapp/_cbfo.h
+ include/xmlwrapp/document.h
+ include/xmlwrapp/event_parser.h
+ include/xmlwrapp/init.h
+ include/xmlwrapp/node.h
+ include/xmlwrapp/nodes_view.h
+ include/xmlwrapp/tree_parser.h
+ include/xmlwrapp/xmlwrapp.h
+
+ <!-- private headers -->
+ src/libxml/ait_impl.h
+ src/libxml/dtd_impl.h
+ src/libxml/node_iterator.h
+ src/libxml/node_manip.h
+ src/libxml/pimpl_base.h
+ src/libxml/utility.h
+ </headers>
+
+ <sources>
+ src/libxml/ait_impl.cxx
+ src/libxml/attributes.cxx
+ src/libxml/document.cxx
+ src/libxml/dtd_impl.cxx
+ src/libxml/event_parser.cxx
+ src/libxml/init.cxx
+ src/libxml/node.cxx
+ src/libxml/node_iterator.cxx
+ src/libxml/node_manip.cxx
+ src/libxml/nodes_view.cxx
+ src/libxml/tree_parser.cxx
+ src/libxml/utility.cxx
+ </sources>
+ </lib>
+
+
+ <lib id="xsltwrapp" template="xmlwrapp_lib">
+ <headers>
+ include/xsltwrapp/init.h
+ include/xsltwrapp/stylesheet.h
+ include/xsltwrapp/xsltwrapp.h
+
+ <!-- private headers -->
+ src/libxslt/result.h
+ </headers>
+
+ <sources>
+ src/libxslt/init.cxx
+ src/libxslt/stylesheet.cxx
+ </sources>
+ </lib>
+
+</makefile>
Deleted: trunk/platform/Win32/xmlwrapp.dsp
===================================================================
--- trunk/platform/Win32/xmlwrapp.dsp 2009-04-17 13:07:32 UTC (rev 139)
+++ trunk/platform/Win32/xmlwrapp.dsp 2009-04-27 18:43:00 UTC (rev 140)
@@ -1,172 +0,0 @@
-# Microsoft Developer Studio Project File - Name="xmlwrapp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=xmlwrapp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwrapp.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlwrapp.mak" CFG="xmlwrapp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlwrapp - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "xmlwrapp - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlwrapp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /I../../include /I..\..\..\libxml2-2.4.30.win32\include /I..\..\..\iconv-1.8.win32\include /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "xmlwrapp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /I../../include /I../../../libxml2-2.4.30.win32\include /I../../../iconv-1.8.win32\include /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlwrapp - Win32 Release"
-# Name "xmlwrapp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\src\libxml\ait_impl.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\attributes.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\document.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\dtd_impl.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\event_parser.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\init.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\node.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\nodes_view.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\node_iterator.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\node_iterator.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\tree_parser.cxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\libxml\utility.cxx
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\attributes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\document.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\event_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\init.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\node.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\nodes_view.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\tree_parser.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\xmlwrapp\xmlwrapp.h
-# End Source File
-# End Group
-# End Target
-# End Project
Deleted: trunk/platform/Win32/xmlwrapp.dsw
===================================================================
--- trunk/platform/Win32/xmlwrapp.dsw 2009-04-17 13:07:32 UTC (rev 139)
+++ trunk/platform/Win32/xmlwrapp.dsw 2009-04-27 18:43:00 UTC (rev 140)
@@ -1,74 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "example event parser"=".\example_event_parser.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlwrapp
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "example tree parser"=".\example_tree_parser.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlwrapp
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "example xml generation"=".\example_xml_generation.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlwrapp
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlwrapp"=".\xmlwrapp.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-04-17 13:07:47
|
Revision: 139
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=139&view=rev
Author: vaclavslavik
Date: 2009-04-17 13:07:32 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
use pkg-config's Require: field instead of Libs.private for dependency libraries
Modified Paths:
--------------
trunk/xmlwrapp.pc.in
trunk/xsltwrapp.pc.in
Modified: trunk/xmlwrapp.pc.in
===================================================================
--- trunk/xmlwrapp.pc.in 2009-02-22 12:45:16 UTC (rev 138)
+++ trunk/xmlwrapp.pc.in 2009-04-17 13:07:32 UTC (rev 139)
@@ -6,7 +6,6 @@
Name: xmlwrapp
Version: @VERSION@
Description: A C++ wrapper around libxml2
-Requires:
+Requires: libxml-2.0
Libs: -L${libdir} -lxmlwrapp
-Libs.private: @LIBXML_LIBS@
Cflags: -I${includedir}
Modified: trunk/xsltwrapp.pc.in
===================================================================
--- trunk/xsltwrapp.pc.in 2009-02-22 12:45:16 UTC (rev 138)
+++ trunk/xsltwrapp.pc.in 2009-04-17 13:07:32 UTC (rev 139)
@@ -6,7 +6,6 @@
Name: xsltwrapp
Version: @VERSION@
Description: A C++ wrapper around libxslt
-Requires: xmlwrapp = @VERSION@
+Requires: xmlwrapp = @VERSION@, libexslt, libxslt
Libs: -L${libdir} -lxsltwrapp
-Libs.private: @LIBEXSLT_LIBS@ @LIBXSLT_LIBS@
Cflags: -I${includedir}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-22 12:45:21
|
Revision: 138
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=138&view=rev
Author: vaclavslavik
Date: 2009-02-22 12:45:16 +0000 (Sun, 22 Feb 2009)
Log Message:
-----------
fixed 'make dist' to work when building from another directory than srcdir
Modified Paths:
--------------
trunk/Makefile.am
trunk/docs/Makefile.am
trunk/tests/attributes/Makefile.am
trunk/tests/document/Makefile.am
trunk/tests/event/Makefile.am
trunk/tests/node/Makefile.am
trunk/tests/xslt/Makefile.am
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -12,4 +12,4 @@
bin_SCRIPTS = xmlwrapp-config
EXTRA_DIST = LICENSE bootstrap \
- platform/Win32/*.dsp platform/Win32/*.dsw
+ $(srcdir)/platform/Win32/*.dsp $(srcdir)/platform/Win32/*.dsw
Modified: trunk/docs/Makefile.am
===================================================================
--- trunk/docs/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/docs/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -1,7 +1,7 @@
html_DATA = $(srcdir)/html/*.*
-EXTRA_DIST = Doxyfile manual/*.doxygen
+EXTRA_DIST = Doxyfile $(srcdir)/manual/*.doxygen
dist-hook:
cd $(distdir) && doxygen
Modified: trunk/tests/attributes/Makefile.am
===================================================================
--- trunk/tests/attributes/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/tests/attributes/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -27,4 +27,4 @@
test_attr_09_SOURCES = test_attr-09.cxx
test_attr_10_SOURCES = test_attr-10.cxx
-EXTRA_DIST = data/*.out data/*.xml data/*.dtd runtest.pl
+EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml $(srcdir)/data/*.dtd runtest.pl
Modified: trunk/tests/document/Makefile.am
===================================================================
--- trunk/tests/document/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/tests/document/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -51,4 +51,4 @@
test_document_21_SOURCES = test_document-21.cxx
test_document_22_SOURCES = test_document-22.cxx
-EXTRA_DIST = data/*.out data/*.xml runtest.pl
+EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl
Modified: trunk/tests/event/Makefile.am
===================================================================
--- trunk/tests/event/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/tests/event/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -13,4 +13,4 @@
test_event_02_SOURCES = test_event-02.cxx
test_event_03_SOURCES = test_event-03.cxx
-EXTRA_DIST = data/*.out data/*.xml runtest.pl
+EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl
Modified: trunk/tests/node/Makefile.am
===================================================================
--- trunk/tests/node/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/tests/node/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -59,4 +59,4 @@
test_node_13_SOURCES = test_node-13.cxx
test_node_14_SOURCES = test_node-14.cxx
-EXTRA_DIST = data/*.out data/*.xml runtest.pl
+EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl
Modified: trunk/tests/xslt/Makefile.am
===================================================================
--- trunk/tests/xslt/Makefile.am 2009-02-22 10:51:28 UTC (rev 137)
+++ trunk/tests/xslt/Makefile.am 2009-02-22 12:45:16 UTC (rev 138)
@@ -21,4 +21,4 @@
endif
-EXTRA_DIST = data/*.xml data/*.xsl data/*.out runtest.pl
+EXTRA_DIST = $(srcdir)/data/*.xml $(srcdir)/data/*.xsl $(srcdir)/data/*.out runtest.pl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-22 10:51:31
|
Revision: 137
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=137&view=rev
Author: vaclavslavik
Date: 2009-02-22 10:51:28 +0000 (Sun, 22 Feb 2009)
Log Message:
-----------
added --disable-assert configure flag
Modified Paths:
--------------
trunk/configure.ac
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-02-21 16:22:40 UTC (rev 136)
+++ trunk/configure.ac 2009-02-22 10:51:28 UTC (rev 137)
@@ -35,7 +35,7 @@
AC_REVISION($Id$)dnl
-AC_PREREQ(2.60)
+AC_PREREQ(2.62)
AC_INIT(xmlwrapp, 0.6.0, [xml...@li...])
AC_CONFIG_SRCDIR([xmlwrapp.pc.in])
@@ -84,9 +84,8 @@
fi
-AC_LANG_PUSH([C++])
+AC_HEADER_ASSERT
AC_CHECK_HEADERS([boost/pool/singleton_pool.hpp])
-AC_LANG_POP([C++])
dnl === Compiler-specific stuff ===
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-21 16:22:45
|
Revision: 136
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=136&view=rev
Author: vaclavslavik
Date: 2009-02-21 16:22:40 +0000 (Sat, 21 Feb 2009)
Log Message:
-----------
reverted set_namespace() addition -- correct namespaces handling is more work than that
Modified Paths:
--------------
trunk/NEWS
trunk/include/xmlwrapp/node.h
trunk/src/libxml/node.cxx
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-02-06 23:57:41 UTC (rev 135)
+++ trunk/NEWS 2009-02-21 16:22:40 UTC (rev 136)
@@ -25,7 +25,7 @@
PDF version of the manual is no longer provided, use HTML documentation
included with xmlwrapp source distribution.
- Added xml::node::get_namespace() and set_namespace() functions.
+ Added xml::node::get_namespace() function.
Added new constructor to the xml::node class for creating text nodes,
using xml::node::text helper struct.
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2009-02-06 23:57:41 UTC (rev 135)
+++ trunk/include/xmlwrapp/node.h 2009-02-21 16:22:40 UTC (rev 136)
@@ -377,17 +377,6 @@
//####################################################################
/**
- * Sets the namespace of this xml::node.
- *
- * @param href URI of the namespace to associate with the node.
- * @author Vaclav Slavik
- * @since 0.6.0
- **/
- //####################################################################
- void set_namespace(const char *href);
-
- //####################################################################
- /**
* Find out if this node is a text node or sometiming like a text node,
* CDATA for example.
*
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2009-02-06 23:57:41 UTC (rev 135)
+++ trunk/src/libxml/node.cxx 2009-02-21 16:22:40 UTC (rev 136)
@@ -400,10 +400,6 @@
: NULL;
}
//####################################################################
-void xml::node::set_namespace (const char *href) {
- xmlNewNs(pimpl_->xmlnode_, reinterpret_cast<const xmlChar*>(href), 0);
-}
-//####################################################################
bool xml::node::is_text (void) const {
return xmlNodeIsText(pimpl_->xmlnode_) != 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-06 23:57:44
|
Revision: 135
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=135&view=rev
Author: vaclavslavik
Date: 2009-02-06 23:57:41 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
VC++ compilation fix
Modified Paths:
--------------
trunk/src/libxml/node_iterator.cxx
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2009-02-06 23:56:58 UTC (rev 134)
+++ trunk/src/libxml/node_iterator.cxx 2009-02-06 23:57:41 UTC (rev 135)
@@ -45,6 +45,7 @@
// standard includes
#include <algorithm>
+#include <cassert>
// libxml includes
#include <libxml/tree.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-06 23:57:03
|
Revision: 134
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=134&view=rev
Author: vaclavslavik
Date: 2009-02-06 23:56:58 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
fixed VC++ warning about inconsistency in the use of struct/class in nipimpl forward declarations
Modified Paths:
--------------
trunk/include/xmlwrapp/nodes_view.h
Modified: trunk/include/xmlwrapp/nodes_view.h
===================================================================
--- trunk/include/xmlwrapp/nodes_view.h 2009-02-06 23:22:51 UTC (rev 133)
+++ trunk/include/xmlwrapp/nodes_view.h 2009-02-06 23:56:58 UTC (rev 134)
@@ -52,7 +52,7 @@
namespace impl
{
-class nipimpl;
+struct nipimpl;
class iter_advance_functor;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-06 23:22:55
|
Revision: 133
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=133&view=rev
Author: vaclavslavik
Date: 2009-02-06 23:22:51 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
compilation fix
Modified Paths:
--------------
trunk/include/xmlwrapp/nodes_view.h
Modified: trunk/include/xmlwrapp/nodes_view.h
===================================================================
--- trunk/include/xmlwrapp/nodes_view.h 2009-02-06 22:54:50 UTC (rev 132)
+++ trunk/include/xmlwrapp/nodes_view.h 2009-02-06 23:22:51 UTC (rev 133)
@@ -79,6 +79,8 @@
nodes_view& operator=(const nodes_view& other);
+ class const_iterator;
+
/**
* The iterator provides a way to access nodes in the view
* similar to a standard C++ container.
@@ -122,6 +124,7 @@
impl::iter_advance_functor *advance_func_;
friend class nodes_view;
+ friend class const_iterator;
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-06 22:54:56
|
Revision: 132
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=132&view=rev
Author: vaclavslavik
Date: 2009-02-06 22:54:50 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
pass iterator arguments to various xml::node methods by reference instead of by value, iterators are not as cheap to copy as we'd want them
Modified Paths:
--------------
trunk/include/xmlwrapp/node.h
trunk/src/libxml/node.cxx
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2009-02-06 22:42:15 UTC (rev 131)
+++ trunk/include/xmlwrapp/node.h 2009-02-06 22:54:50 UTC (rev 132)
@@ -674,7 +674,7 @@
* @see elements(const char*)
**/
//####################################################################
- iterator find (const char *name, iterator start);
+ iterator find (const char *name, const iterator& start);
//####################################################################
/**
@@ -696,7 +696,7 @@
* @see elements(const char*) const
**/
//####################################################################
- const_iterator find (const char *name, const_iterator start) const;
+ const_iterator find (const char *name, const const_iterator& start) const;
/**
* Returns view of child nodes of type type_element. If no such node
@@ -808,7 +808,7 @@
* @author Peter Jones
**/
//####################################################################
- iterator insert (iterator position, const node &n);
+ iterator insert (const iterator& position, const node &n);
//####################################################################
/**
@@ -824,7 +824,7 @@
* @author Peter Jones
**/
//####################################################################
- iterator replace (iterator old_node, const node &new_node);
+ iterator replace (const iterator& old_node, const node &new_node);
//####################################################################
/**
@@ -839,7 +839,7 @@
* @author Gary A. Passero
**/
//####################################################################
- iterator erase (iterator to_erase);
+ iterator erase (const iterator& to_erase);
//####################################################################
/**
@@ -853,7 +853,7 @@
* @author Peter Jones
**/
//####################################################################
- iterator erase (iterator first, iterator last);
+ iterator erase (iterator first, const iterator& last);
//####################################################################
/**
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2009-02-06 22:42:15 UTC (rev 131)
+++ trunk/src/libxml/node.cxx 2009-02-06 22:54:50 UTC (rev 132)
@@ -458,13 +458,13 @@
return end();
}
//####################################################################
-xml::node::iterator xml::node::find (const char *name, iterator start) {
+xml::node::iterator xml::node::find (const char *name, const iterator& start) {
xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node());
if ( (n = find_element(name, n))) return iterator(n);
return end();
}
//####################################################################
-xml::node::const_iterator xml::node::find (const char *name, const_iterator start) const {
+xml::node::const_iterator xml::node::find (const char *name, const const_iterator& start) const {
xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node());
if ( (n = find_element(name, n))) return const_iterator(n);
return end();
@@ -511,19 +511,19 @@
return iterator(xml::impl::node_insert(pimpl_->xmlnode_, 0, n.pimpl_->xmlnode_));
}
//####################################################################
-xml::node::iterator xml::node::insert (iterator position, const node &n) {
+xml::node::iterator xml::node::insert (const iterator& position, const node &n) {
return iterator(xml::impl::node_insert(pimpl_->xmlnode_, static_cast<xmlNodePtr>(position.get_raw_node()), n.pimpl_->xmlnode_));
}
//####################################################################
-xml::node::iterator xml::node::replace (iterator old_node, const node &new_node) {
+xml::node::iterator xml::node::replace (const iterator& old_node, const node &new_node) {
return iterator(xml::impl::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), new_node.pimpl_->xmlnode_));
}
//####################################################################
-xml::node::iterator xml::node::erase (iterator to_erase) {
+xml::node::iterator xml::node::erase (const iterator& to_erase) {
return iterator(xml::impl::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node())));
}
//####################################################################
-xml::node::iterator xml::node::erase (iterator first, iterator last) {
+xml::node::iterator xml::node::erase (iterator first, const iterator& last) {
while (first != last) first = erase(first);
return first;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-02-06 22:42:27
|
Revision: 131
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=131&view=rev
Author: vaclavslavik
Date: 2009-02-06 22:42:15 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
improved performance of invalid iterators: don't allocate pimpl for them
Modified Paths:
--------------
trunk/include/xmlwrapp/node.h
trunk/include/xmlwrapp/nodes_view.h
trunk/src/libxml/node.cxx
trunk/src/libxml/node_iterator.cxx
trunk/src/libxml/node_iterator.h
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2009-01-26 17:00:08 UTC (rev 130)
+++ trunk/include/xmlwrapp/node.h 2009-02-06 22:42:15 UTC (rev 131)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * 2009 Vaclav Slavik <vs...@fa...>
* All Rights Reserved
*
* Redistribution and use in source and binary forms, with or without
@@ -431,7 +432,7 @@
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
- iterator (void);
+ iterator (void) : pimpl_(0) {}
iterator (const iterator &other);
iterator& operator= (const iterator& other);
~iterator (void);
@@ -445,12 +446,15 @@
/// postfix increment (avoid if possible for better performance)
iterator operator++ (int);
- friend bool operator== (const iterator &lhs, const iterator &rhs);
- friend bool operator!= (const iterator &lhs, const iterator &rhs);
+ bool operator==(const iterator& other) const
+ { return get_raw_node() == other.get_raw_node(); }
+ bool operator!=(const iterator& other) const
+ { return !(*this == other); }
+
private:
impl::nipimpl *pimpl_;
explicit iterator (void *data);
- void* get_raw_node (void);
+ void* get_raw_node (void) const;
void swap (iterator &other);
friend class node;
friend class document;
@@ -470,7 +474,7 @@
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
- const_iterator (void);
+ const_iterator (void) : pimpl_(0) {}
const_iterator (const const_iterator &other);
const_iterator (const iterator &other);
const_iterator& operator= (const const_iterator& other);
@@ -485,12 +489,14 @@
/// postfix increment (avoid if possible for better performance)
const_iterator operator++ (int);
- friend bool operator== (const const_iterator &lhs, const const_iterator &rhs);
- friend bool operator!= (const const_iterator &lhs, const const_iterator &rhs);
+ bool operator==(const const_iterator& other) const
+ { return get_raw_node() == other.get_raw_node(); }
+ bool operator!=(const const_iterator& other) const
+ { return !(*this == other); }
private:
impl::nipimpl *pimpl_;
explicit const_iterator (void *data);
- void* get_raw_node (void);
+ void* get_raw_node (void) const;
void swap (const_iterator &other);
friend class document;
friend class node;
Modified: trunk/include/xmlwrapp/nodes_view.h
===================================================================
--- trunk/include/xmlwrapp/nodes_view.h 2009-01-26 17:00:08 UTC (rev 130)
+++ trunk/include/xmlwrapp/nodes_view.h 2009-02-06 22:42:15 UTC (rev 131)
@@ -94,7 +94,7 @@
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
- iterator();
+ iterator() : pimpl_(0), advance_func_(0) {}
iterator(const iterator& other);
iterator& operator=(const iterator& other);
~iterator();
@@ -105,11 +105,14 @@
iterator& operator++();
iterator operator++(int);
- bool operator==(const iterator& other) const;
- bool operator!=(const iterator& other) const { return !(*this == other); }
+ bool operator==(const iterator& other) const
+ { return get_raw_node() == other.get_raw_node(); }
+ bool operator!=(const iterator& other) const
+ { return !(*this == other); }
private:
explicit iterator(void *data, impl::iter_advance_functor *advance_func);
+ void* get_raw_node() const;
void swap(iterator& other);
impl::nipimpl *pimpl_;
@@ -137,7 +140,7 @@
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
- const_iterator();
+ const_iterator() : pimpl_(0), advance_func_(0) {}
const_iterator(const const_iterator& other);
const_iterator(const iterator& other);
const_iterator& operator=(const const_iterator& other);
@@ -150,11 +153,14 @@
const_iterator& operator++();
const_iterator operator++(int);
- bool operator==(const const_iterator& other) const;
- bool operator!=(const const_iterator& other) const { return !(*this == other); }
+ bool operator==(const const_iterator& other) const
+ { return get_raw_node() == other.get_raw_node(); }
+ bool operator!=(const const_iterator& other) const
+ { return !(*this == other); }
private:
explicit const_iterator(void *data, impl::iter_advance_functor *advance_func);
+ void* get_raw_node() const;
void swap(const_iterator& other);
impl::nipimpl *pimpl_;
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2009-01-26 17:00:08 UTC (rev 130)
+++ trunk/src/libxml/node.cxx 2009-02-06 22:42:15 UTC (rev 131)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * 2009 Vaclav Slavik <vs...@fa...>
* All Rights Reserved
*
* Redistribution and use in source and binary forms, with or without
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2009-01-26 17:00:08 UTC (rev 130)
+++ trunk/src/libxml/node_iterator.cxx 2009-02-06 22:42:15 UTC (rev 131)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * 2009 Vaclav Slavik <vs...@fa...>
* All Rights Reserved
*
* Redistribution and use in source and binary forms, with or without
@@ -76,16 +77,12 @@
*/
//####################################################################
-xml::node::iterator::iterator (void) {
- pimpl_ = new nipimpl;
-}
-//####################################################################
xml::node::iterator::iterator (void *data) {
pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data));
}
//####################################################################
xml::node::iterator::iterator (const iterator &other) {
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
}
//####################################################################
xml::node::iterator& xml::node::iterator::operator= (const iterator &other) {
@@ -121,8 +118,8 @@
return tmp;
}
//####################################################################
-void* xml::node::iterator::get_raw_node (void) {
- return pimpl_->it.get_raw_node();
+void* xml::node::iterator::get_raw_node (void) const {
+ return pimpl_ ? pimpl_->it.get_raw_node() : 0;
}
//####################################################################
@@ -131,20 +128,16 @@
*/
//####################################################################
-xml::node::const_iterator::const_iterator (void) {
- pimpl_ = new nipimpl;
-}
-//####################################################################
xml::node::const_iterator::const_iterator (void *data) {
pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data));
}
//####################################################################
xml::node::const_iterator::const_iterator (const const_iterator &other) {
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
}
//####################################################################
xml::node::const_iterator::const_iterator (const iterator &other) {
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
}
//####################################################################
xml::node::const_iterator& xml::node::const_iterator::operator= (const const_iterator &other) {
@@ -180,41 +173,12 @@
return tmp;
}
//####################################################################
-void* xml::node::const_iterator::get_raw_node (void) {
- return pimpl_->it.get_raw_node();
+void* xml::node::const_iterator::get_raw_node (void) const {
+ return pimpl_ ? pimpl_->it.get_raw_node() : 0;
}
//####################################################################
-namespace xml {
-namespace impl {
- bool operator== (const node_iterator &lhs, const node_iterator &rhs) {
- return lhs.node_ == rhs.node_;
- }
- bool operator!= (const node_iterator &lhs, const node_iterator &rhs) {
- return !(lhs == rhs);
- }
-}
-
- bool operator== (const node::iterator &lhs, const node::iterator &rhs) {
- return lhs.pimpl_->it == rhs.pimpl_->it;
- }
-
- bool operator!= (const node::iterator &lhs, const node::iterator &rhs) {
- return !(lhs == rhs);
- }
-
- bool operator== (const node::const_iterator &lhs, const node::const_iterator &rhs) {
- return lhs.pimpl_->it == rhs.pimpl_->it;
- }
-
- bool operator!= (const node::const_iterator &lhs, const node::const_iterator &rhs) {
- return !(lhs == rhs);
- }
-}
-//####################################################################
-
-
namespace xml
{
@@ -222,15 +186,9 @@
// xml::nodes_view::iterator
// ------------------------------------------------------------------------
-nodes_view::iterator::iterator()
-{
- pimpl_ = new nipimpl;
- advance_func_ = 0;
-}
-
nodes_view::iterator::iterator(const iterator& other)
{
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
advance_func_ = other.advance_func_;
}
@@ -273,9 +231,9 @@
return tmp;
}
-bool nodes_view::iterator::operator==(const iterator& other) const
+void* nodes_view::iterator::get_raw_node() const
{
- return pimpl_->it == other.pimpl_->it;
+ return pimpl_ ? pimpl_->it.get_raw_node() : 0;
}
nodes_view::iterator::iterator(void *data, impl::iter_advance_functor *advance_func)
@@ -295,21 +253,15 @@
// xml::nodes_view::const_iterator
// ------------------------------------------------------------------------
-nodes_view::const_iterator::const_iterator()
-{
- pimpl_ = new nipimpl;
- advance_func_ = 0;
-}
-
nodes_view::const_iterator::const_iterator(const const_iterator& other)
{
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
advance_func_ = other.advance_func_;
}
nodes_view::const_iterator::const_iterator(const iterator& other)
{
- pimpl_ = new nipimpl(*(other.pimpl_));
+ pimpl_ = other.pimpl_ ? new nipimpl(*(other.pimpl_)) : 0;
advance_func_ = other.advance_func_;
}
@@ -360,9 +312,9 @@
return tmp;
}
-bool nodes_view::const_iterator::operator==(const const_iterator& other) const
+void* nodes_view::const_iterator::get_raw_node() const
{
- return pimpl_->it == other.pimpl_->it;
+ return pimpl_ ? pimpl_->it.get_raw_node() : 0;
}
nodes_view::const_iterator::const_iterator(void *data, impl::iter_advance_functor *advance_func)
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2009-01-26 17:00:08 UTC (rev 130)
+++ trunk/src/libxml/node_iterator.h 2009-02-06 22:42:15 UTC (rev 131)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * 2009 Vaclav Slavik <vs...@fa...>
* All Rights Reserved
*
* Redistribution and use in source and binary forms, with or without
@@ -94,9 +95,7 @@
void advance() { node_ = node_->next; }
void advance(iter_advance_functor& next) { node_ = next(node_); }
- friend bool operator== (const node_iterator &lhs, const node_iterator &rhs);
-
private:
mutable node fake_node_;
xmlNodePtr node_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-01-26 17:00:21
|
Revision: 130
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=130&view=rev
Author: vaclavslavik
Date: 2009-01-26 17:00:08 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
added xml::node::elements() methods for efficient iteration over child elements
Modified Paths:
--------------
trunk/NEWS
trunk/docs/manual/node.doxygen
trunk/include/Makefile.am
trunk/include/xmlwrapp/node.h
trunk/include/xmlwrapp/xmlwrapp.h
trunk/platform/Win32/xmlwrapp.dsp
trunk/src/Makefile.am
trunk/src/libxml/node.cxx
trunk/src/libxml/node_iterator.cxx
trunk/src/libxml/node_iterator.h
trunk/tests/node/Makefile.am
trunk/tests/node/data/02.xml
trunk/tests/node/runtest.pl
Added Paths:
-----------
trunk/include/xmlwrapp/nodes_view.h
trunk/src/libxml/nodes_view.cxx
trunk/tests/node/data/02e.out
trunk/tests/node/data/02f.out
trunk/tests/node/data/02g.out
trunk/tests/node/data/02h.out
trunk/tests/node/test_node-02e.cxx
trunk/tests/node/test_node-02f.cxx
trunk/tests/node/test_node-02g.cxx
trunk/tests/node/test_node-02h.cxx
Property Changed:
----------------
trunk/tests/node/
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/NEWS 2009-01-26 17:00:08 UTC (rev 130)
@@ -32,6 +32,9 @@
Improved iterators performance (only if Boost.Pool is available).
+ Added xml::node::elements() methods for efficient iteration over child
+ elements. In most cases, this is a better alternative to find().
+
Version 0.5.1
Various compilation fixes.
Modified: trunk/docs/manual/node.doxygen
===================================================================
--- trunk/docs/manual/node.doxygen 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/docs/manual/node.doxygen 2009-01-26 17:00:08 UTC (rev 130)
@@ -179,7 +179,42 @@
}
@endcode
+@subsection node_children_elements Iterating Over Children Elements
+If you need to do something with all child element nodes, you can use
+xml::node::elements() method to obtain a @em view of child nodes. The view,
+implemented by xml::nodes_view and xml::const_nodes_view classes, behaves like
+a standard container in that it lets you iterate over the nodes in the usual
+way. The difference between the iterator returned by xml::nodes_view::begin()
+and the one from xml::node::begin() is that the latter iterates over all child
+nodes, whereas the former iterates only over selected elements.
+
+The usage is similar to iterating over all child nodes:
+
+@code
+xml::node n;
+...
+xml::nodes_view all(n.elements());
+for (xml::nodes_view::iterator i = all.begin()); i != all.end(); ++i)
+{
+ do_something_with_child(*i);
+}
+@endcode
+
+Similarly, you can iterate over all child elements with given name using
+the xml::node::elements(const char*) method:
+
+@code
+xml::node n;
+...
+xml::nodes_view persons(n.elements("person"));
+for (xml::nodes_view::iterator i = all.begin()); i != all.end(); ++i)
+{
+ do_something_with_person_child(*i);
+}
+@endcode
+
+
@section node_add Adding Children
There are two ways of adding a child to a
Modified: trunk/include/Makefile.am
===================================================================
--- trunk/include/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/include/Makefile.am 2009-01-26 17:00:08 UTC (rev 130)
@@ -7,6 +7,7 @@
xmlwrapp/event_parser.h \
xmlwrapp/init.h \
xmlwrapp/node.h \
+ xmlwrapp/nodes_view.h \
xmlwrapp/tree_parser.h \
xmlwrapp/xmlwrapp.h
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/include/xmlwrapp/node.h 2009-01-26 17:00:08 UTC (rev 130)
@@ -53,16 +53,18 @@
// forward declarations
class document;
class attributes;
+class nodes_view;
+class const_nodes_view;
namespace impl {
class node_iterator;
+class iter_advance_functor;
struct node_impl;
struct doc_impl;
struct nipimpl;
struct node_cmp;
}
-
/**
* The xml::node class is used to hold information about one XML node. This
* includes the name of the node, the namespace of the node and attributes
@@ -620,6 +622,8 @@
* @return An iterator that points to the node if found.
* @return An end() iterator if the node was not found.
* @author Peter Jones
+ *
+ * @see elements(const char*), find(const char*, iterator)
**/
//####################################################################
iterator find (const char *name);
@@ -638,6 +642,8 @@
* @return A const_iterator that points to the node if found.
* @return An end() const_iterator if the node was not found.
* @author Peter Jones
+ *
+ * @see elements(const char*) const, find(const char*, const_iterator) const
**/
//####################################################################
const_iterator find (const char *name) const;
@@ -658,6 +664,8 @@
* @return An iterator that points to the node if found.
* @return An end() iterator if the node was not found.
* @author Peter Jones
+ *
+ * @see elements(const char*)
**/
//####################################################################
iterator find (const char *name, iterator start);
@@ -670,7 +678,7 @@
*
* This function should be given a const_iterator to one of this node's
* children. The search will begin with that node and continue with all
- * its sibliings. This function will not recurse down the tree, it only
+ * its siblings. This function will not recurse down the tree, it only
* searches in one level.
*
* @param name The name of the node you want to find.
@@ -678,10 +686,98 @@
* @return A const_iterator that points to the node if found.
* @return An end() const_iterator if the node was not found.
* @author Peter Jones
+ *
+ * @see elements(const char*) const
**/
//####################################################################
const_iterator find (const char *name, const_iterator start) const;
+ /**
+ * Returns view of child nodes of type type_element. If no such node
+ * can be found, returns empty view.
+ *
+ * Example:
+ * @code
+ * xml::nodes_view view(root.elements());
+ * for (xml::nodes_view::iterator i = view.begin(); i != view.end(); ++i)
+ * {
+ * ...
+ * }
+ * @endcode
+ *
+ * @return View with all child elements or empty view if there aren't any.
+ * @author Vaclav Slavik
+ * @since 0.6.0
+ *
+ * @see nodes_view
+ **/
+ nodes_view elements();
+
+ /**
+ * Returns view of child nodes of type type_element. If no such node
+ * can be found, returns empty view.
+ *
+ * Example:
+ * @code
+ * xml::const_nodes_view view(root.elements());
+ * for (xml::const_nodes_view::const_iterator i = view.begin();
+ * i != view.end();
+ * ++i)
+ * {
+ * ...
+ * }
+ * @endcode
+ *
+ * @return View with all child elements or empty view if there aren't any.
+ * @author Vaclav Slavik
+ * @since 0.6.0
+ *
+ * @see const_nodes_view
+ **/
+ const_nodes_view elements() const;
+
+ /**
+ * Returns view of child nodes of type type_element with name @a name.
+ * If no such node can be found, returns empty view.
+ *
+ * Example:
+ * @code
+ * xml::nodes_view persons(root.elements("person"));
+ * for (xml::nodes_view::iterator i = view.begin(); i != view.end(); ++i)
+ * {
+ * ...
+ * }
+ * @endcode
+ *
+ * @param name Name of the elements to return.
+ * @return View that contains only elements @a name.
+ * @author Vaclav Slavik
+ * @since 0.6.0
+ **/
+ nodes_view elements(const char *name);
+
+ /**
+ * Returns view of child nodes of type type_element with name @a name.
+ * If no such node can be found, returns empty view.
+ *
+ * Example:
+ * @code
+ * xml::const_nodes_view persons(root.elements("person"));
+ * for (xml::const_nodes_view::const_iterator i = view.begin();
+ * i != view.end();
+ * ++i)
+ * {
+ * ...
+ * }
+ * @endcode
+ *
+ * @param name Name of the elements to return.
+ * @return View that contains only elements @a name.
+ * @author Vaclav Slavik
+ * @since 0.6.0
+ **/
+ const_nodes_view elements(const char *name) const;
+
//####################################################################
/**
* Insert a new child node. The new node will be inserted at the end of
Added: trunk/include/xmlwrapp/nodes_view.h
===================================================================
--- trunk/include/xmlwrapp/nodes_view.h (rev 0)
+++ trunk/include/xmlwrapp/nodes_view.h 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,274 @@
+/*
+ * Copyright (C) 2009 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/** @file
+ * This file contains the definition of the xml::nodes_view and
+ * xml::const_nodes_view classes.
+**/
+
+#ifndef _xmlwrapp_nodes_view_h_
+#define _xmlwrapp_nodes_view_h_
+
+// xmlwrapp includes
+#include "xmlwrapp/init.h"
+
+// standard includes
+#include <iterator>
+
+namespace xml
+{
+
+class node;
+class const_nodes_view;
+
+namespace impl
+{
+class nipimpl;
+class iter_advance_functor;
+}
+
+/**
+ * This class implements a view of XML nodes. A @em view is a container-like
+ * class that only allows access to a subset of xml::node's child nodes. The
+ * exact content depends on how the view was obtained; typical uses are
+ * e.g. a view of all element children or all elements with a given name.
+ *
+ * The nodes_view class implements the same container interface that xml::node
+ * does: it has begin() and end() methods.
+ *
+ * @author Vaclav Slavik
+ * @since 0.6.0
+ *
+ * @see xml::node::elements(), xml::node::elements(const char*)
+**/
+class nodes_view
+{
+public:
+ nodes_view() : data_begin_(0), advance_func_(0) {}
+ nodes_view(const nodes_view& other);
+ ~nodes_view();
+
+ nodes_view& operator=(const nodes_view& other);
+
+ /**
+ * The iterator provides a way to access nodes in the view
+ * similar to a standard C++ container.
+ *
+ * @see xml::node::iterator
+ **/
+ class iterator
+ {
+ public:
+ typedef node value_type;
+ typedef int difference_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ iterator();
+ iterator(const iterator& other);
+ iterator& operator=(const iterator& other);
+ ~iterator();
+
+ reference operator*() const;
+ pointer operator->() const;
+
+ iterator& operator++();
+ iterator operator++(int);
+
+ bool operator==(const iterator& other) const;
+ bool operator!=(const iterator& other) const { return !(*this == other); }
+
+ private:
+ explicit iterator(void *data, impl::iter_advance_functor *advance_func);
+ void swap(iterator& other);
+
+ impl::nipimpl *pimpl_;
+ // function for advancing the iterator (note that it is "owned" by the
+ // parent view object, so we don't have to care about its reference
+ // count here)
+ impl::iter_advance_functor *advance_func_;
+
+ friend class nodes_view;
+ };
+
+ /**
+ * The const_iterator provides a way to access nodes in the view
+ * similar to a standard C++ container. The nodes that are pointed to by
+ * the iterator cannot be changed.
+ *
+ * @see xml::node::const_iterator
+ **/
+ class const_iterator
+ {
+ public:
+ typedef const node value_type;
+ typedef int difference_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+ typedef std::forward_iterator_tag iterator_category;
+
+ const_iterator();
+ const_iterator(const const_iterator& other);
+ const_iterator(const iterator& other);
+ const_iterator& operator=(const const_iterator& other);
+ const_iterator& operator=(const iterator& other);
+ ~const_iterator();
+
+ reference operator*() const;
+ pointer operator->() const;
+
+ const_iterator& operator++();
+ const_iterator operator++(int);
+
+ bool operator==(const const_iterator& other) const;
+ bool operator!=(const const_iterator& other) const { return !(*this == other); }
+
+ private:
+ explicit const_iterator(void *data, impl::iter_advance_functor *advance_func);
+ void swap(const_iterator& other);
+
+ impl::nipimpl *pimpl_;
+ // function for advancing the iterator (note that it is "owned" by the
+ // parent view object, so we don't have to care about its reference
+ // count here)
+ impl::iter_advance_functor *advance_func_;
+
+ friend class const_nodes_view;
+ friend class nodes_view;
+ };
+
+ /**
+ * Get an iterator that points to the beginning of this node's
+ * children.
+ *
+ * @return An iterator that points to the beginning of the children.
+ **/
+ iterator begin() { return iterator(data_begin_, advance_func_); }
+
+ /**
+ * Get an iterator that points to the beginning of this node's
+ * children.
+ *
+ * @return An iterator that points to the beginning of the children.
+ **/
+ const_iterator begin() const { return const_iterator(data_begin_, advance_func_); }
+
+ /**
+ * Get an iterator that points one past the last child for this node.
+ *
+ * @return A "one past the end" iterator.
+ **/
+ iterator end() { return iterator(); }
+
+ /**
+ * Get an iterator that points one past the last child for this node.
+ *
+ * @return A "one past the end" iterator.
+ **/
+ const_iterator end() const { return const_iterator(); }
+
+ /// Is the view empty?
+ bool empty() const { return !data_begin_; }
+
+private:
+ explicit nodes_view(void *data_begin, impl::iter_advance_functor *advance_func)
+ : data_begin_(data_begin), advance_func_(advance_func) {}
+
+ // begin iterator
+ void *data_begin_;
+ // function for advancing the iterator (owned by the view object)
+ impl::iter_advance_functor *advance_func_;
+
+ friend class node;
+ friend class const_nodes_view;
+};
+
+
+/**
+ * This class implements a @em read-only view of XML nodes. The only difference
+ * from xml::nodes_view is that it doesn't allow modifications of the nodes,
+ * it is otherwise identical.
+ *
+ * @see nodes_view
+ *
+ * @author Vaclav Slavik
+ * @since 0.6.0
+**/
+class const_nodes_view
+{
+public:
+ const_nodes_view() : data_begin_(0), advance_func_(0) {}
+ const_nodes_view(const const_nodes_view& other);
+ const_nodes_view(const nodes_view& other);
+ ~const_nodes_view();
+
+ const_nodes_view& operator=(const const_nodes_view& other);
+ const_nodes_view& operator=(const nodes_view& other);
+
+ typedef nodes_view::const_iterator iterator;
+ typedef nodes_view::const_iterator const_iterator;
+
+ /**
+ * Get an iterator that points to the beginning of this node's
+ * children.
+ *
+ * @return An iterator that points to the beginning of the children.
+ **/
+ const_iterator begin() const
+ { return const_iterator(data_begin_, advance_func_); }
+
+ /**
+ * Get an iterator that points one past the last child for this node.
+ *
+ * @return A "one past the end" iterator.
+ **/
+ const_iterator end() const { return const_iterator(); }
+
+ /// Is the view empty?
+ bool empty() const { return !data_begin_; }
+
+private:
+ explicit const_nodes_view(void *data_begin, impl::iter_advance_functor *advance_func)
+ : data_begin_(data_begin), advance_func_(advance_func) {}
+
+ // begin iterator
+ void *data_begin_;
+ // function for advancing the iterator (owned by the view object)
+ impl::iter_advance_functor *advance_func_;
+
+ friend class node;
+};
+
+} // end xml namespace
+
+#endif // _xmlwrapp_nodes_view_h_
Property changes on: trunk/include/xmlwrapp/nodes_view.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/include/xmlwrapp/xmlwrapp.h
===================================================================
--- trunk/include/xmlwrapp/xmlwrapp.h 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/include/xmlwrapp/xmlwrapp.h 2009-01-26 17:00:08 UTC (rev 130)
@@ -34,6 +34,7 @@
#define _xmlwrapp_xmlwrapp_h_
#include "xmlwrapp/init.h"
+#include "xmlwrapp/nodes_view.h"
#include "xmlwrapp/node.h"
#include "xmlwrapp/attributes.h"
#include "xmlwrapp/document.h"
Modified: trunk/platform/Win32/xmlwrapp.dsp
===================================================================
--- trunk/platform/Win32/xmlwrapp.dsp 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/platform/Win32/xmlwrapp.dsp 2009-01-26 17:00:08 UTC (rev 130)
@@ -113,6 +113,10 @@
# End Source File
# Begin Source File
+SOURCE=..\..\src\libxml\nodes_view.cxx
+# End Source File
+# Begin Source File
+
SOURCE=..\..\src\libxml\node_iterator.cxx
# End Source File
# Begin Source File
@@ -153,6 +157,10 @@
# End Source File
# Begin Source File
+SOURCE=..\..\include\xmlwrapp\nodes_view.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\xmlwrapp\tree_parser.h
# End Source File
# Begin Source File
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/src/Makefile.am 2009-01-26 17:00:08 UTC (rev 130)
@@ -21,6 +21,7 @@
libxml/event_parser.cxx \
libxml/init.cxx \
libxml/node.cxx \
+ libxml/nodes_view.cxx \
libxml/node_iterator.cxx \
libxml/node_iterator.h \
libxml/node_manip.cxx \
Modified: trunk/src/libxml/node.cxx
===================================================================
--- trunk/src/libxml/node.cxx 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/src/libxml/node.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -36,11 +36,13 @@
// xmlwrapp includes
#include "xmlwrapp/node.h"
+#include "xmlwrapp/nodes_view.h"
#include "xmlwrapp/attributes.h"
#include "utility.h"
#include "ait_impl.h"
#include "node_manip.h"
#include "pimpl_base.h"
+#include "node_iterator.h"
// standard includes
#include <cstring>
@@ -175,8 +177,41 @@
xmlNodePtr parent_;
};
- // a node finder
- xmlNodePtr find_node(const char *name, xmlNodePtr first);
+ // an element node finder
+ xmlNodePtr find_element(const char *name, xmlNodePtr first) {
+ while (first != 0) {
+ if (first->type == XML_ELEMENT_NODE && xmlStrcmp(first->name, reinterpret_cast<const xmlChar*>(name)) == 0) return first;
+ first = first->next;
+ }
+
+ return 0;
+ }
+
+ xmlNodePtr find_element(xmlNodePtr first) {
+ while (first != 0) {
+ if (first->type == XML_ELEMENT_NODE) return first;
+ first = first->next;
+ }
+
+ return 0;
+ }
+
+ class next_element_functor : public iter_advance_functor
+ {
+ public:
+ virtual xmlNodePtr operator()(xmlNodePtr node) const
+ { return find_element(node->next); }
+ };
+
+ class next_named_element_functor : public iter_advance_functor
+ {
+ public:
+ next_named_element_functor(const char *name) : name_(name) {}
+ virtual xmlNodePtr operator()(xmlNodePtr node) const
+ { return find_element(name_.c_str(), node->next); }
+ private:
+ std::string name_;
+ };
}
//####################################################################
xml::node::node (int) {
@@ -411,28 +446,65 @@
}
//####################################################################
xml::node::iterator xml::node::find (const char *name) {
- xmlNodePtr found = find_node(name, pimpl_->xmlnode_->children);
+ xmlNodePtr found = find_element(name, pimpl_->xmlnode_->children);
if (found) return iterator(found);
return end();
}
//####################################################################
xml::node::const_iterator xml::node::find (const char *name) const {
- xmlNodePtr found = find_node(name, pimpl_->xmlnode_->children);
+ xmlNodePtr found = find_element(name, pimpl_->xmlnode_->children);
if (found) return const_iterator(found);
return end();
}
//####################################################################
xml::node::iterator xml::node::find (const char *name, iterator start) {
xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node());
- if ( (n = find_node(name, n))) return iterator(n);
+ if ( (n = find_element(name, n))) return iterator(n);
return end();
}
//####################################################################
xml::node::const_iterator xml::node::find (const char *name, const_iterator start) const {
xmlNodePtr n = static_cast<xmlNodePtr>(start.get_raw_node());
- if ( (n = find_node(name, n))) return const_iterator(n);
+ if ( (n = find_element(name, n))) return const_iterator(n);
return end();
}
+
+xml::nodes_view xml::node::elements()
+{
+ return nodes_view
+ (
+ find_element(pimpl_->xmlnode_->children),
+ new next_element_functor
+ );
+}
+
+xml::const_nodes_view xml::node::elements() const
+{
+ return const_nodes_view
+ (
+ find_element(pimpl_->xmlnode_->children),
+ new next_element_functor
+ );
+}
+
+xml::nodes_view xml::node::elements(const char *name)
+{
+ return nodes_view
+ (
+ find_element(name, pimpl_->xmlnode_->children),
+ new next_named_element_functor(name)
+ );
+}
+
+xml::const_nodes_view xml::node::elements(const char *name) const
+{
+ return const_nodes_view
+ (
+ find_element(name, pimpl_->xmlnode_->children),
+ new next_named_element_functor(name)
+ );
+}
+
//####################################################################
xml::node::iterator xml::node::insert (const node &n) {
return iterator(xml::impl::node_insert(pimpl_->xmlnode_, 0, n.pimpl_->xmlnode_));
@@ -522,17 +594,6 @@
if (xml_string_length) xml.assign(helper.get(), xml_string_length);
}
//####################################################################
-namespace {
- xmlNodePtr find_node(const char *name, xmlNodePtr first) {
- while (first != 0) {
- if (first->type == XML_ELEMENT_NODE && xmlStrcmp(first->name, reinterpret_cast<const xmlChar*>(name)) == 0) return first;
- first = first->next;
- }
-
- return 0;
- }
-}
-//####################################################################
namespace xml {
std::ostream& operator<< (std::ostream &stream, const xml::node &n) {
std::string xmldata;
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/src/libxml/node_iterator.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -40,6 +40,7 @@
// xmlwrapp includes
#include "xmlwrapp/node.h"
+#include "xmlwrapp/nodes_view.h"
// standard includes
#include <algorithm>
@@ -69,11 +70,6 @@
return &fake_node_;
}
//####################################################################
-xml::impl::node_iterator& xml::impl::node_iterator::operator++ (void) {
- node_ = node_->next;
- return *this;
-}
-//####################################################################
/*
* xml::node::iterator wrapper iterator class.
@@ -115,7 +111,7 @@
}
//####################################################################
xml::node::iterator& xml::node::iterator::operator++ (void) {
- ++(pimpl_->it);
+ pimpl_->it.advance();
return *this;
}
//####################################################################
@@ -174,7 +170,7 @@
}
//####################################################################
xml::node::const_iterator& xml::node::const_iterator::operator++ (void) {
- ++(pimpl_->it);
+ pimpl_->it.advance();
return *this;
}
//####################################################################
@@ -217,3 +213,169 @@
}
}
//####################################################################
+
+
+namespace xml
+{
+
+// ------------------------------------------------------------------------
+// xml::nodes_view::iterator
+// ------------------------------------------------------------------------
+
+nodes_view::iterator::iterator()
+{
+ pimpl_ = new nipimpl;
+ advance_func_ = 0;
+}
+
+nodes_view::iterator::iterator(const iterator& other)
+{
+ pimpl_ = new nipimpl(*(other.pimpl_));
+ advance_func_ = other.advance_func_;
+}
+
+nodes_view::iterator&
+nodes_view::iterator::operator=(const iterator& other)
+{
+ iterator tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+nodes_view::iterator::~iterator()
+{
+ delete pimpl_;
+}
+
+nodes_view::iterator::reference
+nodes_view::iterator::operator*() const
+{
+ return *(pimpl_->it.get());
+}
+
+nodes_view::iterator::pointer
+nodes_view::iterator::operator->() const
+{
+ return pimpl_->it.get();
+}
+
+nodes_view::iterator& nodes_view::iterator::operator++()
+{
+ assert( advance_func_ );
+ pimpl_->it.advance(*advance_func_);
+ return *this;
+}
+
+nodes_view::iterator nodes_view::iterator::operator++(int)
+{
+ iterator tmp(*this);
+ ++(*this);
+ return tmp;
+}
+
+bool nodes_view::iterator::operator==(const iterator& other) const
+{
+ return pimpl_->it == other.pimpl_->it;
+}
+
+nodes_view::iterator::iterator(void *data, impl::iter_advance_functor *advance_func)
+{
+ assert( advance_func );
+ pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data));
+ advance_func_ = advance_func;
+}
+
+void nodes_view::iterator::swap(iterator& other)
+{
+ std::swap(pimpl_, other.pimpl_);
+ std::swap(advance_func_, other.advance_func_);
+}
+
+// ------------------------------------------------------------------------
+// xml::nodes_view::const_iterator
+// ------------------------------------------------------------------------
+
+nodes_view::const_iterator::const_iterator()
+{
+ pimpl_ = new nipimpl;
+ advance_func_ = 0;
+}
+
+nodes_view::const_iterator::const_iterator(const const_iterator& other)
+{
+ pimpl_ = new nipimpl(*(other.pimpl_));
+ advance_func_ = other.advance_func_;
+}
+
+nodes_view::const_iterator::const_iterator(const iterator& other)
+{
+ pimpl_ = new nipimpl(*(other.pimpl_));
+ advance_func_ = other.advance_func_;
+}
+
+nodes_view::const_iterator&
+nodes_view::const_iterator::operator=(const const_iterator& other)
+{
+ const_iterator tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+nodes_view::const_iterator&
+nodes_view::const_iterator::operator=(const iterator& other)
+{
+ const_iterator tmp(other);
+ swap(tmp);
+ return *this;
+}
+
+nodes_view::const_iterator::~const_iterator()
+{
+ delete pimpl_;
+}
+
+nodes_view::const_iterator::reference
+nodes_view::const_iterator::operator*() const
+{
+ return *(pimpl_->it.get());
+}
+
+nodes_view::const_iterator::pointer
+nodes_view::const_iterator::operator->() const
+{
+ return pimpl_->it.get();
+}
+
+nodes_view::const_iterator& nodes_view::const_iterator::operator++()
+{
+ assert( advance_func_ );
+ pimpl_->it.advance(*advance_func_);
+ return *this;
+}
+
+nodes_view::const_iterator nodes_view::const_iterator::operator++(int)
+{
+ const_iterator tmp(*this);
+ ++(*this);
+ return tmp;
+}
+
+bool nodes_view::const_iterator::operator==(const const_iterator& other) const
+{
+ return pimpl_->it == other.pimpl_->it;
+}
+
+nodes_view::const_iterator::const_iterator(void *data, impl::iter_advance_functor *advance_func)
+{
+ assert( advance_func );
+ pimpl_ = new nipimpl(static_cast<xmlNodePtr>(data));
+ advance_func_ = advance_func;
+}
+
+void nodes_view::const_iterator::swap(nodes_view::const_iterator& other)
+{
+ std::swap(pimpl_, other.pimpl_);
+ std::swap(advance_func_, other.advance_func_);
+}
+
+} // namespace xml
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/src/libxml/node_iterator.h 2009-01-26 17:00:08 UTC (rev 130)
@@ -47,6 +47,38 @@
namespace impl {
+// helper to obtain the next node in "filtering" iterators (as used by
+// nodes_view and const_nodes_view)
+//
+// Note: This class is reference-counted; don't delete instance of it, use
+// dec_ref() and inc_ref(). Newly created instance has reference count
+// of 1.
+class iter_advance_functor
+{
+public:
+ iter_advance_functor() : refcnt_(1) {}
+
+ void inc_ref()
+ {
+ refcnt_++;
+ }
+
+ void dec_ref()
+ {
+ if ( --refcnt_ == 0 )
+ delete this;
+ }
+
+ virtual xmlNodePtr operator()(xmlNodePtr node) const = 0;
+
+protected:
+ // use inc_ref(), dec_ref() instead of using the dtor explicitly
+ virtual ~iter_advance_functor() {}
+
+private:
+ int refcnt_;
+};
+
// base iterator class
class node_iterator {
public:
@@ -59,10 +91,12 @@
node* get (void) const;
xmlNodePtr get_raw_node (void) { return node_; }
- node_iterator& operator++ (void);
+ void advance() { node_ = node_->next; }
+ void advance(iter_advance_functor& next) { node_ = next(node_); }
friend bool operator== (const node_iterator &lhs, const node_iterator &rhs);
+
private:
mutable node fake_node_;
xmlNodePtr node_;
Added: trunk/src/libxml/nodes_view.cxx
===================================================================
--- trunk/src/libxml/nodes_view.cxx (rev 0)
+++ trunk/src/libxml/nodes_view.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2009 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+// xmlwrapp includes
+#include "xmlwrapp/nodes_view.h"
+
+// definition include
+#include "node_iterator.h"
+#include "pimpl_base.h"
+
+namespace xml
+{
+
+// ------------------------------------------------------------------------
+// xml::const_nodes_view
+// ------------------------------------------------------------------------
+
+const_nodes_view::const_nodes_view(const const_nodes_view& other)
+ : data_begin_(other.data_begin_),
+ advance_func_(other.advance_func_)
+{
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+}
+
+const_nodes_view::const_nodes_view(const nodes_view& other)
+ : data_begin_(other.data_begin_),
+ advance_func_(other.advance_func_)
+{
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+}
+
+const_nodes_view::~const_nodes_view()
+{
+ if ( advance_func_ )
+ advance_func_->dec_ref();
+}
+
+const_nodes_view& const_nodes_view::operator=(const const_nodes_view& other)
+{
+ if ( advance_func_ )
+ advance_func_->dec_ref();
+
+ data_begin_ = other.data_begin_;
+ advance_func_ = other.advance_func_;
+
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+
+ return *this;
+}
+
+const_nodes_view& const_nodes_view::operator=(const nodes_view& other)
+{
+ if ( advance_func_ )
+ advance_func_->dec_ref();
+
+ data_begin_ = other.data_begin_;
+ advance_func_ = other.advance_func_;
+
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+
+ return *this;
+}
+
+// ------------------------------------------------------------------------
+// xml::nodes_view
+// ------------------------------------------------------------------------
+
+nodes_view::nodes_view(const nodes_view& other)
+ : data_begin_(other.data_begin_),
+ advance_func_(other.advance_func_)
+{
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+}
+
+nodes_view::~nodes_view()
+{
+ if ( advance_func_ )
+ advance_func_->dec_ref();
+}
+
+nodes_view& nodes_view::operator=(const nodes_view& other)
+{
+ if ( advance_func_ )
+ advance_func_->dec_ref();
+
+ data_begin_ = other.data_begin_;
+ advance_func_ = other.advance_func_;
+
+ if ( advance_func_ )
+ advance_func_->inc_ref();
+
+ return *this;
+}
+
+} // namespace xml
Property changes on: trunk/tests/node
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
.deps
.libs
test_node-01
test_node-02a
test_node-02b
test_node-02c
test_node-02d
test_node-03a
test_node-03b
test_node-04a
test_node-04b
test_node-05a
test_node-05b
test_node-05c
test_node-05d
test_node-06
test_node-07
test_node-08
test_node-09
test_node-10
test_node-11
test_node-12
test_node-13
test_node-14
+ Makefile
Makefile.in
.deps
.libs
test_node-01
test_node-02a
test_node-02b
test_node-02c
test_node-02d
test_node-02e
test_node-02f
test_node-02g
test_node-02h
test_node-03a
test_node-03b
test_node-04a
test_node-04b
test_node-05a
test_node-05b
test_node-05c
test_node-05d
test_node-06
test_node-07
test_node-08
test_node-09
test_node-10
test_node-11
test_node-12
test_node-13
test_node-14
Modified: trunk/tests/node/Makefile.am
===================================================================
--- trunk/tests/node/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/tests/node/Makefile.am 2009-01-26 17:00:08 UTC (rev 130)
@@ -10,6 +10,10 @@
test_node-02b \
test_node-02c \
test_node-02d \
+ test_node-02e \
+ test_node-02f \
+ test_node-02g \
+ test_node-02h \
test_node-03a \
test_node-03b \
test_node-04a \
@@ -33,6 +37,10 @@
test_node_02b_SOURCES = test_node-02b.cxx
test_node_02c_SOURCES = test_node-02c.cxx
test_node_02d_SOURCES = test_node-02d.cxx
+test_node_02e_SOURCES = test_node-02e.cxx
+test_node_02f_SOURCES = test_node-02f.cxx
+test_node_02g_SOURCES = test_node-02g.cxx
+test_node_02h_SOURCES = test_node-02h.cxx
test_node_03a_SOURCES = test_node-03a.cxx
test_node_03b_SOURCES = test_node-03b.cxx
test_node_04a_SOURCES = test_node-04a.cxx
Modified: trunk/tests/node/data/02.xml
===================================================================
--- trunk/tests/node/data/02.xml 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/tests/node/data/02.xml 2009-01-26 17:00:08 UTC (rev 130)
@@ -1 +1 @@
-<root><person><name>Peter</name><state>CO</state></person><person><name>Isaac</name><state>CA</state></person><person><name>Albert</name><state>AZ</state></person></root>
+<root><person><name>Peter</name><state>CO</state></person><person><name>Isaac</name><state>CA</state></person><unrelated_element/><person><name>Albert</name><state>AZ</state></person></root>
Added: trunk/tests/node/data/02e.out
===================================================================
--- trunk/tests/node/data/02e.out (rev 0)
+++ trunk/tests/node/data/02e.out 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<person>
+ <name>Peter</name>
+ <state>CO</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Isaac</name>
+ <state>CA</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Albert</name>
+ <state>AZ</state>
+</person>
Added: trunk/tests/node/data/02f.out
===================================================================
--- trunk/tests/node/data/02f.out (rev 0)
+++ trunk/tests/node/data/02f.out 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<person>
+ <name>Peter</name>
+ <state>CO</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Isaac</name>
+ <state>CA</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Albert</name>
+ <state>AZ</state>
+</person>
Added: trunk/tests/node/data/02g.out
===================================================================
--- trunk/tests/node/data/02g.out (rev 0)
+++ trunk/tests/node/data/02g.out 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<person>
+ <name>Peter</name>
+ <state>CO</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Isaac</name>
+ <state>CA</state>
+</person>
+<?xml version="1.0"?>
+<unrelated_element/>
+<?xml version="1.0"?>
+<person>
+ <name>Albert</name>
+ <state>AZ</state>
+</person>
Added: trunk/tests/node/data/02h.out
===================================================================
--- trunk/tests/node/data/02h.out (rev 0)
+++ trunk/tests/node/data/02h.out 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<person>
+ <name>Peter</name>
+ <state>CO</state>
+</person>
+<?xml version="1.0"?>
+<person>
+ <name>Isaac</name>
+ <state>CA</state>
+</person>
+<?xml version="1.0"?>
+<unrelated_element/>
+<?xml version="1.0"?>
+<person>
+ <name>Albert</name>
+ <state>AZ</state>
+</person>
Modified: trunk/tests/node/runtest.pl
===================================================================
--- trunk/tests/node/runtest.pl 2009-01-25 13:42:49 UTC (rev 129)
+++ trunk/tests/node/runtest.pl 2009-01-26 17:00:08 UTC (rev 130)
@@ -46,6 +46,9 @@
foreach my $i (qw(02a 02b 02c 02d)) {
$test->regression("find ($i)", "./test_node-$i data/02.xml", "data/$i.out");
}
+ foreach my $i (qw(02e 02f 02g 02h)) {
+ $test->regression("elements ($i)", "./test_node-$i data/02.xml", "data/$i.out");
+ }
###########################################################################
foreach my $i (qw(03a 03b)) {
$test->regression("replace ($i)", "./test_node-$i data/03.xml", "data/$i.out");
Added: trunk/tests/node/test_node-02e.cxx
===================================================================
--- trunk/tests/node/test_node-02e.cxx (rev 0)
+++ trunk/tests/node/test_node-02e.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This test checks xml::node::iterator xml::node::elements (const char *name);
+ */
+
+#include <xmlwrapp/xmlwrapp.h>
+#include <iostream>
+#include <exception>
+
+int main (int argc, char *argv[]) {
+ if (argc != 2) {
+ std::cerr << "Usage: " << argv[0] << " xmlfile\n";
+ return 1;
+ }
+
+ try {
+ xml::tree_parser parser(argv[1]);
+
+ xml::node &root = parser.get_document().get_root_node();
+ xml::nodes_view persons(root.elements("person"));
+ for (xml::nodes_view::const_iterator i = persons.begin(); i != persons.end(); ++i) {
+ std::cout << *i;
+ }
+ } catch (const std::exception &e) {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
Added: trunk/tests/node/test_node-02f.cxx
===================================================================
--- trunk/tests/node/test_node-02f.cxx (rev 0)
+++ trunk/tests/node/test_node-02f.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2008 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This test checks xml::node::elements (const char *name);
+ */
+
+#include <xmlwrapp/xmlwrapp.h>
+#include <iostream>
+#include <exception>
+#include <cassert>
+
+int main (int argc, char *argv[]) {
+ if (argc != 2) {
+ std::cerr << "Usage: " << argv[0] << " xmlfile\n";
+ return 1;
+ }
+
+ try {
+ xml::tree_parser parser(argv[1]);
+
+ const xml::node &root = parser.get_document().get_root_node();
+ xml::const_nodes_view persons(root.elements("person"));
+ for (xml::const_nodes_view::const_iterator i = persons.begin(); i != persons.end(); ++i) {
+ std::cout << *i;
+ }
+
+ // FIXME: make this a proper test after moving to Cppunit or Boost.Unit
+ xml::const_nodes_view v2(root.elements("nonexistent"));
+ assert( v2.begin() == v2.end() );
+ assert( v2.empty() );
+
+ } catch (const std::exception &e) {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
Added: trunk/tests/node/test_node-02g.cxx
===================================================================
--- trunk/tests/node/test_node-02g.cxx (rev 0)
+++ trunk/tests/node/test_node-02g.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This test checks xml::node::iterator xml::node::elements (const char *name);
+ */
+
+#include <xmlwrapp/xmlwrapp.h>
+#include <iostream>
+#include <exception>
+
+int main (int argc, char *argv[]) {
+ if (argc != 2) {
+ std::cerr << "Usage: " << argv[0] << " xmlfile\n";
+ return 1;
+ }
+
+ try {
+ xml::tree_parser parser(argv[1]);
+
+ xml::node &root = parser.get_document().get_root_node();
+ xml::nodes_view all(root.elements());
+ for (xml::nodes_view::const_iterator i = all.begin(); i != all.end(); ++i) {
+ std::cout << *i;
+ }
+ } catch (const std::exception &e) {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
Added: trunk/tests/node/test_node-02h.cxx
===================================================================
--- trunk/tests/node/test_node-02h.cxx (rev 0)
+++ trunk/tests/node/test_node-02h.cxx 2009-01-26 17:00:08 UTC (rev 130)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 Vaclav Slavik <vs...@fa...>
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This test checks xml::node::elements (const char *name);
+ */
+
+#include <xmlwrapp/xmlwrapp.h>
+#include <iostream>
+#include <exception>
+
+int main (int argc, char *argv[]) {
+ if (argc != 2) {
+ std::cerr << "Usage: " << argv[0] << " xmlfile\n";
+ return 1;
+ }
+
+ try {
+ xml::tree_parser parser(argv[1]);
+
+ const xml::node &root = parser.get_document().get_root_node();
+ xml::const_nodes_view all(root.elements());
+ for (xml::const_nodes_view::const_iterator i = all.begin(); i != all.end(); ++i) {
+ std::cout << *i;
+ }
+ } catch (const std::exception &e) {
+ std::cout << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-01-25 13:42:55
|
Revision: 129
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=129&view=rev
Author: vaclavslavik
Date: 2009-01-25 13:42:49 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
build release tarballs with 'make dist'; install HTML docs in 'make install'
Modified Paths:
--------------
trunk/Makefile.am
trunk/bootstrap
trunk/configure.ac
trunk/examples/04-xslt/Makefile.am
trunk/tests/Makefile.am
trunk/tests/attributes/Makefile.am
trunk/tests/document/Makefile.am
trunk/tests/event/Makefile.am
trunk/tests/node/Makefile.am
trunk/tests/tree/Makefile.am
trunk/tests/xslt/Makefile.am
Added Paths:
-----------
trunk/docs/Makefile.am
Removed Paths:
-------------
trunk/docs/VERSION
trunk/tools/
Property Changed:
----------------
trunk/docs/
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -1,5 +1,5 @@
-SUBDIRS = include src examples tests
+SUBDIRS = include src examples tests docs
pkgconfigdir=$(libdir)/pkgconfig
@@ -10,3 +10,6 @@
endif
bin_SCRIPTS = xmlwrapp-config
+
+EXTRA_DIST = LICENSE bootstrap \
+ platform/Win32/*.dsp platform/Win32/*.dsw
Modified: trunk/bootstrap
===================================================================
--- trunk/bootstrap 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/bootstrap 2009-01-25 13:42:49 UTC (rev 129)
@@ -51,6 +51,7 @@
echo " - libtoolize " && libtoolize --copy --automake && \
echo " - autoconf " && autoconf && \
echo " - automake " && automake --add-missing --copy --foreign && \
+echo " - doxygen " && (cd docs && doxygen) && \
echo "Build setup successful, type \"configure\" to configure xmlwrapp now." && \
exit 0
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/configure.ac 2009-01-25 13:42:49 UTC (rev 129)
@@ -35,7 +35,7 @@
AC_REVISION($Id$)dnl
-AC_PREREQ(2.56)
+AC_PREREQ(2.60)
AC_INIT(xmlwrapp, 0.6.0, [xml...@li...])
AC_CONFIG_SRCDIR([xmlwrapp.pc.in])
@@ -116,6 +116,7 @@
Makefile
include/Makefile
src/Makefile
+ docs/Makefile
examples/Makefile
examples/01-tree_parsing/Makefile
examples/02-event_parsing/Makefile
Property changes on: trunk/docs
___________________________________________________________________
Modified: svn:ignore
- html
+ html
Makefile
Makefile.in
Added: trunk/docs/Makefile.am
===================================================================
--- trunk/docs/Makefile.am (rev 0)
+++ trunk/docs/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -0,0 +1,7 @@
+
+html_DATA = $(srcdir)/html/*.*
+
+EXTRA_DIST = Doxyfile manual/*.doxygen
+
+dist-hook:
+ cd $(distdir) && doxygen
Property changes on: trunk/docs/Makefile.am
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Deleted: trunk/docs/VERSION
===================================================================
--- trunk/docs/VERSION 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/docs/VERSION 2009-01-25 13:42:49 UTC (rev 129)
@@ -1,12 +0,0 @@
-0.5.1 5 2 REL-0_5_1 2008/11/16
-0.5.0 5 2 REL-0_5_0 2004/03/18
-0.4.4 4 1 REL-0_4_4 2003/10/29
-0.4.3 4 1 REL-0_4_3 2003/08/19
-0.4.2 4 1 REL-0_4_2 2003/06/20
-0.4.1 4 1 REL-0_4_1 2003/04/07
-0.4.0 4 1 REL-0_4_0 2003/02/03
-0.3.0 3 0 REL-0_3_0 2003/01/07
-0.2.2 2 0 REL-0_2_2 2002/09/03
-0.2.1 2 0 REL-0_2_1 2002/06/26
-0.2.0 2 0 REL-0_2_0 2002/05/06
-0.1.0 1 0 REL-0_1_0 2002/04/11
Modified: trunk/examples/04-xslt/Makefile.am
===================================================================
--- trunk/examples/04-xslt/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/examples/04-xslt/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -8,3 +8,5 @@
example_LDADD = ../../src/libxsltwrapp.la ../../src/libxmlwrapp.la
endif
+
+EXTRA_DIST = example.xml example.xsl
Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -6,3 +6,5 @@
node \
tree \
xslt
+
+EXTRA_DIST = harness/harness.pm
Modified: trunk/tests/attributes/Makefile.am
===================================================================
--- trunk/tests/attributes/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/attributes/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -26,3 +26,5 @@
test_attr_08_SOURCES = test_attr-08.cxx
test_attr_09_SOURCES = test_attr-09.cxx
test_attr_10_SOURCES = test_attr-10.cxx
+
+EXTRA_DIST = data/*.out data/*.xml data/*.dtd runtest.pl
Modified: trunk/tests/document/Makefile.am
===================================================================
--- trunk/tests/document/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/document/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -50,3 +50,5 @@
test_document_20_SOURCES = test_document-20.cxx
test_document_21_SOURCES = test_document-21.cxx
test_document_22_SOURCES = test_document-22.cxx
+
+EXTRA_DIST = data/*.out data/*.xml runtest.pl
Modified: trunk/tests/event/Makefile.am
===================================================================
--- trunk/tests/event/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/event/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -12,3 +12,5 @@
test_event_01_SOURCES = test_event-01.cxx
test_event_02_SOURCES = test_event-02.cxx
test_event_03_SOURCES = test_event-03.cxx
+
+EXTRA_DIST = data/*.out data/*.xml runtest.pl
Modified: trunk/tests/node/Makefile.am
===================================================================
--- trunk/tests/node/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/node/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -50,3 +50,5 @@
test_node_12_SOURCES = test_node-12.cxx
test_node_13_SOURCES = test_node-13.cxx
test_node_14_SOURCES = test_node-14.cxx
+
+EXTRA_DIST = data/*.out data/*.xml runtest.pl
Modified: trunk/tests/tree/Makefile.am
===================================================================
--- trunk/tests/tree/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/tree/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -18,3 +18,5 @@
test_tree_04_SOURCES = test_tree-04.cxx
test_tree_05_SOURCES = test_tree-05.cxx
test_tree_06_SOURCES = test_tree-06.cxx
+
+EXTRA_DIST = runtest.pl
Modified: trunk/tests/xslt/Makefile.am
===================================================================
--- trunk/tests/xslt/Makefile.am 2009-01-24 23:25:52 UTC (rev 128)
+++ trunk/tests/xslt/Makefile.am 2009-01-25 13:42:49 UTC (rev 129)
@@ -20,3 +20,5 @@
test_xslt_05_SOURCES = test_xslt-05.cxx
endif
+
+EXTRA_DIST = data/*.xml data/*.xsl data/*.out runtest.pl
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-01-24 23:26:05
|
Revision: 128
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=128&view=rev
Author: vaclavslavik
Date: 2009-01-24 23:25:52 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
distance between two nodes iterators is not pointers difference, so difference_type shouldn't be std::ptrdiff_t
Modified Paths:
--------------
trunk/include/xmlwrapp/node.h
Modified: trunk/include/xmlwrapp/node.h
===================================================================
--- trunk/include/xmlwrapp/node.h 2009-01-23 00:03:26 UTC (rev 127)
+++ trunk/include/xmlwrapp/node.h 2009-01-24 23:25:52 UTC (rev 128)
@@ -424,7 +424,7 @@
class iterator {
public:
typedef node value_type;
- typedef std::ptrdiff_t difference_type;
+ typedef int difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
@@ -463,7 +463,7 @@
class const_iterator {
public:
typedef const node value_type;
- typedef std::ptrdiff_t difference_type;
+ typedef int difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef std::forward_iterator_tag iterator_category;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-01-23 00:03:37
|
Revision: 127
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=127&view=rev
Author: vaclavslavik
Date: 2009-01-23 00:03:26 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
made xml::impl::node_iterator::get_raw_node() inline, it's trivial
Modified Paths:
--------------
trunk/src/libxml/node_iterator.cxx
trunk/src/libxml/node_iterator.h
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2009-01-22 23:53:57 UTC (rev 126)
+++ trunk/src/libxml/node_iterator.cxx 2009-01-23 00:03:26 UTC (rev 127)
@@ -74,10 +74,6 @@
return *this;
}
//####################################################################
-xmlNodePtr xml::impl::node_iterator::get_raw_node (void) {
- return node_;
-}
-//####################################################################
/*
* xml::node::iterator wrapper iterator class.
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2009-01-22 23:53:57 UTC (rev 126)
+++ trunk/src/libxml/node_iterator.h 2009-01-23 00:03:26 UTC (rev 127)
@@ -57,7 +57,7 @@
node_iterator& operator= (const node_iterator &other) { node_ = other.node_; return *this;}
node* get (void) const;
- xmlNodePtr get_raw_node (void);
+ xmlNodePtr get_raw_node (void) { return node_; }
node_iterator& operator++ (void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vac...@us...> - 2009-01-22 23:53:58
|
Revision: 126
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=126&view=rev
Author: vaclavslavik
Date: 2009-01-22 23:53:57 +0000 (Thu, 22 Jan 2009)
Log Message:
-----------
removed unused impl::node_iterator::operator++(int) and unused friendd declaration
Modified Paths:
--------------
trunk/src/libxml/node_iterator.cxx
trunk/src/libxml/node_iterator.h
Modified: trunk/src/libxml/node_iterator.cxx
===================================================================
--- trunk/src/libxml/node_iterator.cxx 2009-01-21 23:19:45 UTC (rev 125)
+++ trunk/src/libxml/node_iterator.cxx 2009-01-22 23:53:57 UTC (rev 126)
@@ -74,12 +74,6 @@
return *this;
}
//####################################################################
-xml::impl::node_iterator xml::impl::node_iterator::operator++ (int) {
- node_iterator old(*this);
- ++(*this);
- return old;
-}
-//####################################################################
xmlNodePtr xml::impl::node_iterator::get_raw_node (void) {
return node_;
}
Modified: trunk/src/libxml/node_iterator.h
===================================================================
--- trunk/src/libxml/node_iterator.h 2009-01-21 23:19:45 UTC (rev 125)
+++ trunk/src/libxml/node_iterator.h 2009-01-22 23:53:57 UTC (rev 126)
@@ -58,12 +58,11 @@
node* get (void) const;
xmlNodePtr get_raw_node (void);
-
+
node_iterator& operator++ (void);
- node_iterator operator++ (int);
friend bool operator== (const node_iterator &lhs, const node_iterator &rhs);
- friend bool operator!= (const node_iterator &lhs, const node_iterator &rhs);
+
private:
mutable node fake_node_;
xmlNodePtr node_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|