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...> - 2010-03-11 15:29:49
|
Revision: 175 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=175&view=rev Author: vaclavslavik Date: 2010-03-11 15:29:43 +0000 (Thu, 11 Mar 2010) Log Message: ----------- Clarified xml::node::set_content() argument docs. Like xmlNodeSetNontent(), this function expects valid CDATA fragment, meaning that passing e.g. "M&M" to it is undefined and breaks silently. Modified Paths: -------------- trunk/include/xmlwrapp/node.h Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-11 15:29:23 UTC (rev 174) +++ trunk/include/xmlwrapp/node.h 2010-03-11 15:29:43 UTC (rev 175) @@ -282,6 +282,12 @@ with one text node set to the given string. @param content The content of the text node. + + @note @a content is supposed to be a piece of XML CDATA, so it allows + entity references, but XML special chars need to be escaped + first. In particular, the '&' character @em must be escaped + as "&" unless it's part of entity reference. Not escaping + @a content may result in truncation of data. */ void set_content(const char *content); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-11 15:29:29
|
Revision: 174 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=174&view=rev Author: vaclavslavik Date: 2010-03-11 15:29:23 +0000 (Thu, 11 Mar 2010) Log Message: ----------- Test if text data are escaped as expected. When creating a text node with e.g. '&' in it, it should be serialized as valid XML, with special characters replaced with entities. So creating a text node or setting node's content to "M & M" should result in "M & M" markup. Modified Paths: -------------- trunk/tests/node/test_node.cxx Added Paths: ----------- trunk/tests/node/data/special_chars.xml Added: trunk/tests/node/data/special_chars.xml =================================================================== --- trunk/tests/node/data/special_chars.xml (rev 0) +++ trunk/tests/node/data/special_chars.xml 2010-03-11 15:29:23 UTC (rev 174) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root>Marlow & Sons</root> Modified: trunk/tests/node/test_node.cxx =================================================================== --- trunk/tests/node/test_node.cxx 2010-03-10 18:24:44 UTC (rev 173) +++ trunk/tests/node/test_node.cxx 2010-03-11 15:29:23 UTC (rev 174) @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) - * Copyright (C) 2009 Vaclav Slavik (vs...@fa...) + * Copyright (C) 2009-2010 Vaclav Slavik (vs...@fa...) * All Rights Reserved * * Redistribution and use in source and binary forms, with or without @@ -566,4 +566,50 @@ } +/* + * Test correct (expected) handling of text escaping. + */ + +BOOST_AUTO_TEST_CASE( text_substitute_entities ) +{ + xml::tree_parser parser(test_file_path("node/data/special_chars.xml").c_str()); + xml::node &root = parser.get_document().get_root_node(); + + const std::string content = root.get_content(); + + BOOST_CHECK_EQUAL( content, "Marlow & Sons" ); +} + + +BOOST_AUTO_TEST_CASE( escape_node_with_content ) +{ + xml::node n("root", "Marlow & Sons"); + + BOOST_CHECK_EQUAL( n.get_content(), "Marlow & Sons" ); + BOOST_CHECK( is_same_as_file(n, "node/data/special_chars.xml") ); +} + + +BOOST_AUTO_TEST_CASE( escape_text_node ) +{ + xml::node n("root"); + n.push_back(xml::node(xml::node::text("Marlow & Sons"))); + + BOOST_CHECK_EQUAL( n.get_content(), "Marlow & Sons" ); + BOOST_CHECK( is_same_as_file(n, "node/data/special_chars.xml") ); +} + + +BOOST_AUTO_TEST_CASE( escape_set_content ) +{ + xml::node n("root"); + // Note that set_content() takes CDATA content as argument, so "&" + // has to be written as "&". + n.set_content("Marlow & Sons"); + + BOOST_CHECK_EQUAL( n.get_content(), "Marlow & Sons" ); + BOOST_CHECK( is_same_as_file(n, "node/data/special_chars.xml") ); +} + + 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...> - 2010-03-10 18:24:55
|
Revision: 173 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=173&view=rev Author: vaclavslavik Date: 2010-03-10 18:24:44 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Add support for ELF symbols visibility. The libraries are now built so that only public API symbols are exported into shared library. This means fewer symbols to resolve at runtime and smaller risk of any symbols conflicts. Modified Paths: -------------- trunk/bootstrap trunk/configure.ac trunk/include/Makefile.am trunk/include/xmlwrapp/_cbfo.h trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/exception.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xsltwrapp/init.h trunk/include/xsltwrapp/stylesheet.h trunk/src/Makefile.am trunk/src/libxml/utility.cxx Added Paths: ----------- trunk/admin/visibility.m4 trunk/include/xmlwrapp/export.h Added: trunk/admin/visibility.m4 =================================================================== --- trunk/admin/visibility.m4 (rev 0) +++ trunk/admin/visibility.m4 2010-03-10 18:24:44 UTC (rev 173) @@ -0,0 +1,132 @@ +dnl visibility.m4 serial 1 (gettext-0.15) +dnl Copyright (C) 2005 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Modified for use in wxWidgets by Vaclav Slavik: +dnl - don't define HAVE_VISIBILITY (=0) if not supported +dnl - use -fvisibility-inlines-hidden too +dnl - test in C++ mode + +dnl Tests whether the compiler supports the command-line option +dnl -fvisibility=hidden and the function and variable attributes +dnl __attribute__((__visibility__("hidden"))) and +dnl __attribute__((__visibility__("default"))). +dnl Does *not* test for __visibility__("protected") - which has tricky +dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on +dnl MacOS X. +dnl Does *not* test for __visibility__("internal") - which has processor +dnl dependent semantics. +dnl Does *not* test for #pragma GCC visibility push(hidden) - which is +dnl "really only recommended for legacy code". +dnl Set the variable CFLAG_VISIBILITY. +dnl Defines and sets the variable HAVE_VISIBILITY. + +AC_DEFUN([XMLWRAPP_VISIBILITY], +[ + AC_REQUIRE([AC_PROG_CC]) + if test -n "$GCC"; then + CFLAGS_VISIBILITY="-fvisibility=hidden" + CXXFLAGS_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden" + AC_MSG_CHECKING([for symbols visibility support]) + AC_CACHE_VAL(wx_cv_cc_visibility, [ + wx_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY" + AC_LANG_PUSH(C++) + AC_TRY_COMPILE( + [ + /* we need gcc >= 4.0, older versions with visibility support + didn't have class visibility: */ + #if defined(__GNUC__) && __GNUC__ < 4 + error this gcc is too old; + #endif + + /* visibility only makes sense for ELF shared libs: */ + #if !defined(__ELF__) && !defined(__APPLE__) + error this platform has no visibility; + #endif + + extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + class __attribute__((__visibility__("default"))) Foo { + Foo() {} + }; + ], + [], + wx_cv_cc_visibility=yes, + wx_cv_cc_visibility=no) + AC_LANG_POP() + CXXFLAGS="$wx_save_CXXFLAGS"]) + AC_MSG_RESULT([$wx_cv_cc_visibility]) + if test $wx_cv_cc_visibility = yes; then + dnl we do have basic visibility support, now check if we can use it: + dnl + dnl Debian/Ubuntu's gcc 4.1 is affected: + dnl https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/109262 + AC_MSG_CHECKING([for broken libstdc++ visibility]) + AC_CACHE_VAL(wx_cv_cc_broken_libstdcxx_visibility, [ + wx_save_CXXFLAGS="$CXXFLAGS" + wx_save_LDFLAGS="$LDFLAGS" + CXXFLAGS="$CXXFLAGS $CXXFLAGS_VISIBILITY" + LDFLAGS="$LDFLAGS -shared -fPIC" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [ + #include <string> + ], + [ + std::string s("hello"); + return s.length(); + ], + wx_cv_cc_broken_libstdcxx_visibility=no, + wx_cv_cc_broken_libstdcxx_visibility=yes) + AC_LANG_POP() + CXXFLAGS="$wx_save_CXXFLAGS" + LDFLAGS="$wx_save_LDFLAGS"]) + AC_MSG_RESULT([$wx_cv_cc_broken_libstdcxx_visibility]) + + if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then + AC_MSG_CHECKING([whether we can work around it]) + AC_CACHE_VAL(wx_cv_cc_visibility_workaround, [ + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [ + #pragma GCC visibility push(default) + #include <string> + #pragma GCC visibility pop + ], + [ + std::string s("hello"); + return s.length(); + ], + wx_cv_cc_visibility_workaround=no, + wx_cv_cc_visibility_workaround=yes) + AC_LANG_POP() + ]) + AC_MSG_RESULT([$wx_cv_cc_visibility_workaround]) + + if test $wx_cv_cc_visibility_workaround = no; then + dnl we can't use visibility at all then + wx_cv_cc_visibility=no + fi + fi + fi + + if test $wx_cv_cc_visibility = yes; then + AC_DEFINE([HAVE_VISIBILITY]) + if test $wx_cv_cc_broken_libstdcxx_visibility = yes; then + AC_DEFINE([HAVE_BROKEN_LIBSTDCXX_VISIBILITY]) + fi + else + CFLAGS_VISIBILITY="" + CXXFLAGS_VISIBILITY="" + fi + AC_SUBST([CFLAGS_VISIBILITY]) + AC_SUBST([CXXFLAGS_VISIBILITY]) + fi +]) Modified: trunk/bootstrap =================================================================== --- trunk/bootstrap 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/bootstrap 2010-03-10 18:24:44 UTC (rev 173) @@ -47,7 +47,7 @@ # --copy to allow simultaneous use on windows under mingw and cygwin platforms. # Symlinking of files under mingw does not work out for cygwin and vice-versa. echo "Setting up build system for xmlwrapp:" -echo " - aclocal " && aclocal && \ +echo " - aclocal " && aclocal -I admin && \ echo " - libtoolize " && libtoolize --copy --automake && \ echo " - autoconf " && autoconf && \ echo " - automake " && automake --add-missing --copy --foreign && \ Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/configure.ac 2010-03-10 18:24:44 UTC (rev 173) @@ -95,6 +95,8 @@ CXXFLAGS="$CXXFLAGS -W -Wall -Wcast-align -Wwrite-strings" fi +dnl Check if the compiler supports symbols visibility: +XMLWRAPP_VISIBILITY dnl === Generate output files === Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/Makefile.am 2010-03-10 18:24:44 UTC (rev 173) @@ -6,6 +6,7 @@ xmlwrapp/document.h \ xmlwrapp/event_parser.h \ xmlwrapp/exception.h \ + xmlwrapp/export.h \ xmlwrapp/init.h \ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ Modified: trunk/include/xmlwrapp/_cbfo.h =================================================================== --- trunk/include/xmlwrapp/_cbfo.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/_cbfo.h 2010-03-10 18:24:44 UTC (rev 173) @@ -33,6 +33,9 @@ #ifndef _xmlwrapp_cbfo_h_ #define _xmlwrapp_cbfo_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + #include <functional> namespace xml @@ -44,7 +47,7 @@ { // helper for xml::node::sort() - struct cbfo_node_compare + struct XMLWRAPP_API cbfo_node_compare : public std::binary_function<xml::node, xml::node, bool> { virtual ~cbfo_node_compare() {} Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/attributes.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -67,7 +68,7 @@ The iterator classes allow you to access one XML attribute. This is done using the xml::attributes::attr class interface. */ -class attributes +class XMLWRAPP_API attributes { public: /// size type @@ -169,8 +170,8 @@ /// 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); + friend bool XMLWRAPP_API operator==(const iterator& lhs, const iterator& rhs); + friend bool XMLWRAPP_API operator!=(const iterator& lhs, const iterator& rhs); private: impl::ait_impl *pimpl_; @@ -211,8 +212,8 @@ /// postfix increment (avoid if possible better for 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); + friend bool XMLWRAPP_API operator== (const const_iterator &lhs, const const_iterator &rhs); + friend bool XMLWRAPP_API operator!= (const const_iterator &lhs, const const_iterator &rhs); private: impl::ait_impl *pimpl_; Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/document.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" #include "xmlwrapp/node.h" +#include "xmlwrapp/export.h" // standard includes #include <iosfwd> @@ -75,7 +76,7 @@ The xml::document class is used to hold the XML tree and various bits of information about it. */ -class document +class XMLWRAPP_API document { public: /// size type @@ -437,7 +438,7 @@ @param doc The document to insert. @return The stream from the first parameter. */ - friend std::ostream& operator<< (std::ostream &stream, const document &doc); + friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream, const document &doc); private: impl::doc_impl *pimpl_; Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/event_parser.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -62,7 +63,7 @@ use this class you derive a sub-class from it and override the protected virtual functions. */ -class event_parser +class XMLWRAPP_API event_parser { public: /// a type for holding XML node attributes Modified: trunk/include/xmlwrapp/exception.h =================================================================== --- trunk/include/xmlwrapp/exception.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/exception.h 2010-03-10 18:24:44 UTC (rev 173) @@ -39,6 +39,9 @@ #ifndef _xmlwrapp_exception_h_ #define _xmlwrapp_exception_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + #include <stdexcept> #include <string> @@ -55,7 +58,7 @@ @since 0.7.0 */ -class exception : public std::runtime_error +class XMLWRAPP_API exception : public std::runtime_error { public: explicit exception(const std::string& what) : std::runtime_error(what) Copied: trunk/include/xmlwrapp/export.h (from rev 172, trunk/include/xmlwrapp/exception.h) =================================================================== --- trunk/include/xmlwrapp/export.h (rev 0) +++ trunk/include/xmlwrapp/export.h 2010-03-10 18:24:44 UTC (rev 173) @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef _xmlwrapp_export_h_ +#define _xmlwrapp_export_h_ + +#ifdef HAVE_VISIBILITY + #define XMLWRAPP_API __attribute__ ((visibility("default"))) + #define XSLTWRAPP_API __attribute__ ((visibility("default"))) +#else + #define XMLWRAPP_API + #define XSLTWRAPP_API +#endif + +#endif // _xmlwrapp_export_h_ Modified: trunk/include/xmlwrapp/init.h =================================================================== --- trunk/include/xmlwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/init.h 2010-03-10 18:24:44 UTC (rev 173) @@ -39,6 +39,9 @@ #ifndef _xmlwrapp_init_h_ #define _xmlwrapp_init_h_ +// xmlwrapp includes +#include "xmlwrapp/export.h" + /// XML library namespace namespace xml { @@ -57,7 +60,7 @@ 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 +class XMLWRAPP_API init { public: init(); Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/node.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // hidden stuff #include "xmlwrapp/_cbfo.h" @@ -82,7 +83,7 @@ ANY operation to the xml::node. If you need the data to stick around a little longer you should put it inside a std::string. */ -class node +class XMLWRAPP_API node { public: /// size type @@ -787,7 +788,7 @@ @param n The node to write to the stream. @return The stream. */ - friend std::ostream& operator<< (std::ostream &stream, const node &n); + friend XMLWRAPP_API std::ostream& operator<< (std::ostream &stream, const node &n); private: impl::node_impl *pimpl_; Modified: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/nodes_view.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <iterator> @@ -73,7 +74,7 @@ @see xml::node::elements(), xml::node::elements(const char *) */ -class nodes_view +class XMLWRAPP_API nodes_view { public: nodes_view() : data_begin_(0), advance_func_(0) {} @@ -235,7 +236,7 @@ @since 0.6.0 */ -class const_nodes_view +class XMLWRAPP_API const_nodes_view { public: const_nodes_view() : data_begin_(0), advance_func_(0) {} Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xmlwrapp/tree_parser.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" // standard includes #include <cstddef> @@ -64,7 +65,7 @@ After constructing a tree_parser, with either a file to parse or some in memory data to parse, you can walk the tree using the xml::node interface. */ -class tree_parser +class XMLWRAPP_API tree_parser { public: typedef std::size_t size_type; Modified: trunk/include/xsltwrapp/init.h =================================================================== --- trunk/include/xsltwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xsltwrapp/init.h 2010-03-10 18:24:44 UTC (rev 173) @@ -41,6 +41,7 @@ // xmlwrapp includes #include "xmlwrapp/init.h" +#include "xmlwrapp/export.h" /// XSLT library namespace namespace xslt @@ -59,7 +60,7 @@ 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 +class XSLTWRAPP_API init : public xml::init { public: init(); Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/include/xsltwrapp/stylesheet.h 2010-03-10 18:24:44 UTC (rev 173) @@ -42,6 +42,7 @@ // xmlwrapp includes #include "xsltwrapp/init.h" #include "xmlwrapp/document.h" +#include "xmlwrapp/export.h" // standard includes #include <map> @@ -55,7 +56,7 @@ 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 +class XSLTWRAPP_API stylesheet { public: struct pimpl; Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/src/Makefile.am 2010-03-10 18:24:44 UTC (rev 173) @@ -1,5 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_srcdir)/include $(CXXFLAGS_VISIBILITY) if WITH_XSLT lib_LTLIBRARIES = libxmlwrapp.la libxsltwrapp.la Modified: trunk/src/libxml/utility.cxx =================================================================== --- trunk/src/libxml/utility.cxx 2010-03-09 17:33:58 UTC (rev 172) +++ trunk/src/libxml/utility.cxx 2010-03-10 18:24:44 UTC (rev 173) @@ -58,7 +58,8 @@ namespace impl { -void printf2string(std::string& s, const char *message, va_list ap) +// this function is used by libxsltwrapp too, so we must export it +XMLWRAPP_API void printf2string(std::string& s, const char *message, va_list ap) { char buffer[512]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-09 17:34:04
|
Revision: 172 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=172&view=rev Author: vaclavslavik Date: 2010-03-09 17:33:58 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Removed @author tags from documentation. This information is of no interest to *documentation* reader. It can be found in copyright notices, VCS history and the AUTHORS file. Modified Paths: -------------- trunk/AUTHORS trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xsltwrapp/init.h trunk/include/xsltwrapp/stylesheet.h trunk/src/libxml/node_manip.h trunk/src/libxslt/result.h Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/AUTHORS 2010-03-09 17:33:58 UTC (rev 172) @@ -15,3 +15,4 @@ Frank Grimm Gary Passero Michael Grundberg <mgr...@us...> + Dmitriy Nikitinskiy Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/attributes.h 2010-03-09 17:33:58 UTC (rev 172) @@ -75,8 +75,6 @@ /** Create a new xml::attributes object with no attributes. - - @author Peter Jones */ attributes(); @@ -84,7 +82,6 @@ Copy construct a xml::attributes object. @param other The xml::attributes object to copy from. - @author Peter Jones */ attributes(const attributes& other); @@ -92,8 +89,7 @@ Copy the given xml::attributes object into this one. @param other The xml::attributes object to copy from. - @return this. - @author Peter Jones + @return *this. */ attributes& operator=(const attributes& other); @@ -101,7 +97,6 @@ Swap this xml::attributes object with another one. @param other The other xml::attributes object to swap with. - @author Peter Jones */ void swap(attributes& other); @@ -121,7 +116,6 @@ Get the name of this attribute. @return The name for this attribute. - @author Peter Jones */ const char *get_name() const; @@ -129,7 +123,6 @@ Get the value of this attribute. @return The value for this attribute. - @author Peter Jones */ const char* get_value() const; @@ -239,7 +232,6 @@ @return An iterator equal to end() if there are no attributes. @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator begin(); @@ -250,7 +242,6 @@ @return A const_iterator equal to end() if there are no attributes. @see xml::attributes::const_iterator @see xml::attributes::attr - @author Peter Jones */ const_iterator begin() const; @@ -258,7 +249,6 @@ Get an iterator that points one past the the last attribute. @return An "end" iterator. - @author Peter Jones */ iterator end(); @@ -266,7 +256,6 @@ Get a const_iterator that points one past the last attribute. @return An "end" const_iterator. - @author Peter Jones */ const_iterator end() const; @@ -276,7 +265,6 @@ @param name The name of the attribute to add. @param value The value of the attribute to add. - @author Peter Jones */ void insert(const char *name, const char *value); @@ -290,7 +278,6 @@ @return If the attribute was not found, find will return end(). @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator find(const char *name); @@ -304,7 +291,6 @@ @return If the attribute was not found, find will return end(). @see xml::attributes::const_iterator @see xml::attributes::attr - @author Peter Jones */ const_iterator find(const char *name) const; @@ -317,7 +303,6 @@ @return An iterator that points to the attribute after the one to be erased. @see xml::attributes::iterator @see xml::attributes::attr - @author Peter Jones */ iterator erase(iterator to_erase); @@ -327,7 +312,6 @@ pointers or references to that attribute. @param name The name of the attribute to erase. - @author Peter Jones */ void erase(const char *name); @@ -336,7 +320,6 @@ @return True if there are no attributes. @return False if there is at least one attribute. - @author Peter Jones */ bool empty() const; @@ -345,7 +328,6 @@ object. @return The number of attributes in this xml::attributes object. - @author Peter Jones */ size_type size() const; Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/document.h 2010-03-09 17:33:58 UTC (rev 172) @@ -84,8 +84,6 @@ /** Create a new XML document with the default settings. The new document will contain a root node with a name of "blank". - - @author Peter Jones */ document(); @@ -94,7 +92,6 @@ given text. @param root_name What to set the name of the root element to. - @author Peter Jones */ explicit document(const char *root_name); @@ -102,7 +99,6 @@ Create a new XML document and set the root node. @param n The node to use as the root node. n will be copied. - @author Peter Jones */ explicit document(const node& n); @@ -111,7 +107,6 @@ copy of the original. @param other The other document object to copy from. - @author Peter Jones */ document(const document& other); @@ -122,7 +117,6 @@ @param other The document to copy from. @return *this. - @author Peter Jones */ document& operator=(const document& other); @@ -130,14 +124,11 @@ Swap one xml::document object for another. @param other The other document to swap - @author Peter Jones */ void swap(document& other); /** Clean up after an XML document object. - - @author Peter Jones */ ~document(); @@ -148,7 +139,6 @@ tree! @return A const reference to the root node. - @author Peter Jones */ const node& get_root_node() const; @@ -159,7 +149,6 @@ tree! @return A reference to the root node. - @author Peter Jones */ node& get_root_node(); @@ -168,7 +157,6 @@ in the document object. @param n The new root node to use. - @author Peter Jones */ void set_root_node(const node& n); @@ -178,7 +166,6 @@ version from the XML processing instruction. @return The XML version string for this document. - @author Peter Jones */ const std::string& get_version() const; @@ -187,7 +174,6 @@ will be used when generating the XML output. @param version The version string to use, like "1.0". - @author Peter Jones */ void set_version(const char *version); @@ -196,7 +182,6 @@ ISO-8859-1. @return The encoding string. - @author Peter Jones */ const std::string& get_encoding() const; @@ -205,8 +190,6 @@ to ISO-8859-1. @param encoding The XML encoding to use. - @author Peter Jones - @author Dmitriy Nikitinskiy */ void set_encoding(const char *encoding); @@ -217,7 +200,6 @@ @return True if this document is standalone. @return False if this document is not standalone. - @author Peter Jones */ bool get_is_standalone() const; @@ -226,7 +208,6 @@ correct processing instruction. @param sa What to set the standalone flag to. - @author Peter Jones */ void set_is_standalone(bool sa); @@ -240,8 +221,6 @@ @return False if there was an error with substitutions. @return True if there were no errors (with or without substitutions). - @author Peter Jones - @author Daniel Evison */ bool process_xinclude(); @@ -251,7 +230,6 @@ @return True if this document has an internal subset. @return False otherwise. - @author Peter Jones */ bool has_internal_subset() const; @@ -261,7 +239,6 @@ @return True if this document has an external subset. @return False otherwise. - @author Peter Jones */ bool has_external_subset() const; @@ -276,7 +253,6 @@ @return True if the document is valid. @return False if there was a problem with the DTD or XML doc. - @author Peter Jones */ bool validate(); @@ -295,7 +271,6 @@ @param dtdname A filename or URL for the DTD to use. @return True if the document is valid. @return False if there was a problem with the DTD or XML doc. - @author Peter Jones */ bool validate(const char *dtdname); @@ -306,7 +281,6 @@ there are, including processing instructions, comments, etc. @return The number of children nodes that this document has. - @author Peter Jones */ size_type size() const; @@ -317,7 +291,6 @@ @return A xml::node::iterator that points to the first child node. @return An end iterator if there are no children in this document - @author Peter Jones */ node::iterator begin(); @@ -328,7 +301,6 @@ @return A xml::node::const_iterator that points to the first child node. @return An end const_iterator if there are no children in this document. - @author Peter Jones */ node::const_iterator begin() const; @@ -337,7 +309,6 @@ document. @return An end xml::node::iterator. - @author Peter Jones */ node::iterator end(); @@ -346,7 +317,6 @@ this document. @return An end xml::node::const_iterator. - @author Peter Jones */ node::const_iterator end() const; @@ -358,7 +328,6 @@ be thrown. @param child The child xml::node to add. - @author Peter Jones */ void push_back (const node &child); @@ -373,7 +342,6 @@ @param n The node to insert as a child of this document. @return An iterator that points to the newly inserted node. @see xml::document::push_back - @author Peter Jones */ node::iterator insert (const node &n); @@ -388,7 +356,6 @@ @param n The node to insert as a child of this document. @return An iterator that points to the newly inserted node. @see xml::document::push_back - @author Peter Jones */ node::iterator insert(node::iterator position, const node &n); @@ -407,7 +374,6 @@ @param new_node The node to put in old_node's place. @return An iterator that points to the new node. @see xml::document::push_back - @author Peter Jones */ node::iterator replace(node::iterator old_node, const node& new_node); @@ -424,7 +390,6 @@ @param to_erase An iterator that points to the node to be erased. @return An iterator that points to the node after the one being erased. @see xml::document::push_back - @author Peter Jones */ node::iterator erase(node::iterator to_erase); @@ -441,7 +406,6 @@ @param last An iterator that points one past the last node to erase. Think xml::node::end(). @return An iterator that points to the node after the last one being erased. @see xml::document::push_back - @author Peter Jones */ node::iterator erase(node::iterator first, node::iterator last); @@ -450,7 +414,6 @@ the given string. @param s The string to place the XML text data. - @author Peter Jones */ void save_to_string(std::string& s) const; @@ -463,7 +426,6 @@ for better speed, and 9 is for smaller size @return True if the data was saved successfully. @return False otherwise. - @author Peter Jones */ bool save_to_file(const char *filename, int compression_level = 0) const; @@ -474,7 +436,6 @@ @param stream The stream to insert the XML into. @param doc The document to insert. @return The stream from the first parameter. - @author Peter Jones */ friend std::ostream& operator<< (std::ostream &stream, const document &doc); Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/event_parser.h 2010-03-09 17:33:58 UTC (rev 172) @@ -80,7 +80,6 @@ @param filename The name of the file to parse. @return True if the file was successfully parsed; false otherwise. - @author Peter Jones */ bool parse_file(const char *filename); @@ -89,7 +88,6 @@ @param stream The stream to read data from. @return True if the stream was successfully parsed; false otherwise. - @author Peter Jones */ bool parse_stream(std::istream& stream); @@ -101,7 +99,6 @@ @param chunk The xml data chuck to parse. @param length The size of the given data chunk @return True if the chunk was parsed sucessfully; false otherwise. - @author Peter Jones */ bool parse_chunk(const char *chunk, size_type length); @@ -111,7 +108,6 @@ member function. @return True if all parsing was successful; false otherwise. - @author Peter Jones */ bool parse_finish(); @@ -121,7 +117,6 @@ a message describing the error. @return A description of the XML parsing error. - @author Peter Jones */ const std::string& get_error_message() const; @@ -134,7 +129,6 @@ @param name The name of the element @param attrs The element's attributes @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool start_element(const std::string& name, const attrs_type& attrs) = 0; @@ -145,7 +139,6 @@ @param name The name of the element that was closed. @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool end_element(const std::string& name) = 0; @@ -155,7 +148,6 @@ @param contents The contents of the text node. @return You should return true to continue parsing; false to stop. - @author Peter Jones */ virtual bool text(const std::string& contents) = 0; @@ -170,7 +162,6 @@ @param contents The contents of the CDATA section. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool cdata(const std::string& contents); @@ -186,7 +177,6 @@ @param data The data of the processing instruction. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool processing_instruction(const std::string& target, const std::string& data); @@ -200,7 +190,6 @@ @param contents The contents of the XML comment. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool comment(const std::string& contents); @@ -211,7 +200,6 @@ @param message The warning message from the compiler. @return You should return true to continue parsing. @return Return false if you want to stop. - @author Peter Jones */ virtual bool warning(const std::string& message); @@ -222,7 +210,6 @@ function, "Unknown Error" will be returned from get_error_message(). @param message The message to return from get_error_message(). - @author Peter Jones */ void set_error_message(const char *message); Modified: trunk/include/xmlwrapp/init.h =================================================================== --- trunk/include/xmlwrapp/init.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) @@ -69,7 +69,6 @@ node tree. The default is true. @param flag True to turn on indenting, false to turn it off. - @author Peter Jones */ static void indent_output(bool flag); @@ -79,7 +78,6 @@ is false. @param flag True to remove whitespace, false to leave alone. - @author Peter Jones */ static void remove_whitespace(bool flag); @@ -88,7 +86,6 @@ substitute entities while parsing. The default is true. @param flag True to turn on substitution, false to turn off. - @author Peter Jones */ static void substitute_entities(bool flag); @@ -99,7 +96,6 @@ default is true. @param flag True to turn on loading, false to turn it off. - @author Peter Jones */ static void load_external_subsets(bool flag); @@ -109,7 +105,6 @@ is false. @return flag True to turn on validation, false to turn it off. - @author Peter Jones */ static void validate_xml(bool flag); Modified: trunk/include/xmlwrapp/node.h =================================================================== --- trunk/include/xmlwrapp/node.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/node.h 2010-03-09 17:33:58 UTC (rev 172) @@ -165,8 +165,6 @@ /** Construct a new blank xml::node. - - @author Peter Jones */ node(); @@ -174,7 +172,6 @@ Construct a new xml::node and set the name of the node. @param name The name of the new node. - @author Peter Jones */ explicit node(const char *name); @@ -184,7 +181,6 @@ @param name The name of the new element. @param content The text that will be used to create a child node. - @author Peter Jones */ node(const char *name, const char *content); @@ -199,7 +195,6 @@ @param cdata_info A cdata struct that tells xml::node what the content will be. - @author Peter Jones */ explicit node(cdata cdata_info); @@ -213,7 +208,6 @@ @endcode @param comment_info A comment struct that tells xml::node what the comment will be. - @author Peter Jones */ explicit node(comment comment_info); @@ -228,7 +222,6 @@ @endcode @param pi_info A pi struct that tells xml::node what the name and contents of the XML PI are. - @author Peter Jones */ explicit node(pi pi_info); @@ -242,7 +235,6 @@ @endcode @param text_info A text struct that tells xml::node what the text will be. - @author Vaclav Slavik */ explicit node(text text_info); @@ -250,7 +242,6 @@ Construct a new xml::node by copying another xml::node. @param other The other node to copy. - @author Peter Jones */ node(const node& other); @@ -259,14 +250,11 @@ @param other The other node to copy. @return A reference to this node. - @author Peter Jones */ node& operator=(const node& other); /** Class destructor - - @author Peter Jones */ ~node(); @@ -274,7 +262,6 @@ Set the name of this xml::node. @param name The new name for this xml::node. - @author Peter Jones */ void set_name(const char *name); @@ -285,7 +272,6 @@ Feedback is welcome. @return The name of this node. - @author Peter Jones */ const char* get_name() const; @@ -295,7 +281,6 @@ with one text node set to the given string. @param content The content of the text node. - @author Peter Jones */ void set_content(const char *content); @@ -309,7 +294,6 @@ Feedback is welcome. @return The content or 0. - @author Peter Jones */ const char* get_content() const; @@ -318,7 +302,6 @@ can and cannot do with it. @return The node's type. - @author Peter Jones */ node_type get_type() const; @@ -328,7 +311,6 @@ to this returned object, to prevent a copy. @return The xml::attributes object for this node. - @author Peter Jones */ xml::attributes& get_attributes(); @@ -338,7 +320,6 @@ returned object, to prevent a copy. @return The xml::attributes object for this node. - @author Peter Jones */ const xml::attributes& get_attributes() const; @@ -347,7 +328,6 @@ @return The namespace of this node or NULL if no namespace is associated. - @author Vaclav Slavik @since 0.6.0 */ const char* get_namespace() const; @@ -357,7 +337,6 @@ CDATA for example. @return True if this node is a text node; false otherwise. - @author Peter Jones */ bool is_text() const; @@ -365,7 +344,6 @@ Add a child xml::node to this node. @param child The child xml::node to add. - @author Peter Jones */ void push_back(const node& child); @@ -373,7 +351,6 @@ Swap this node with another one. @param other The other node to swap with. - @author Peter Jones */ void swap(node& other); @@ -475,7 +452,6 @@ xml::node::empty() instead. @return The number of children this node has. - @author Peter Jones */ size_type size() const; @@ -485,7 +461,6 @@ @return True if this node DOES NOT have any children. @return False if this node does have children. - @author Peter Jones */ bool empty() const; @@ -493,7 +468,6 @@ Get an iterator that points to the beginning of this node's children. @return An iterator that points to the beginning of the children. - @author Peter Jones */ iterator begin(); @@ -502,7 +476,6 @@ children. @return A const_iterator that points to the beginning of the children. - @author Peter Jones */ const_iterator begin() const; @@ -510,7 +483,6 @@ Get an iterator that points one past the last child for this node. @return A "one past the end" iterator. - @author Peter Jones */ iterator end() { return iterator(); } @@ -519,7 +491,6 @@ node. @return A "one past the end" const_iterator - @author Peter Jones */ const_iterator end() const { return const_iterator(); } @@ -527,7 +498,6 @@ Get an iterator that points back at this node. @return An iterator that points at this node. - @author Peter Jones */ iterator self(); @@ -535,7 +505,6 @@ Get a const_iterator that points back at this node. @return A const_iterator that points at this node. - @author Peter Jones */ const_iterator self() const; @@ -546,7 +515,6 @@ @return An iterator that points to this nodes parent. @return If no parent, returns the same iterator that xml::node::end() returns. - @author Peter Jones */ iterator parent(); @@ -557,7 +525,6 @@ @return A const_iterator that points to this nodes parent. @return If no parent, returns the same const_iterator that xml::node::end() returns. - @author Peter Jones */ const_iterator parent() const; @@ -573,7 +540,6 @@ @param name The name of the node you want to find. @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) */ @@ -591,7 +557,6 @@ @param name The name of the node you want to find. @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 @@ -612,7 +577,6 @@ @param start Where to begin the search. @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*) */ @@ -632,7 +596,6 @@ @param start Where to begin the search. @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 */ @@ -652,7 +615,6 @@ @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 @@ -675,7 +637,6 @@ @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 @@ -697,7 +658,6 @@ @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); @@ -719,7 +679,6 @@ @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; @@ -731,7 +690,6 @@ @param n The node to insert as a child of this node. @return An iterator that points to the newly inserted node. - @author Peter Jones */ iterator insert(const node& n); @@ -742,7 +700,6 @@ @param position An iterator that points to the location where the new node should be inserted (before it). @param n The node to insert as a child of this node. @return An iterator that points to the newly inserted node. - @author Peter Jones */ iterator insert(const iterator& position, const node& n); @@ -756,7 +713,6 @@ @param old_node An iterator that points to the node that should be removed. @param new_node The node to put in old_node's place. @return An iterator that points to the new node. - @author Peter Jones */ iterator replace(const iterator& old_node, const node& new_node); @@ -768,8 +724,6 @@ @param to_erase An iterator that points to the node to be erased. @return An iterator that points to the node after the one being erased. - @author Peter Jones - @author Gary A. Passero */ iterator erase(const iterator& to_erase); @@ -781,7 +735,6 @@ @param first The first node in the range to be removed. @param last An iterator that points one past the last node to erase. Think xml::node::end(). @return An iterator that points to the node after the last one being erased. - @author Peter Jones */ iterator erase(iterator first, const iterator& last); @@ -793,7 +746,6 @@ @param name The name of nodes to remove. @return The number of nodes removed. - @author Peter Jones */ size_type erase(const char *name); @@ -807,7 +759,6 @@ @param node_name The name of the nodes to sort. @param attr_name The attribute to sort on. - @author Peter Jones */ void sort(const char *node_name, const char *attr_name); @@ -817,7 +768,6 @@ sorting. @param compare The binary function object to call in order to sort all child nodes. - @author Peter Jones */ template <typename T> void sort (T compare) { impl::sort_callback<T> cb(compare); sort_fo(cb); } @@ -827,7 +777,6 @@ string to that text. @param xml The string to set the node's XML data to. - @author Peter Jones */ void node_to_string(std::string& xml) const; @@ -837,7 +786,6 @@ @param stream The stream to write the node as XML. @param n The node to write to the stream. @return The stream. - @author Peter Jones */ friend std::ostream& operator<< (std::ostream &stream, const node &n); Modified: trunk/include/xmlwrapp/nodes_view.h =================================================================== --- trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/nodes_view.h 2010-03-09 17:33:58 UTC (rev 172) @@ -69,7 +69,6 @@ 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 *) @@ -234,7 +233,6 @@ @see nodes_view - @author Vaclav Slavik @since 0.6.0 */ class const_nodes_view Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xmlwrapp/tree_parser.h 2010-03-09 17:33:58 UTC (rev 172) @@ -84,7 +84,6 @@ @param filename The name of the file to parse. @param allow_exceptions Whether or not you want an exception for parsing errors. - @author Peter Jones */ tree_parser(const char *filename, bool allow_exceptions = true); @@ -97,7 +96,6 @@ @param size The size of the XML data to parse. @param allow_exceptions Whether or not you want an exception for parsing errors. - @author Peter Jones */ tree_parser(const char *data, size_type size, bool allow_exceptions = true); @@ -109,7 +107,6 @@ good XML node tree. @return True if the tree_parser is NOT VAILD; false if it is vaild. - @author Peter Jones */ bool operator!() const; @@ -119,7 +116,6 @@ generated during parsing. @return The error message generated durring XML parsing. - @author Peter Jones */ const std::string& get_error_message() const; @@ -131,7 +127,6 @@ @return True if there were any warnings. @return False if there were no warnings. - @author Peter Jones */ bool had_warnings() const; @@ -141,7 +136,6 @@ document to avoid a deep copy. @return A reference to the xml::document. - @author Peter Jones */ xml::document& get_document(); @@ -151,7 +145,6 @@ document to avoid a deep copy. @return A const reference to the xml::document. - @author Peter Jones */ const xml::document& get_document() const; Modified: trunk/include/xsltwrapp/init.h =================================================================== --- trunk/include/xsltwrapp/init.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xsltwrapp/init.h 2010-03-09 17:33:58 UTC (rev 172) @@ -71,7 +71,6 @@ true. @param flag True to enable XInclusing processing; False otherwise. - @author Peter Jones */ static void process_xincludes(bool flag); Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/include/xsltwrapp/stylesheet.h 2010-03-09 17:33:58 UTC (rev 172) @@ -68,7 +68,6 @@ stylesheet in the given filename. @param filename The name of the file that contains the stylesheet. - @author Peter Jones */ explicit stylesheet(const char *filename); @@ -79,14 +78,11 @@ document and free it. @param doc The parsed stylesheet. - @author Peter Jones */ explicit stylesheet(xml::document doc); /** Clean up after an xslt::stylesheet. - - @author Peter Jones */ ~stylesheet(); @@ -98,7 +94,6 @@ @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); @@ -111,7 +106,6 @@ @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); @@ -126,7 +120,6 @@ @param doc The XML document to transform. @return A reference to the result tree. - @author Peter Jones */ xml::document& apply(const xml::document& doc); @@ -142,7 +135,6 @@ @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); @@ -157,7 +149,6 @@ constructor. @return The last error message. - @author Peter Jones */ const std::string& get_error_message() const; Modified: trunk/src/libxml/node_manip.h =================================================================== --- trunk/src/libxml/node_manip.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/src/libxml/node_manip.h 2010-03-09 17:33:58 UTC (rev 172) @@ -59,7 +59,6 @@ @param to_add The node to be copied and then inserted into the child list. @return The new node that was inserted into the child list. - @author Peter Jones */ xmlNodePtr node_insert(xmlNodePtr parent, xmlNodePtr before, xmlNodePtr to_add); @@ -74,7 +73,6 @@ @return The new node that was crated from copying @a new_node and inserted into the child list where @a old_node was. - @author Peter Jones */ xmlNodePtr node_replace(xmlNodePtr old_node, xmlNodePtr new_node); @@ -87,7 +85,6 @@ @return The node that was after to_erase (may be 0 (null) if @a to_erase was the last node in the list) - @author Peter Jones */ xmlNodePtr node_erase(xmlNodePtr to_erase); Modified: trunk/src/libxslt/result.h =================================================================== --- trunk/src/libxslt/result.h 2010-03-09 17:07:55 UTC (rev 171) +++ trunk/src/libxslt/result.h 2010-03-09 17:33:58 UTC (rev 172) @@ -62,8 +62,6 @@ 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 { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-03-09 17:08:02
|
Revision: 171 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=171&view=rev Author: vaclavslavik Date: 2010-03-09 17:07:55 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Better reporting of XML output test failures. Show content of both expected and actual XML file output, to make it possible to see what went wrong. Modified Paths: -------------- trunk/tests/test.h Modified: trunk/tests/test.h =================================================================== --- trunk/tests/test.h 2010-02-17 16:15:08 UTC (rev 170) +++ trunk/tests/test.h 2010-03-09 17:07:55 UTC (rev 171) @@ -45,6 +45,8 @@ #include <sstream> #include <cstring> +typedef boost::test_tools::predicate_result predicate_result; + // path to source directory, where test data files are located extern std::string srcdir; @@ -69,25 +71,34 @@ return read_file_into_string(f); } -inline bool is_same_as_file(const std::string& data, const std::string& filename) +inline predicate_result is_same_as_file(const std::string& data, const std::string& filename) { - return data == read_file_into_string(filename); + const std::string filedata = read_file_into_string(filename); + if ( data == filedata ) + return true; + + predicate_result res(false); + res.message() << "Expected output:\n"; + res.message() << filedata; + res.message() << "\nActual output:\n"; + res.message() << data; + return res; } -inline bool is_same_as_file(const std::ostringstream& stream, const std::string& filename) +inline predicate_result is_same_as_file(const std::ostringstream& stream, const std::string& filename) { return is_same_as_file(stream.str(), filename); } -inline bool is_same_as_file(const xml::document& doc, const std::string& filename) +inline predicate_result is_same_as_file(const xml::document& doc, const std::string& filename) { std::string xml; doc.save_to_string(xml); return is_same_as_file(xml, filename); } -inline bool is_same_as_file(const xml::node& node, const std::string& filename) +inline predicate_result is_same_as_file(const xml::node& node, const std::string& filename) { std::ostringstream ostr; ostr << node; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-02-17 16:15:17
|
Revision: 170 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=170&view=rev Author: vaclavslavik Date: 2010-02-17 16:15:08 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Added xml::exception class, derived from std::runtime_error. This makes it possible to distinguish XML exceptions from other runtime errors. xmlwrapp will throw only this or derived exception, with the exception of std::bad_alloc(), which is still thrown when appropriate. Modified Paths: -------------- trunk/NEWS trunk/include/Makefile.am trunk/include/xmlwrapp/tree_parser.h trunk/include/xmlwrapp/xmlwrapp.h trunk/include/xsltwrapp/stylesheet.h trunk/platform/Win32/xmlwrapp.bkl trunk/src/libxml/ait_impl.cxx trunk/src/libxml/document.cxx trunk/src/libxml/node.cxx trunk/src/libxml/node_manip.cxx trunk/src/libxml/tree_parser.cxx trunk/src/libxslt/stylesheet.cxx Added Paths: ----------- trunk/include/xmlwrapp/exception.h Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/NEWS 2010-02-17 16:15:08 UTC (rev 170) @@ -1,4 +1,8 @@ + Added xml::exception class, derived from std::runtime_error. Xmlwrapp + will throw only this or derived exception, with the exception of + std::bad_alloc(), which is still thrown when appropriate. + Fixed compilation with Sun Studio compiler. Version 0.6.2 Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/Makefile.am 2010-02-17 16:15:08 UTC (rev 170) @@ -5,6 +5,7 @@ xmlwrapp/_cbfo.h \ xmlwrapp/document.h \ xmlwrapp/event_parser.h \ + xmlwrapp/exception.h \ xmlwrapp/init.h \ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ Copied: trunk/include/xmlwrapp/exception.h (from rev 169, trunk/include/xmlwrapp/xmlwrapp.h) =================================================================== --- trunk/include/xmlwrapp/exception.h (rev 0) +++ trunk/include/xmlwrapp/exception.h 2010-02-17 16:15:08 UTC (rev 170) @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 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::exception class. + */ + +#ifndef _xmlwrapp_exception_h_ +#define _xmlwrapp_exception_h_ + +#include <stdexcept> +#include <string> + +/// XML library namespace +namespace xml +{ + +/** + This exception class is thrown by xmlwrapp for all runtime XML-related + errors. + + @note C++ runtime may still thrown other errors when used from xmlwrapp. + Also, std::bad_alloc() is thrown in out-of-memory situations. + + @since 0.7.0 + */ +class exception : public std::runtime_error +{ +public: + explicit exception(const std::string& what) : std::runtime_error(what) + { + } +}; + +} // namespace xml + +#endif // _xmlwrapp_exception_h_ Modified: trunk/include/xmlwrapp/tree_parser.h =================================================================== --- trunk/include/xmlwrapp/tree_parser.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xmlwrapp/tree_parser.h 2010-02-17 16:15:08 UTC (rev 170) @@ -74,7 +74,7 @@ constructor will parse that file. There are two options for dealing with XML parsing errors. The - default it to throw an exception (std::runtime_error). The other + default it to throw an exception (xml::exception). The other option is to pass false for the allow_exceptions flag. This will prevent an exception from being thrown, instead, a flag will be set that you can test with the operator! member function. Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xmlwrapp/xmlwrapp.h 2010-02-17 16:15:08 UTC (rev 170) @@ -41,5 +41,6 @@ #include "xmlwrapp/document.h" #include "xmlwrapp/tree_parser.h" #include "xmlwrapp/event_parser.h" +#include "xmlwrapp/exception.h" #endif // _xmlwrapp_xmlwrapp_h_ Modified: trunk/include/xsltwrapp/stylesheet.h =================================================================== --- trunk/include/xsltwrapp/stylesheet.h 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/include/xsltwrapp/stylesheet.h 2010-02-17 16:15:08 UTC (rev 170) @@ -118,7 +118,7 @@ /** 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. + function will throw a xml::exception exception. Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of @@ -133,7 +133,7 @@ /** 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. + function will throw a xml::exception exception. Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of @@ -153,7 +153,7 @@ 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 + the transformation error will be given to the xml::exception constructor. @return The last error message. Modified: trunk/platform/Win32/xmlwrapp.bkl =================================================================== --- trunk/platform/Win32/xmlwrapp.bkl 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/platform/Win32/xmlwrapp.bkl 2010-02-17 16:15:08 UTC (rev 170) @@ -16,6 +16,7 @@ include/xmlwrapp/_cbfo.h include/xmlwrapp/document.h include/xmlwrapp/event_parser.h + include/xmlwrapp/exception.h include/xmlwrapp/init.h include/xmlwrapp/node.h include/xmlwrapp/nodes_view.h Modified: trunk/src/libxml/ait_impl.cxx =================================================================== --- trunk/src/libxml/ait_impl.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/ait_impl.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -34,10 +34,10 @@ #include "ait_impl.h" #include "utility.h" #include "xmlwrapp/attributes.h" +#include "xmlwrapp/exception.h" // standard includes #include <algorithm> -#include <stdexcept> // libxml2 includes #include <libxml/tree.h> @@ -354,7 +354,7 @@ return name_.c_str(); // we were given a name not a node if (!node_ || !prop_) - throw std::runtime_error("access to invalid attributes::attr object!"); + throw xml::exception("access to invalid attributes::attr object!"); return reinterpret_cast<const char*>(static_cast<xmlAttrPtr>(prop_)->name); } @@ -366,7 +366,7 @@ return value_.c_str(); // we were given a value, not a node if (!node_ || !prop_) - throw std::runtime_error("access to invalid attributes::attr object!"); + throw xml::exception("access to invalid attributes::attr object!"); xmlChar *tmpstr = xmlNodeListGetString(reinterpret_cast<xmlNodePtr>(node_)->doc, reinterpret_cast<xmlAttrPtr>(prop_)->children, 1); if (tmpstr == 0) Modified: trunk/src/libxml/document.cxx =================================================================== --- trunk/src/libxml/document.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/document.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -33,6 +33,8 @@ // xmlwrapp includes #include "xmlwrapp/document.h" #include "xmlwrapp/node.h" +#include "xmlwrapp/exception.h" + #include "utility.h" #include "dtd_impl.h" #include "node_manip.h" @@ -367,7 +369,7 @@ void document::push_back(const node& child) { if (child.get_type() == node::type_element) - throw std::runtime_error("xml::document::push_back can't take element type nodes"); + throw xml::exception("xml::document::push_back can't take element type nodes"); impl::node_insert ( @@ -381,7 +383,7 @@ node::iterator document::insert(const node& n) { if (n.get_type() == node::type_element) - throw std::runtime_error("xml::document::insert can't take element type nodes"); + throw xml::exception("xml::document::insert can't take element type nodes"); return node::iterator(xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), 0, static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data()))); } @@ -390,7 +392,7 @@ node::iterator document::insert(node::iterator position, const node& n) { if (n.get_type() == node::type_element) - throw std::runtime_error("xml::document::insert can't take element type nodes"); + throw xml::exception("xml::document::insert can't take element type nodes"); return node::iterator(xml::impl::node_insert(reinterpret_cast<xmlNodePtr>(pimpl_->doc_), static_cast<xmlNodePtr>(position.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(n).get_node_data()))); } @@ -400,7 +402,7 @@ { if (old_node->get_type() == node::type_element || new_node.get_type() == node::type_element) { - throw std::runtime_error("xml::document::replace can't replace element type nodes"); + throw xml::exception("xml::document::replace can't replace element type nodes"); } return node::iterator(xml::impl::node_replace(static_cast<xmlNodePtr>(old_node.get_raw_node()), static_cast<xmlNodePtr>(const_cast<node&>(new_node).get_node_data()))); @@ -410,7 +412,7 @@ node::iterator document::erase(node::iterator to_erase) { if (to_erase->get_type() == node::type_element) - throw std::runtime_error("xml::document::erase can't erase element type nodes"); + throw xml::exception("xml::document::erase can't erase element type nodes"); return node::iterator(xml::impl::node_erase(static_cast<xmlNodePtr>(to_erase.get_raw_node()))); } Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/node.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -35,6 +35,7 @@ #include "xmlwrapp/node.h" #include "xmlwrapp/nodes_view.h" #include "xmlwrapp/attributes.h" +#include "xmlwrapp/exception.h" #include "utility.h" #include "ait_impl.h" #include "node_manip.h" @@ -477,7 +478,7 @@ { if (pimpl_->xmlnode_->type != XML_ELEMENT_NODE) { - throw std::runtime_error("get_attributes called on non-element node"); + throw xml::exception("get_attributes called on non-element node"); } pimpl_->attrs_.set_data(pimpl_->xmlnode_); @@ -489,7 +490,7 @@ { if (pimpl_->xmlnode_->type != XML_ELEMENT_NODE) { - throw std::runtime_error("get_attributes called on non-element node"); + throw xml::exception("get_attributes called on non-element node"); } pimpl_->attrs_.set_data(pimpl_->xmlnode_); Modified: trunk/src/libxml/node_manip.cxx =================================================================== --- trunk/src/libxml/node_manip.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/node_manip.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -31,6 +31,8 @@ */ // xmlwrapp includes +#include "xmlwrapp/exception.h" + #include "node_manip.h" // standard includes @@ -53,7 +55,7 @@ if ( xmlAddChild(parent, new_xml_node) == 0 ) { xmlFreeNode(new_xml_node); - throw std::runtime_error("failed to insert xml::node; xmlAddChild failed"); + throw xml::exception("failed to insert xml::node; xmlAddChild failed"); } } else @@ -61,7 +63,7 @@ if ( xmlAddPrevSibling(before, new_xml_node) == 0 ) { xmlFreeNode(new_xml_node); - throw std::runtime_error("failed to insert xml::node; xmlAddPrevSibling failed"); + throw xml::exception("failed to insert xml::node; xmlAddPrevSibling failed"); } } @@ -83,7 +85,7 @@ if ( copied_node->doc == reinterpret_cast<xmlDocPtr>(old_node) ) { xmlFreeNode(copied_node); - throw std::runtime_error("failed to replace xml::node; xmlReplaceNode() failed"); + throw xml::exception("failed to replace xml::node; xmlReplaceNode() failed"); } xmlFreeNode(old_node); Modified: trunk/src/libxml/tree_parser.cxx =================================================================== --- trunk/src/libxml/tree_parser.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxml/tree_parser.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -33,6 +33,7 @@ // xmlwrapp includes #include "xmlwrapp/tree_parser.h" #include "xmlwrapp/document.h" +#include "xmlwrapp/exception.h" #include "utility.h" // libxml includes @@ -160,7 +161,7 @@ xmlFreeDoc(tmpdoc); if (allow_exceptions) - throw std::runtime_error(pimpl_->last_error_); + throw xml::exception(pimpl_->last_error_); } ap.release(); @@ -194,7 +195,7 @@ pimpl_->okay_ = false; if (allow_exceptions) - throw std::runtime_error(pimpl_->last_error_); + throw xml::exception(pimpl_->last_error_); ap.release(); return; // handle non-exception case Modified: trunk/src/libxslt/stylesheet.cxx =================================================================== --- trunk/src/libxslt/stylesheet.cxx 2010-02-17 16:12:14 UTC (rev 169) +++ trunk/src/libxslt/stylesheet.cxx 2010-02-17 16:15:08 UTC (rev 170) @@ -40,6 +40,7 @@ #include "xsltwrapp/stylesheet.h" #include "xmlwrapp/document.h" #include "xmlwrapp/tree_parser.h" +#include "xmlwrapp/exception.h" #include "result.h" #include "../libxml/utility.h" @@ -51,7 +52,6 @@ #include <libxslt/xsltutils.h> // standard includes -#include <stdexcept> #include <memory> #include <string> #include <vector> @@ -207,7 +207,7 @@ // 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_); + throw xml::exception(pimpl_->error_); } // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is @@ -227,7 +227,7 @@ // 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_); + throw xml::exception(pimpl_->error_); } // if we got this far, the xmldoc we gave to xsltParseStylesheetDoc is @@ -282,7 +282,7 @@ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input); if ( !xmldoc ) - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_)); return pimpl_->doc_; @@ -296,7 +296,7 @@ xmlDocPtr xmldoc = apply_stylesheet(pimpl_, input, &with_params); if ( !xmldoc ) - throw std::runtime_error(pimpl_->error_); + throw xml::exception(pimpl_->error_); pimpl_->doc_.set_doc_data_from_xslt(xmldoc, new result_impl(xmldoc, pimpl_->ss_)); return pimpl_->doc_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-02-17 16:12:25
|
Revision: 169 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=169&view=rev Author: vaclavslavik Date: 2010-02-17 16:12:14 +0000 (Wed, 17 Feb 2010) Log Message: ----------- Updated copyright information. Modified Paths: -------------- trunk/LICENSE Modified: trunk/LICENSE =================================================================== --- trunk/LICENSE 2010-02-11 23:13:26 UTC (rev 168) +++ trunk/LICENSE 2010-02-17 16:12:14 UTC (rev 169) @@ -1,4 +1,5 @@ -Copyright (C) 2001-2003 Peter J Jones (pj...@pm...) +Copyright (C) 2001-2003 Peter J Jones <pj...@pm...> +Copyright (C) 2009-2010 Vaclav Slavik <vs...@fa...> All Rights Reserved Redistribution and use in source and binary forms, with or without This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2010-02-11 23:13:33
|
Revision: 168 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=168&view=rev Author: vaclavslavik Date: 2010-02-11 23:13:26 +0000 (Thu, 11 Feb 2010) Log Message: ----------- Fix compilation with Sun Studio. When not using -library=stlport4 option, the ancient standard library doesn't conform to the standard. In particular, it doesn't provide std::distance() with correct signature. Work around this by implementing it ourselves. Modified Paths: -------------- trunk/NEWS trunk/src/libxml/document.cxx trunk/src/libxml/node.cxx trunk/src/libxml/utility.h trunk/tests/document/test_document.cxx Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/NEWS 2010-02-11 23:13:26 UTC (rev 168) @@ -1,4 +1,6 @@ + Fixed compilation with Sun Studio compiler. + Version 0.6.2 Fixed xml::tree_parser to fail on non-fatal parser errors. Modified: trunk/src/libxml/document.cxx =================================================================== --- trunk/src/libxml/document.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/document.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -335,7 +335,8 @@ document::size_type document::size() const { - return std::distance(begin(), end()); + using namespace std; + return distance(begin(), end()); } Modified: trunk/src/libxml/node.cxx =================================================================== --- trunk/src/libxml/node.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/node.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -519,7 +519,8 @@ node::size_type node::size() const { - return std::distance(begin(), end()); + using namespace std; + return distance(begin(), end()); } Modified: trunk/src/libxml/utility.h =================================================================== --- trunk/src/libxml/utility.h 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/src/libxml/utility.h 2010-02-11 23:13:26 UTC (rev 168) @@ -33,6 +33,8 @@ #ifndef _xmlwrapp_utility_h_ #define _xmlwrapp_utility_h_ +#include <xmlwrapp/node.h> + // standard includes #include <string> #include <cstdarg> @@ -65,8 +67,21 @@ void printf2string(std::string& s, const char *message, va_list ap); +// Sun CC uses ancient C++ standard library that doesn't have standard +// std::distance(). Work around it here +#if defined(__SUNPRO_CC) && !defined(_STLPORT_VERSION) +inline size_t distance(xml::node::const_iterator a, xml::node::const_iterator b) +{ + size_t n = 0; + for ( ; a != b; ++a ) + ++n; + return n; +} +#endif // defined(__SUNPRO_CC) && !defined(_STLPORT_VERSION) + } // namespace impl } // namespace xml + #endif // _xmlwrapp_utility_h_ Modified: trunk/tests/document/test_document.cxx =================================================================== --- trunk/tests/document/test_document.cxx 2010-02-11 23:12:20 UTC (rev 167) +++ trunk/tests/document/test_document.cxx 2010-02-11 23:13:26 UTC (rev 168) @@ -413,6 +413,7 @@ } +#ifndef __SUNPRO_CC // SunCC can't compile gzip_decompressor BOOST_AUTO_TEST_CASE( save_to_file_gzip ) { xml::document doc("root"); @@ -432,6 +433,7 @@ remove(TEST_FILE); } +#endif // !__SUNPRO_CC 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...> - 2010-02-11 23:12:27
|
Revision: 167 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=167&view=rev Author: vaclavslavik Date: 2010-02-11 23:12:20 +0000 (Thu, 11 Feb 2010) Log Message: ----------- Compilation fix for SunCC with STLport. std::runtime_error() ctor takes std::string argument, so we have to include <string> here even though std::string isn't explicitly used. Modified Paths: -------------- trunk/src/libxml/node_manip.cxx Modified: trunk/src/libxml/node_manip.cxx =================================================================== --- trunk/src/libxml/node_manip.cxx 2009-12-29 13:45:21 UTC (rev 166) +++ trunk/src/libxml/node_manip.cxx 2010-02-11 23:12:20 UTC (rev 167) @@ -35,6 +35,7 @@ // standard includes #include <stdexcept> +#include <string> // 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: <va...@us...> - 2009-12-29 13:45:27
|
Revision: 166 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=166&view=rev Author: vadz Date: 2009-12-29 13:45:21 +0000 (Tue, 29 Dec 2009) Log Message: ----------- Suppress VC8+ warnings about vsnprintf() by defining _CRT_SECURE_NO_WARNINGS Modified Paths: -------------- trunk/src/libxml/utility.cxx Modified: trunk/src/libxml/utility.cxx =================================================================== --- trunk/src/libxml/utility.cxx 2009-12-20 12:51:39 UTC (rev 165) +++ trunk/src/libxml/utility.cxx 2009-12-29 13:45:21 UTC (rev 166) @@ -30,6 +30,15 @@ * SUCH DAMAGE. */ +#ifdef _MSC_VER + // using vsnprintf() under MSVC 2005 or later results in a warning C4996 + // because the function may be used in unsafe ways -- as we do use it + // correctly here, disable the warning by predefining this symbol before + // any standard headers are included (we don't bother to test MSVC version + // here as defining it does no harm for the previous versions anyhow) + #define _CRT_SECURE_NO_WARNINGS +#endif + #include "utility.h" #include <cstdarg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-12-20 12:51:48
|
Revision: 165 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=165&view=rev Author: vaclavslavik Date: 2009-12-20 12:51:39 +0000 (Sun, 20 Dec 2009) Log Message: ----------- tagged 0.6.2 release Added Paths: ----------- tags/release-0.6.2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-12-20 12:48:50
|
Revision: 164 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=164&view=rev Author: vaclavslavik Date: 2009-12-20 12:48:18 +0000 (Sun, 20 Dec 2009) Log Message: ----------- Increased version number to 0.6.2. Modified Paths: -------------- trunk/NEWS trunk/configure.ac Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-12-20 12:47:30 UTC (rev 163) +++ trunk/NEWS 2009-12-20 12:48:18 UTC (rev 164) @@ -1,4 +1,6 @@ +Version 0.6.2 + Fixed xml::tree_parser to fail on non-fatal parser errors. Added XMLWRAPP_CHECK_VERSION macro. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-12-20 12:47:30 UTC (rev 163) +++ trunk/configure.ac 2009-12-20 12:48:18 UTC (rev 164) @@ -36,7 +36,7 @@ AC_REVISION($Id$)dnl AC_PREREQ(2.61) -AC_INIT(xmlwrapp, 0.6.1, [xml...@li...]) +AC_INIT(xmlwrapp, 0.6.2, [xml...@li...]) AC_CONFIG_SRCDIR([xmlwrapp.pc.in]) AC_CONFIG_AUX_DIR([admin]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-12-20 12:47:37
|
Revision: 163 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=163&view=rev Author: vaclavslavik Date: 2009-12-20 12:47:30 +0000 (Sun, 20 Dec 2009) Log Message: ----------- Added XMLWRAPP_CHECK_VERSION macro. Modified Paths: -------------- trunk/NEWS trunk/include/Makefile.am trunk/include/xmlwrapp/xmlwrapp.h Added Paths: ----------- trunk/include/xmlwrapp/version.h Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/NEWS 2009-12-20 12:47:30 UTC (rev 163) @@ -1,6 +1,8 @@ Fixed xml::tree_parser to fail on non-fatal parser errors. + Added XMLWRAPP_CHECK_VERSION macro. + Version 0.6.1 Added Visual C++ 200x projects and fixed VC6 project. Modified: trunk/include/Makefile.am =================================================================== --- trunk/include/Makefile.am 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/include/Makefile.am 2009-12-20 12:47:30 UTC (rev 163) @@ -9,6 +9,7 @@ xmlwrapp/node.h \ xmlwrapp/nodes_view.h \ xmlwrapp/tree_parser.h \ + xmlwrapp/version.h \ xmlwrapp/xmlwrapp.h if WITH_XSLT Added: trunk/include/xmlwrapp/version.h =================================================================== --- trunk/include/xmlwrapp/version.h (rev 0) +++ trunk/include/xmlwrapp/version.h 2009-12-20 12:47:30 UTC (rev 163) @@ -0,0 +1,61 @@ +/* + * 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 XMLWRAPP_CHECK_VERSION macro. + */ + +#ifndef _xmlwrapp_version_h_ +#define _xmlwrapp_version_h_ + +#define XMLWRAPP_VERSION_MAJOR 0 +#define XMLWRAPP_VERSION_MINOR 6 +#define XMLWRAPP_VERSION_MICRO 2 + +/** + Checks if xmlwrapp version is at least @a major.@a minor.@a micro. + */ +#define XMLWRAPP_CHECK_VERSION(major, minor, micro) \ + ( \ + XMLWRAPP_VERSION_MAJOR > (major) \ + || \ + (XMLWRAPP_VERSION_MAJOR == (major) && \ + XMLWRAPP_VERSION_MINOR >= (minor)) \ + || \ + (XMLWRAPP_VERSION_MAJOR == (major) && \ + (XMLWRAPP_VERSION_MINOR == (minor) && \ + XMLWRAPP_VERSION_MICRO >= (micro)) \ + ) + +#endif // _xmlwrapp_version_h_ Modified: trunk/include/xmlwrapp/xmlwrapp.h =================================================================== --- trunk/include/xmlwrapp/xmlwrapp.h 2009-12-20 11:28:20 UTC (rev 162) +++ trunk/include/xmlwrapp/xmlwrapp.h 2009-12-20 12:47:30 UTC (rev 163) @@ -33,6 +33,7 @@ #ifndef _xmlwrapp_xmlwrapp_h_ #define _xmlwrapp_xmlwrapp_h_ +#include "xmlwrapp/version.h" #include "xmlwrapp/init.h" #include "xmlwrapp/nodes_view.h" #include "xmlwrapp/node.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-12-20 11:28:28
|
Revision: 162 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=162&view=rev Author: vaclavslavik Date: 2009-12-20 11:28:20 +0000 (Sun, 20 Dec 2009) Log Message: ----------- Reformatted source code for better readibility. Modified Paths: -------------- trunk/include/xmlwrapp/_cbfo.h trunk/include/xmlwrapp/attributes.h trunk/include/xmlwrapp/document.h trunk/include/xmlwrapp/event_parser.h trunk/include/xmlwrapp/init.h trunk/include/xmlwrapp/node.h trunk/include/xmlwrapp/nodes_view.h trunk/include/xmlwrapp/tree_parser.h trunk/include/xmlwrapp/xmlwrapp.h trunk/include/xsltwrapp/xsltwrapp.h trunk/src/libxml/ait_impl.cxx trunk/src/libxml/ait_impl.h trunk/src/libxml/attributes.cxx trunk/src/libxml/document.cxx trunk/src/libxml/dtd_impl.cxx trunk/src/libxml/dtd_impl.h trunk/src/libxml/event_parser.cxx trunk/src/libxml/init.cxx trunk/src/libxml/node.cxx trunk/src/libxml/node_iterator.cxx trunk/src/libxml/node_iterator.h trunk/src/libxml/node_manip.cxx trunk/src/libxml/node_manip.h trunk/src/libxml/nodes_view.cxx trunk/src/libxml/tree_parser.cxx trunk/src/libxml/utility.cxx trunk/src/libxml/utility.h Modified: trunk/include/xmlwrapp/_cbfo.h =================================================================== --- trunk/include/xmlwrapp/_cbfo.h 2009-11-26 14:30:19 UTC (rev 161) +++ trunk/include/xmlwrapp/_cbfo.h 2009-12-20 11:28:20 UTC (rev 162) @@ -35,27 +35,35 @@ #include <functional> -namespace xml { +namespace xml +{ class node; -namespace impl { +namespace impl +{ - struct cbfo_node_compare : public std::binary_function<xml::node, xml::node, bool> { - virtual ~cbfo_node_compare (void) { } - virtual bool operator() (const xml::node &lhs, const xml::node &rhs) = 0; + // helper for xml::node::sort() + struct cbfo_node_compare + : public std::binary_function<xml::node, xml::node, bool> + { + virtual ~cbfo_node_compare() {} + virtual bool operator()(const xml::node& lhs, const xml::node& rhs) = 0; }; - template <typename T> struct sort_callback : public cbfo_node_compare { - sort_callback (T &t) : t_(t) { } + template<typename T> + struct sort_callback : public cbfo_node_compare + { + sort_callback(T& t) : t_(t) {} - bool operator() (const xml::node &lhs, const xml::node &rhs) - { return t_(lhs, rhs); } + bool operator()(const xml::node& lhs, const xml::node& rhs) + { return t_(lhs, rhs); } - T &t_; + T &t_; }; } // namespace impl } // namespace xml -#endif + +#endif // _xmlwrapp_cbfo_h_ Modified: trunk/include/xmlwrapp/attributes.h =================================================================== --- trunk/include/xmlwrapp/attributes.h 2009-11-26 14:30:19 UTC (rev 161) +++ trunk/include/xmlwrapp/attributes.h 2009-12-20 11:28:20 UTC (rev 162) @@ -30,10 +30,12 @@ * SUCH DAMAGE. */ -/** @file - * This file contains the definition of the xml::attributes class. -**/ +/** + @file + This file contains the definition of the xml::attributes class. + */ + #ifndef _xmlwrapp_attributes_h_ #define _xmlwrapp_attributes_h_ @@ -45,334 +47,308 @@ #include <iosfwd> #include <string> -namespace xml { - +namespace xml +{ + // forward declarations class node; -namespace impl { +namespace impl +{ class ait_impl; struct node_impl; } /** - * The xml::attributes class is used to access all the attributes of one - * xml::node. You can add, find and erase attributes by name, and for some - * member functions, use the provided iterator classes. - * - * The iterator classes allow you to access one XML attribute. This is done - * using the xml::attributes::attr class interface. -**/ -class attributes { + The xml::attributes class is used to access all the attributes of one + xml::node. You can add, find and erase attributes by name, and for some + member functions, use the provided iterator classes. + + The iterator classes allow you to access one XML attribute. This is done + using the xml::attributes::attr class interface. + */ +class attributes +{ public: - typedef std::size_t size_type; ///< size type + /// size type + typedef std::size_t size_type; - //#################################################################### - /** - * Create a new xml::attributes object with no attributes. - * - * @author Peter Jones - **/ - //#################################################################### - attributes (void); + /** + Create a new xml::attributes object with no attributes. - //#################################################################### - /** - * Copy construct a xml::attributes object. - * - * @param other The xml::attributes object to copy from. - * @author Peter Jones - **/ - //#################################################################### - attributes (const attributes &other); + @author Peter Jones + */ + attributes(); - //#################################################################### - /** - * Copy the given xml::attributes object into this one. - * - * @param other The xml::attributes object to copy from. - * @return *this. - * @author Peter Jones - **/ - //#################################################################### - attributes& operator= (const attributes &other); + /** + Copy construct a xml::attributes object. - //#################################################################### - /** - * Swap this xml::attributes object with another one. - * - * @param other The other xml::attributes object to swap with. - * @author Peter Jones - **/ - //#################################################################### - void swap (attributes &other); + @param other The xml::attributes object to copy from. + @author Peter Jones + */ + attributes(const attributes& other); - //#################################################################### - /** - * Clean up after a xml::attributes object. - * - * @author Peter Jones - **/ - //#################################################################### - ~attributes (void); + /** + Copy the given xml::attributes object into this one. + @param other The xml::attributes object to copy from. + @return this. + @author Peter Jones + */ + attributes& operator=(const attributes& other); + + /** + Swap this xml::attributes object with another one. + + @param other The other xml::attributes object to swap with. + @author Peter Jones + */ + void swap(attributes& other); + + ~attributes(); + // forward declarations class const_iterator; /** - * The xml::attributes::attr class is used to hold information about one - * attribute. + The xml::attributes::attr class is used to hold information about one + attribute. */ - class attr { + class attr + { public: - //#################################################################### - /** - * Get the name of this attribute. - * - * @return The name for this attribute. - * @author Peter Jones - **/ - //#################################################################### - const char* get_name (void) const; + /** + Get the name of this attribute. - //#################################################################### - /** - * Get the value of this attribute. - * - * @return The value for this attribute. - * @author Peter Jones - **/ - //#################################################################### - const char* get_value (void) const; + @return The name for this attribute. + @author Peter Jones + */ + const char *get_name() const; + + /** + Get the value of this attribute. + + @return The value for this attribute. + @author Peter Jones + */ + const char* get_value() const; + private: - void *node_; - void *prop_; - std::string name_; - mutable std::string value_; + void *node_; + void *prop_; + std::string name_; + mutable std::string value_; - attr (void); - attr (const attr &other); - attr& operator= (const attr &other); - void swap (attr &other); + attr(); + attr(const attr& other); + attr& operator=(const attr& other); + void swap(attr& other); - void set_data (void *node, void *prop); - void set_data (const char *name, const char *value, bool); - friend class impl::ait_impl; - }; // end xml::attributes::attr class + void set_data(void *node, void *prop); + void set_data(const char *name, const char *value, bool); + friend class impl::ait_impl; + }; + /** - * Iterator class for accessing attribute pairs. + Iterator class for accessing attribute pairs. */ - class iterator { + class iterator + { public: - typedef attr value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef std::forward_iterator_tag iterator_category; + typedef attr value_type; + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::forward_iterator_tag iterator_category; - iterator (void); - iterator (const iterator &other); - iterator& operator= (const iterator& other); - ~iterator (void); + iterator(); + iterator(const iterator& other); + iterator& operator=(const iterator& other); + ~iterator(); - reference operator* (void) const; - pointer operator-> (void) const; + reference operator*() const; + pointer operator->() const; - /// prefix increment - iterator& operator++ (void); + /// prefix increment + iterator& operator++(); - /// postfix increment (avoid if possible for better performance) - iterator operator++ (int); + /// 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); + friend bool operator==(const iterator& lhs, const iterator& rhs); + friend bool operator!=(const iterator& lhs, const iterator& rhs); + private: - impl::ait_impl *pimpl_; - iterator (void *node, void *prop); - iterator (const char *name, const char *value, bool); - void swap (iterator &other); - void* get_raw_attr (void); - friend class attributes; - friend class const_iterator; - }; // end xml::attributes::iterator class + impl::ait_impl *pimpl_; + iterator(void *node, void *prop); + iterator(const char *name, const char *value, bool); + void swap(iterator& other); + void* get_raw_attr(); + + friend class attributes; + friend class const_iterator; + }; + /** - * Const Iterator class for accessing attribute pairs. + Const Iterator class for accessing attribute pairs. */ - class const_iterator { + class const_iterator + { public: - typedef const attr value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type* pointer; - typedef value_type& reference; - typedef std::forward_iterator_tag iterator_category; + typedef const attr value_type; + typedef std::ptrdiff_t difference_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::forward_iterator_tag iterator_category; - const_iterator (void); - const_iterator (const const_iterator &other); - const_iterator (const iterator &other); - const_iterator& operator= (const const_iterator& other); - ~const_iterator (void); + const_iterator(); + const_iterator(const const_iterator& other); + const_iterator(const iterator& other); + const_iterator& operator=(const const_iterator& other); + ~const_iterator(); - reference operator* (void) const; - pointer operator-> (void) const; + reference operator*() const; + pointer operator->() const; - /// prefix increment - const_iterator& operator++ (void); + /// prefix increment + const_iterator& operator++(); - /// postfix increment (avoid if possible better for performance) - const_iterator operator++ (int); + /// postfix increment (avoid if possible better for 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); + friend bool operator== (const const_iterator &lhs, const const_iterator &rhs); + friend bool operator!= (const const_iterator &lhs, const const_iterator &rhs); + private: - impl::ait_impl *pimpl_; - const_iterator (void *node, void *prop); - const_iterator (const char *name, const char *value, bool); - void swap (const_iterator &other); - void* get_raw_attr (void); - friend class attributes; - }; // end xml::attributes::const_iterator class + impl::ait_impl *pimpl_; - //#################################################################### - /** - * Get an iterator that points to the first attribute. - * - * @return An iterator that points to the first attribute. - * @return An iterator equal to end() if there are no attributes. - * @see xml::attributes::iterator - * @see xml::attributes::attr - * @author Peter Jones - **/ - //#################################################################### - iterator begin (void); + const_iterator(void *node, void *prop); + const_iterator(const char *name, const char *value, bool); + void swap(const_iterator &other); + void* get_raw_attr(); - //#################################################################### - /** - * Get a const_iterator that points to the first attribute. - * - * @return A const_iterator that points to the first attribute. - * @return A const_iterator equal to end() if there are no attributes. - * @see xml::attributes::const_iterator - * @see xml::attributes::attr - * @author Peter Jones - **/ - //#################################################################### - const_iterator begin (void) const; + friend class attributes; + }; - //#################################################################### - /** - * Get an iterator that points one past the the last attribute. - * - * @return An "end" iterator. - * @author Peter Jones - **/ - //#################################################################### - iterator end (void); + /** + Get an iterator that points to the first attribute. - //#################################################################### - /** - * Get a const_iterator that points one past the last attribute. - * - * @return An "end" const_iterator. - * @author Peter Jones - **/ - //#################################################################### - const_iterator end (void) const; + @return An iterator that points to the first attribute. + @return An iterator equal to end() if there are no attributes. + @see xml::attributes::iterator + @see xml::attributes::attr + @author Peter Jones + */ + iterator begin(); - //#################################################################### - /** - * Add an attribute to the attributes list. If there is another - * attribute with the same name, it will be replaced with this one. - * - * @param name The name of the attribute to add. - * @param value The value of the attribute to add. - * @author Peter Jones - **/ - //#################################################################### - void insert (const char *name, const char *value); + /** + Get a const_iterator that points to the first attribute. - //#################################################################### - /** - * Find the attribute with the given name. If the attribute is not found - * on the current node, the DTD will be searched for a default value. - * This is, of course, if there was a DTD parsed with the XML document. - * - * @param name The name of the attribute to find. - * @return An iterator that points to the attribute with the given name. - * @return If the attribute was not found, find will return end(). - * @see xml::attributes::iterator - * @see xml::attributes::attr - * @author Peter Jones - **/ - //#################################################################### - iterator find (const char *name); + @return A const_iterator that points to the first attribute. + @return A const_iterator equal to end() if there are no attributes. + @see xml::attributes::const_iterator + @see xml::attributes::attr + @author Peter Jones + */ + const_iterator begin() const; - //#################################################################### - /** - * Find the attribute with the given name. If the attribute is not found - * on the current node, the DTD will be searched for a default value. - * This is, of course, if there was a DTD parsed with the XML document. - * - * @param name The name of the attribute to find. - * @return A const_iterator that points to the attribute with the given name. - * @return If the attribute was not found, find will return end(). - * @see xml::attributes::const_iterator - * @see xml::attributes::attr - * @author Peter Jones - **/ - //#################################################################### - const_iterator find (const char *name) const; + /** + Get an iterator that points one past the the last attribute. - //#################################################################### - /** - * Erase the attribute that is pointed to by the given iterator. This - * will invalidate any iterators for this attribute, as well as any - * pointers or references to it. - * - * @param to_erase An iterator that points to the attribute to erased. - * @return An iterator that points to the attribute after the one to be erased. - * @see xml::attributes::iterator - * @see xml::attributes::attr - * @author Peter Jones - **/ - //#################################################################### - iterator erase (iterator to_erase); + @return An "end" iterator. + @author Peter Jones + */ + iterator end(); - //#################################################################### - /** - * Erase the attribute with the given name. This will invalidate any - * iterators that are pointing to that attribute, as well as any - * pointers or references to that attribute. - * - * @param name The name of the attribute to erase. - * @author Peter Jones - **/ - //#################################################################### - void erase (const char *name); + /** + Get a const_iterator that points one past the last attribute. - //#################################################################### - /** - * Find out if there are any attributes in this xml::attributes object. - * - * @return True if there are no attributes. - * @return False if there is at least one attribute. - * @author Peter Jones - **/ - //#################################################################### - bool empty (void) const; + @return An "end" const_iterator. + @author Peter Jones + */ + const_iterator end() const; - //#################################################################### - /** - * Find out how many attributes there are in this xml::attributes - * object. - * - * @return The number of attributes in this xml::attributes object. - * @author Peter Jones - **/ - //#################################################################### - size_type size (void) const; + /** + Add an attribute to the attributes list. If there is another + attribute with the same name, it will be replaced with this one. + @param name The name of the attribute to add. + @param value The value of the attribute to add. + @author Peter Jones + */ + void insert(const char *name, const char *value); + + /** + Find the attribute with the given name. If the attribute is not found + on the current node, the DTD will be searched for a default value. + This is, of course, if there was a DTD parsed with the XML document. + + @param name The name of the attribute to find. + @return An iterator that points to the attribute with the given name. + @return If the attribute was not found, find will return end(). + @see xml::attributes::iterator + @see xml::attributes::attr + @author Peter Jones + */ + iterator find(const char *name); + + /** + Find the attribute with the given name. If the attribute is not found + on the current node, the DTD will be searched for a default value. + This is, of course, if there was a DTD parsed with the XML document. + + @param name The name of the attribute to find. + @return A const_iterator that points to the attribute with the given name. + @return If the attribute was not found, find will return end(). + @see xml::attributes::const_iterator + @see xml::attributes::attr + @author Peter Jones + */ + const_iterator find(const char *name) const; + + /** + Erase the attribute that is pointed to by the given iterator. This + will invalidate any iterators for this attribute, as well as any + pointers or references to it. + + @param to_erase An iterator that points to the attribute to erased. + @return An iterator that points to the attribute after the one to be erased. + @see xml::attributes::iterator + @see xml::attributes::attr + @author Peter Jones + */ + iterator erase(iterator to_erase); + + /** + Erase the attribute with the given name. This will invalidate any + iterators that are pointing to that attribute, as well as any + pointers or references to that attribute. + + @param name The name of the attribute to erase. + @author Peter Jones + */ + void erase(const char *name); + + /** + Find out if there are any attributes in this xml::attributes object. + + @return True if there are no attributes. + @return False if there is at least one attribute. + @author Peter Jones + */ + bool empty() const; + + /** + Find out how many attributes there are in this xml::attributes + object. + + @return The number of attributes in this xml::attributes object. + @author Peter Jones + */ + size_type size() const; + private: struct pimpl; pimpl *pimpl_; @@ -380,10 +356,11 @@ explicit attributes (int); void set_data (void *node); - void* get_data (void); + void* get_data(); friend struct impl::node_impl; friend class node; -}; // end xml::attributes class - -} // end xml namespace -#endif +}; + +} // namespace xml + +#endif // _xmlwrapp_attributes_h_ Modified: trunk/include/xmlwrapp/document.h =================================================================== --- trunk/include/xmlwrapp/document.h 2009-11-26 14:30:19 UTC (rev 161) +++ trunk/include/xmlwrapp/document.h 2009-12-20 11:28:20 UTC (rev 162) @@ -30,10 +30,12 @@ * SUCH DAMAGE. */ -/** @file - * This file contains the definition of the xml::document class. -**/ +/** + @file + This file contains the definition of the xml::document class. + */ + #ifndef _xmlwrapp_document_h_ #define _xmlwrapp_document_h_ @@ -47,508 +49,448 @@ #include <cstddef> // forward declaration -namespace xslt { - class stylesheet; - namespace impl { - class result; - } +namespace xslt +{ + +class stylesheet; +namespace impl +{ +class result; +} + } // end xslt namespace -namespace xml { +namespace xml +{ // forward declarations class tree_parser; -namespace impl { +namespace impl +{ struct doc_impl; } /** - * The xml::document class is used to hold the XML tree and various bits of - * information about it. -**/ -class document { + The xml::document class is used to hold the XML tree and various bits of + information about it. + */ +class document +{ public: /// size type typedef std::size_t size_type; - //#################################################################### - /** - * Create a new XML document with the default settings. The new document - * will contain a root node with a name of "blank". - * - * @author Peter Jones - **/ - //#################################################################### - document (void); + /** + Create a new XML document with the default settings. The new document + will contain a root node with a name of "blank". - //#################################################################### - /** - * Create a new XML document and set the name of the root element to the - * given text. - * - * @param root_name What to set the name of the root element to. - * @author Peter Jones - **/ - //#################################################################### - explicit document (const char *root_name); + @author Peter Jones + */ + document(); - //#################################################################### - /** - * Create a new XML document and set the root node. - * - * @param n The node to use as the root node. n will be copied. - * @author Peter Jones - **/ - //#################################################################### - explicit document (const node &n); + /** + Create a new XML document and set the name of the root element to the + given text. - //#################################################################### - /** - * Copy construct a new XML document. The new document will be an exact - * copy of the original. - * - * @param other The other document object to copy from. - * @author Peter Jones - **/ - //#################################################################### - document (const document &other); + @param root_name What to set the name of the root element to. + @author Peter Jones + */ + explicit document(const char *root_name); - //#################################################################### - /** - * Copy another document object into this one using the assignment - * operator. This document object will be an exact copy of the other - * document after the assignement. - * - * @param other The document to copy from. - * @return *this. - * @author Peter Jones - **/ - //#################################################################### - document& operator= (const document &other); + /** + Create a new XML document and set the root node. - //#################################################################### - /** - * Swap one xml::document object for another. - * - * @param other The other document to swap - * @author Peter Jones - **/ - //#################################################################### - void swap (document &other); + @param n The node to use as the root node. n will be copied. + @author Peter Jones + */ + explicit document(const node& n); - //#################################################################### - /** - * Clean up after an XML document object. - * - * @author Peter Jones - **/ - //#################################################################### - ~document (void); + /** + Copy construct a new XML document. The new document will be an exact + copy of the original. - //#################################################################### - /** - * Get a reference to the root node of this document. If no root node - * has been set, the returned node will be a blank node. You should take - * caution to use a reference so that you don't copy the whole node - * tree! - * - * @return A const reference to the root node. - * @author Peter Jones - **/ - //#################################################################### - const node& get_root_node (void) const; + @param other The other document object to copy from. + @author Peter Jones + */ + document(const document& other); - //#################################################################### - /** - * Get a reference to the root node of this document. If no root node - * has been set, the returned node will be a blank node. You should take - * caution to use a reference so that you don't copy the whole node - * tree! - * - * @return A reference to the root node. - * @author Peter Jones - **/ - //#################################################################### - node& get_root_node (void); + /** + Copy another document object into this one using the assignment + operator. This document object will be an exact copy of the other + document after the assignement. - //#################################################################### - /** - * Set the root node to the given node. A full copy is made and stored - * in the document object. - * - * @param n The new root node to use. - * @author Peter Jones - **/ - //#################################################################### - void set_root_node (const node &n); + @param other The document to copy from. + @return *this. + @author Peter Jones + */ + document& operator=(const document& other); - //#################################################################### - /** - * Get the XML version for this document. For generated documents, the - * version will be the default. For parsed documents, this will be the - * version from the XML processing instruction. - * - * @return The XML version string for this document. - * @author Peter Jones - **/ - //#################################################################### - const std::string& get_version (void) const; + /** + Swap one xml::document object for another. - //#################################################################### - /** - * Set the XML version number for this document. This version string - * will be used when generating the XML output. - * - * @param version The version string to use, like "1.0". - * @author Peter Jones - **/ - //#################################################################### - void set_version (const char *version); + @param other The other document to swap + @author Peter Jones + */ + void swap(document& other); - //#################################################################### - /** - * Get the XML encoding for this document. The default encoding is - * ISO-8859-1. - * - * @return The encoding string. - * @author Peter Jones - **/ - //#################################################################### - const std::string& get_encoding (void) const; + /** + Clean up after an XML document object. - //#################################################################### - /** - * Set the XML encoding string. If you don't set this, it will default - * to ISO-8859-1. - * - * @param encoding The XML encoding to use. - * @author Peter Jones - * @author Dmitriy Nikitinskiy - **/ - //#################################################################### - void set_encoding (const char *encoding); + @author Peter Jones + */ + ~document(); - //#################################################################### - /** - * Find out if the current document is a standalone document. For - * generated documents, this will be the default. For parsed documents - * this will be set based on the XML processing instruction. - * - * @return True if this document is standalone. - * @return False if this document is not standalone. - * @author Peter Jones - **/ - //#################################################################### - bool get_is_standalone (void) const; + /** + Get a reference to the root node of this document. If no root node + has been set, the returned node will be a blank node. You should take + caution to use a reference so that you don't copy the whole node + tree! - //#################################################################### - /** - * Set the standalone flag. This will show up in the XML output in the - * correct processing instruction. - * - * @param sa What to set the standalone flag to. - * @author Peter Jones - **/ - //#################################################################### - void set_is_standalone (bool sa); + @return A const reference to the root node. + @author Peter Jones + */ + const node& get_root_node() const; - //#################################################################### - /** - * Walk through the document and expand <xi:include> elements. For more - * information, please see the w3c recomendation for XInclude. - * http://www.w3.org/2001/XInclude. - * - * The return value of this function may change to int after a bug has - * been fixed in libxml2 (xmlXIncludeDoProcess). - * - * @return False if there was an error with substitutions. - * @return True if there were no errors (with or without substitutions). - * @author Peter Jones - * @author Daniel Evison - **/ - //#################################################################### - bool process_xinclude (void); + /** + Get a reference to the root node of this document. If no root node + has been set, the returned node will be a blank node. You should take + caution to use a reference so that you don't copy the whole node + tree! - //#################################################################### - /** - * Test to see if this document has an internal subset. That is, DTD - * data that is declared within the XML document itself. - * - * @return True if this document has an internal subset. - * @return False otherwise. - * @author Peter Jones - **/ - //#################################################################### - bool has_internal_subset (void) const; + @return A reference to the root node. + @author Peter Jones + */ + node& get_root_node(); - //#################################################################### - /** - * Test to see if this document has an external subset. That is, it - * references a DTD from an external source, such as a file or URL. - * - * @return True if this document has an external subset. - * @return False otherwise. - * @author Peter Jones - **/ - //#################################################################### - bool has_external_subset (void) const; + /** + Set the root node to the given node. A full copy is made and stored + in the document object. - //#################################################################### - /** - * Validate this document against the DTD that has been attached to it. - * This would happen at parse time if there was a !DOCTYPE definition. - * If the DTD is valid, and the document is valid, this member function - * will return true. - * - * If it returns false, you may want to send the document through - * xmllint to get the actual error messages. - * - * @return True if the document is valid. - * @return False if there was a problem with the DTD or XML doc. - * @author Peter Jones - **/ - //#################################################################### - bool validate (void); + @param n The new root node to use. + @author Peter Jones + */ + void set_root_node(const node& n); - //#################################################################### - /** - * Parse the given DTD and try to validate this document against it. If - * the DTD is valid, and the document is valid, this member function - * will return true. - * - * If it returns false, you may want to send the document through - * xmllint to get the actual error messages. - * - * This member function will add the parsed DTD to this document as the - * external subset after the validation. If there is already an external - * DTD attached to this document it will be removed and deleted. - * - * @param dtdname A filename or URL for the DTD to use. - * @return True if the document is valid. - * @return False if there was a problem with the DTD or XML doc. - * @author Peter Jones - **/ - //#################################################################### - bool validate (const char *dtdname); + /** + Get the XML version for this document. For generated documents, the + version will be the default. For parsed documents, this will be the + version from the XML processing instruction. - //#################################################################### - /** - * Returns the number of child nodes of this document. This will always - * be at least one, since all xmlwrapp documents must have a root node. - * This member function is useful to find out how many document children - * there are, including processing instructions, comments, etc. - * - * @return The number of children nodes that this document has. - * @author Peter Jones - **/ - //#################################################################### - size_type size (void) const; + @return The XML version string for this document. + @author Peter Jones + */ + const std::string& get_version() const; - //#################################################################### - /** - * Get an iterator to the first child node of this document. If what you - * really wanted was the root node (the first element) you should use - * the get_root_node() member function instead. - * - * @return A xml::node::iterator that points to the first child node. - * @return An end iterator if there are no children in this document - * @author Peter Jones - **/ - //#################################################################### - node::iterator begin (void); + /** + Set the XML version number for this document. This version string + will be used when generating the XML output. - //#################################################################### - /** - * Get a const_iterator to the first child node of this document. If - * what you really wanted was the root node (the first element) you - * should use the get_root_node() member function instead. - * - * @return A xml::node::const_iterator that points to the first child node. - * @return An end const_iterator if there are no children in this document. - * @author Peter Jones - **/ - //#################################################################### - node::const_iterator begin (void) const; + @param version The version string to use, like "1.0". + @author Peter Jones + */ + void set_version(const char *version); - //#################################################################### - /** - * Get an iterator that points one past the last child node for this - * document. - * - * @return An end xml::node::iterator. - * @author Peter Jones - **/ - //#################################################################### - node::iterator end (void); + /** + Get the XML encoding for this document. The default encoding is + ISO-8859-1. - //#################################################################### - /** - * Get a const_iterator that points one past the last child node for - * this document. - * - * @return An end xml::node::const_iterator. - * @author Peter Jones - **/ - //#################################################################### - node::const_iterator end (void) const; + @return The encoding string. + @author Peter Jones + */ + const std::string& get_encoding() const; - //#################################################################### - /** - * Add a child xml::node to this document. You should not add a element - * type node, since there can only be one root node. This member - * function is only useful for adding processing instructions, comments, - * etc.. If you do try to add a node of type element, an exception will - * be thrown. - * - * @param child The child xml::node to add. - * @author Peter Jones - **/ - //#################################################################### + /** + Set the XML encoding string. If you don't set this, it will default + to ISO-8859-1. + + @param encoding The XML encoding to use. + @author Peter Jones + @author Dmitriy Nikitinskiy + */ + void set_encoding(const char *encoding); + + /** + Find out if the current document is a standalone document. For + generated documents, this will be the default. For parsed documents + this will be set based on the XML processing instruction. + + @return True if this document is standalone. + @return False if this document is not standalone. + @author Peter Jones + */ + bool get_is_standalone() const; + + /** + Set the standalone flag. This will show up in the XML output in the + correct processing instruction. + + @param sa What to set the standalone flag to. + @author Peter Jones + */ + void set_is_standalone(bool sa); + + /** + Walk through the document and expand <xi:include> elements. For more + information, please see the w3c recomendation for XInclude. + http://www.w3.org/2001/XInclude. + + The return value of this function may change to int after a bug has + been fixed in libxml2 (xmlXIncludeDoProcess). + + @return False if there was an error with substitutions. + @return True if there were no errors (with or without substitutions). + @author Peter Jones + @author Daniel Evison + */ + bool process_xinclude(); + + /** + Test to see if this document has an internal subset. That is, DTD + data that is declared within the XML document itself. + + @return True if this document has an internal subset. + @return False otherwise. + @author Peter Jones + */ + bool has_internal_subset() const; + + /** + Test to see if this document has an external subset. That is, it + references a DTD from an external source, such as a file or URL. + + @return True if this document has an external subset. + @return False otherwise. + @author Peter Jones + */ + bool has_external_subset() const; + + /** + Validate this document against the DTD that has been attached to it. + This would happen at parse time if there was a !DOCTYPE definition. + If the DTD is valid, and the document is valid, this member function + will return true. + + If it returns false, you may want to send the document through + xmllint to get the actual error messages. + + @return True if the document is valid. + @return False if there was a problem with the DTD or XML doc. + @author Peter Jones + */ + bool validate(); + + /** + Parse the given DTD and try to validate this document against it. If + the DTD is valid, and the document is valid, this member function + will return true. + + If it returns false, you may want to send the document through + xmllint to get the actual error messages. + + This member function will add the parsed DTD to this document as the + external subset after the validation. If there is already an external + DTD attached to this document it will be removed and deleted. + + @param dtdname A filename or URL for the DTD to use. + @return True if the document is valid. + @return False if there was a problem with the DTD or XML doc. + @author Peter Jones + */ + bool validate(const char *dtdname); + + /** + Returns the number of child nodes of this document. This will always + be at least one, since all xmlwrapp documents must have a root node. + This member function is useful to find out how many document children + there are, including processing instructions, comments, etc. + + @return The number of children nodes that this document has. + @author Peter Jones + */ + size_type size() const; + + /** + Get an iterator to the first child node of this document. If what you + really wanted was the root node (the first element) you should use + the get_root_node() member function instead. + + @return A xml::node::iterator that points to the first child node. + @return An end iterator if there are no children in this document + @author Peter Jones + */ + node::iterator begin(); + + /** + Get a const_iterator to the first child node of this document. If + what you really wanted was the root node (the first element) you + should use the get_root_node() member function instead. + + @return A xml::node::const_iterator that points to the first child node. + @return An end const_iterator if there are no children in this document. + @author Peter Jones + */ + node::const_iterator begin() const; + + /** + Get an iterator that points one past the last child node for this + document. + + @return An end xml::node::iterator. + @author Peter Jones + */ + node::iterator end(); + + /** + Get a const_iterator that points one past the last child node for + this document. + + @return An end xml::node::const_iterator. + @author Peter Jones + */ + node::const_iterator end() const; + + /** + Add a child xml::node to this document. You should not add a element + type node, since there can only be one root node. This member + function is only useful for adding processing instructions, comments, + etc.. If you do try to add a node of type element, an exception will + be thrown. + + @param child The child xml::node to add. + @author Peter Jones + */ void push_back (const node &child); - //#################################################################### - /** - * Insert a new child node. The new node will be inserted at the end of - * the child list. This is similar to the xml::node::push_back member - * function except that an iterator to the inserted node is returned. - * - * The rules from the push_back member function apply here. Don't add a - * node of type element. - * - * @param n The node to insert as a child of this document. - * @return An iterator that points to the newly inserted node. - * @see xml::document::push_back - * @author Peter Jones - **/ - //#################################################################### + /** + Insert a new child node. The new node will be inserted at the end of + the child list. This is similar to the xml::node::push_back member + function except that an iterator to the inserted node is returned. + + The rules from the push_back member function apply here. Don't add a + node of type element. + + @param n The node to insert as a child of this document. + @return An iterator that points to the newly inserted node. + @see xml::document::push_back + @author Peter Jones + */ node::iterator insert (const node &n); - //#################################################################### - /** - * Insert a new child node. The new node will be inserted before the - * node pointed to by the given iterator. - * - * The rules from the push_back member function apply here. Don't add a - * node of type element. - * - * @param position An iterator that points to the location where the new node should be inserted (before it). - * @param n The node to insert as a child of this document. - * @return An iterator that points to the newly inserted node. - * @see xml::document::push_back - * @author Peter Jones - **/ - //#################################################################### - node::iterator insert (node::iterator position, const node &n); + /** + Insert a new child node. The new node will be inserted before the + node pointed to by the given iterator. - //#################################################################### - /** - * Replace the node pointed to by the given iterator with another node. - * The old node will be removed, including all its children, and - * replaced with the new node. This will invalidate any iterators that - * point to the node to be replaced, or any pointers or references to - * that node. - * - * Do not replace this root node with this member function. The same - * rules that apply to push_back apply here. If you try to replace a - * node of type element, an exception will be thrown. - * - * @param old_node An iterator that points to the node that should be removed. - * @param new_node The node to put in old_node's place. - * @return An iterator that points to the new node. - * @see xml::document::push_back - * @author Peter Jones - **/ - //#################################################################### - node::iterator replace (node::iterator old_node, const node &new_node); + The rules from the push_back member function apply here. Don't add a + node of type element. - //#################################################################### - /** - * Erase the node that is pointed to by the given iterator. The node - * and all its children will be removed from this node. This will - * invalidate any iterators that point to the node to be erased, or any - * pointers or references to that node. - * - * Do not remove the root node using this member function. The same - * rules that apply to push_back apply here. If you try to erase the - * root node, an exception will be thrown. - * - * @param to_erase An iterator that points to the node to be erased. - * @return An iterator that points to the node after the one being erased. - * @see xml::document::push_back - * @author Peter Jones - **/ - //#################################################################### - node::iterator erase (node::iterator to_erase); + @param position An iterator that points to the location where the new node should be inserted (before it). + @param n The node to insert as a child of this document. + @return An iterator that points to the newly inserted node. + @see xml::document::push_back + @author Peter Jones + */ + node::iterator insert(node::iterator position, const node &n); - //#################################################################### - /** - * Erase all nodes in the given range, from frist to last. This will - * invalidate any iterators that point to the nodes to be erased, or any - * pointers or references to those nodes. - * - * Do not remove the root node using this member function. The same - * rules that apply to push_back apply here. If you try to erase the - * root node, an exception will be thrown. - * - * @param first The first node in the range to be removed. - * @param last An iterator that points one past the last node to erase. Think xml::node::end(). - * @return An iterator that points to the node after the last one being erased. - * @see xml::document::push_back - * @author Peter Jones - **/ - //#################################################################### - node::iterator erase (node::iterator first, node::iterator last); + /** + Replace the node pointed to by the given iterator with another node. + The old node will be removed, including all its children, and + replaced with the new node. This will invalidate any iterators that + point to the node to be replaced, or any pointers or references to + that node. - //#################################################################### - /** - * Convert the XML document tree into XML text data and place it into - * the given string. - * - * @param s The string to place the XML text data. - * @author Peter Jones - **/ - //#################################################################### - void save_to_string (std::string &s) const; + Do not replace this root node with this member function. The same + rules that apply to push_back apply here. If you try to replace a + node of type element, an exception will be thrown. - //#################################################################### - /** - * Convert the XML document tree into XML text data and place it into - * the given 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. - * @author Peter Jones - **/ - //#################################################################### - bool save_to_file (const char *filename, int compression_level=0) const; + @param old_node An iterator that points to the node that should be removed. + @param new_node The node to put in old_node's place. + @return An iterator that points to the new node. + @see xml::document::push_back + @author Peter Jones + */ + node::iterator replace(node::iterator old_node, const node& new_node); - //#################################################################### - /** - * Convert the XML document tree into XML text data and then insert it - * into the given stream. - * - * @param stream The stream to insert the XML into. - * @param doc The document to insert. - * @return The stream from the first parameter. - * @author Peter Jones - **/ - //#################################################################### + /** + Erase the node that is pointed to by the given iterator. The node + and all its children will be removed from this node. This will + invalidate any iterators that point to the node to be erased, or any + pointers or references to that node. + + Do not remove the root node using this member function. The same + rules that apply to push_back apply here. If you try to erase the + root node, an exception will be thrown. + + @param to_erase An iterator that points to the node to be erased. + @return An iterator that points to the node after the one being erased. + @see xml::document::push_back + @author Peter Jones + */ + node::iterator erase(node::iterator to_erase); + + /** + Erase all nodes in the given range, from frist to last. This will + invalidate any iterators that point to the nodes to be erased, or any + pointers or references to those nodes. + + Do not remove the root node using this member function. The same + rules that apply to push_back apply here. If you try to erase the + root node, an exception will be thrown. + + @param first The first node in the range to be removed. + @param last An iterator that points one past the last node to erase. Think xml::node::end(). + @return An iterator that points to the node after the last one being erased. + @see xml::document::push_back + @author Peter Jones + */ + node::iterator erase(node::iterator first, node::iterator last); + + /** + Convert the XML document tree into XML text data and place it into + the given string. + + @param s The string to place the XML text data. + @author Peter Jones + */ + void save_to_string(std::string& s) const; + + /** + Convert the XML document tree into XML text data and place it into + the given 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. + @author Peter Jones + */ + bool save_to_file(const char *filename, int compression_level = 0) const; + + /** + Convert the XML document tree into XML text data and then insert it + into the given stream. + + @param stream The stream to insert the XML into. + @param doc The document to insert. + @return The stream from the first parameter. + @author Peter Jones + */ friend std::ostream& operator<< (std::ostream &stream, const document &doc); private: impl::doc_impl *pimpl_; + void set_doc_data (void *data); void set_doc_data_from_xslt (void *data, xslt::impl::result *xr); - void* get_doc_data (void); - void* get_doc_data_read_only (void) const; - void* release_doc_data (void); + void* get_doc_data(); + void* get_doc_data_read_only() const; + void* release_doc_data(); friend class tree_parser; friend class xslt::stylesheet; -}; // end xml::document class +}; -} // end xml namespace -#endif +} // namespace xml + +#endif // _xmlwrapp_document_h_ Modified: trunk/include/xmlwrapp/event_parser.h =================================================================== --- trunk/include/xmlwrapp/event_parser.h 2009-11-26 14:30:19 UTC (rev 161) +++ trunk/include/xmlwrapp/event_parser.h 2009-12-20 11:28:20 UTC (rev 162) @@ -30,10 +30,12 @@ * SUCH DAMAGE. */ -/** @file - * This file contains the definition of the xml::event_parser class. -**/ +/** + @file + This file contains the definition of the xml::event_parser class. + */ + #ifndef _xmlwrapp_event_parser_h_ #define _xmlwrapp_event_parser_h_ @@ -46,230 +48,195 @@ #include <iosfwd> #include <map> -namespace xml { +namespace xml +{ - -namespace impl { +namespace impl +{ struct epimpl; // forward declaration of private implementation } /** - * The xml::event_parser is used to parse an XML document by calling member - * functions when certain things in the XML document are parsed. In order to - * use this class you derive a sub-class from it and override the protected - * virtual functions. -**/ -class event_parser { + The xml::event_parser is used to par... [truncated message content] |
From: <vac...@us...> - 2009-11-26 14:30:34
|
Revision: 161 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=161&view=rev Author: vaclavslavik Date: 2009-11-26 14:30:19 +0000 (Thu, 26 Nov 2009) Log Message: ----------- Use AM_SILENT_RULES if Automake is new enough. Modified Paths: -------------- trunk/configure.ac Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-07-25 16:31:00 UTC (rev 160) +++ trunk/configure.ac 2009-11-26 14:30:19 UTC (rev 161) @@ -43,6 +43,7 @@ AM_INIT_AUTOMAKE AM_MAINTAINER_MODE +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) dnl remember, "build" is where we compile, "host" is where the resulting dnl program runs (which may be different from "build" for cross-compilation) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-25 16:31:08
|
Revision: 160 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=160&view=rev Author: vaclavslavik Date: 2009-07-25 16:31:00 +0000 (Sat, 25 Jul 2009) Log Message: ----------- Fixed xml::tree_parser to fail on non-fatal parser errors (patch by Sergey Satskiy) Modified Paths: -------------- trunk/AUTHORS trunk/NEWS trunk/src/libxml/tree_parser.cxx trunk/tests/tree/test_tree.cxx Modified: trunk/AUTHORS =================================================================== --- trunk/AUTHORS 2009-07-07 10:00:48 UTC (rev 159) +++ trunk/AUTHORS 2009-07-25 16:31:00 UTC (rev 160) @@ -7,6 +7,7 @@ Tom Browder <tbr...@us...> Other contributors: + Sergey Satskiy <ser...@gm...> Vadim Zeitlin <va...@tt...> Tiziano Mueller <ti...@us...> Greg Chicares <gch...@sb...> Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-07-07 10:00:48 UTC (rev 159) +++ trunk/NEWS 2009-07-25 16:31:00 UTC (rev 160) @@ -1,3 +1,6 @@ + + Fixed xml::tree_parser to fail on non-fatal parser errors. + Version 0.6.1 Added Visual C++ 200x projects and fixed VC6 project. Modified: trunk/src/libxml/tree_parser.cxx =================================================================== --- trunk/src/libxml/tree_parser.cxx 2009-07-07 10:00:48 UTC (rev 159) +++ trunk/src/libxml/tree_parser.cxx 2009-07-25 16:31:00 UTC (rev 160) @@ -106,6 +106,8 @@ tree_impl *p = static_cast<tree_impl*>(ctxt->_private); if (!p) return; // handle bug in older versions of libxml + p->okay_ = false; + va_list ap; va_start(ap, message); printf2string(p->last_error_, message, ap); @@ -137,14 +139,24 @@ xml::tree_parser::tree_parser (const char *name, bool allow_exceptions) { std::auto_ptr<tree_impl> ap(pimpl_ = new tree_impl); + pimpl_->okay_ = true; xmlDocPtr tmpdoc = xmlSAXParseFileWithData(&(pimpl_->sax_), name, 0, pimpl_); - if (allow_exceptions && !tmpdoc) throw std::runtime_error(pimpl_->last_error_); - if (tmpdoc) { - pimpl_->doc_.set_doc_data(tmpdoc); - pimpl_->okay_ = true; + if (tmpdoc && pimpl_->okay_) + { + // all is fine + pimpl_->doc_.set_doc_data(tmpdoc); } + else + { + // a problem appeared + if (tmpdoc) + xmlFreeDoc(tmpdoc); + if (allow_exceptions) + throw std::runtime_error(pimpl_->last_error_); + } + ap.release(); } //#################################################################### @@ -161,16 +173,21 @@ ctxt->_private = pimpl_; - xmlParseDocument(ctxt); + pimpl_->okay_ = true; + const int retval = xmlParseDocument(ctxt); - if (!ctxt->wellFormed) { - xmlFreeDoc(ctxt->myDoc); - ctxt->myDoc = 0; - ctxt->sax = 0; - xmlFreeParserCtxt(ctxt); + if (!ctxt->wellFormed || retval != 0 || !pimpl_->okay_) { + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = 0; + ctxt->sax = 0; + xmlFreeParserCtxt(ctxt); + pimpl_->okay_ = false; - if (allow_exceptions) throw std::runtime_error(pimpl_->last_error_); - ap.release(); return; // handle non-exception case + if (allow_exceptions) + throw std::runtime_error(pimpl_->last_error_); + + ap.release(); + return; // handle non-exception case } pimpl_->doc_.set_doc_data(ctxt->myDoc); Modified: trunk/tests/tree/test_tree.cxx =================================================================== --- trunk/tests/tree/test_tree.cxx 2009-07-07 10:00:48 UTC (rev 159) +++ trunk/tests/tree/test_tree.cxx 2009-07-25 16:31:00 UTC (rev 160) @@ -186,4 +186,31 @@ } + +namespace +{ + +// this is invalid markup, libxml2 fails with +// namespace error : Namespace prefix a on book is not defined +const std::string XMLDATA_BAD_NS = + "<a:book> xmlns:a=\"a\" <title>title</title></a:book>"; + +} // anonymous namespace + +BOOST_AUTO_TEST_CASE( bad_ns_xml_data_throw ) +{ + + BOOST_CHECK_THROW + ( + xml::tree_parser parser( XMLDATA_BAD_NS.c_str(), XMLDATA_BAD_NS.size()), + std::exception + ); +} + +BOOST_AUTO_TEST_CASE( bad_ns_xml_data_no_throw ) +{ + xml::tree_parser parser(XMLDATA_BAD_NS.c_str(), XMLDATA_BAD_NS.size(), false); + BOOST_CHECK( !parser ); // failed +} + 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-07-07 10:33:48
|
Revision: 159 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=159&view=rev Author: vaclavslavik Date: 2009-07-07 10:00:48 +0000 (Tue, 07 Jul 2009) Log Message: ----------- ac-2.62 is only needed for --disable-assert, we can live without it Modified Paths: -------------- trunk/configure.ac Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-07-06 19:09:16 UTC (rev 158) +++ trunk/configure.ac 2009-07-07 10:00:48 UTC (rev 159) @@ -35,7 +35,7 @@ AC_REVISION($Id$)dnl -AC_PREREQ(2.62) +AC_PREREQ(2.61) AC_INIT(xmlwrapp, 0.6.1, [xml...@li...]) AC_CONFIG_SRCDIR([xmlwrapp.pc.in]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-06 19:09:34
|
Revision: 158 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=158&view=rev Author: vaclavslavik Date: 2009-07-06 19:09:16 +0000 (Mon, 06 Jul 2009) Log Message: ----------- compilation fixes (patch #2816324 by Fredrik Bennison) Modified Paths: -------------- trunk/tests/test.h Modified: trunk/tests/test.h =================================================================== --- trunk/tests/test.h 2009-07-06 19:05:59 UTC (rev 157) +++ trunk/tests/test.h 2009-07-06 19:09:16 UTC (rev 158) @@ -34,6 +34,8 @@ #define _xmlwrapp_test_h_ #define BOOST_TEST_ALTERNATIVE_INIT_API +#define BOOST_TEST_DYN_LINK + #include <boost/test/unit_test.hpp> #include <xmlwrapp/xmlwrapp.h> @@ -41,6 +43,7 @@ #include <iostream> #include <fstream> #include <sstream> +#include <cstring> // path to source directory, where test data files are located extern std::string srcdir; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-06 19:06:15
|
Revision: 157 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=157&view=rev Author: vaclavslavik Date: 2009-07-06 19:05:59 +0000 (Mon, 06 Jul 2009) Log Message: ----------- removed accidentally included wxWidgets-specific hack Modified Paths: -------------- trunk/bootstrap Modified: trunk/bootstrap =================================================================== --- trunk/bootstrap 2009-07-06 19:03:43 UTC (rev 156) +++ trunk/bootstrap 2009-07-06 19:05:59 UTC (rev 157) @@ -47,7 +47,7 @@ # --copy to allow simultaneous use on windows under mingw and cygwin platforms. # Symlinking of files under mingw does not work out for cygwin and vice-versa. echo "Setting up build system for xmlwrapp:" -echo " - aclocal " && aclocal ${wx+-I} $wx && \ +echo " - aclocal " && aclocal && \ echo " - libtoolize " && libtoolize --copy --automake && \ echo " - autoconf " && autoconf && \ echo " - automake " && automake --add-missing --copy --foreign && \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-06 19:04:05
|
Revision: 156 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=156&view=rev Author: vaclavslavik Date: 2009-07-06 19:03:43 +0000 (Mon, 06 Jul 2009) Log Message: ----------- ignore more generated files Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in xmlwrapp-config xmlwrapp.pc xsltwrapp.pc config.log config.status stamp-h1 libtool + Makefile Makefile.in xmlwrapp-config xmlwrapp.pc xsltwrapp.pc config.log config.status stamp-h1 libtool configure autom4te.cache aclocal.m4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-06 18:58:49
|
Revision: 155 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=155&view=rev Author: vaclavslavik Date: 2009-07-06 18:58:24 +0000 (Mon, 06 Jul 2009) Log Message: ----------- include test.h and other tests files in the distribution Modified Paths: -------------- trunk/tests/Makefile.am Modified: trunk/tests/Makefile.am =================================================================== --- trunk/tests/Makefile.am 2009-07-06 16:26:26 UTC (rev 154) +++ trunk/tests/Makefile.am 2009-07-06 18:58:24 UTC (rev 155) @@ -9,6 +9,7 @@ noinst_PROGRAMS = test test_SOURCES = \ + test.h \ test_main.cxx \ attributes/test_attributes.cxx \ document/test_document.cxx \ @@ -20,3 +21,10 @@ LIBS += $(top_builddir)/src/libxsltwrapp.la test_SOURCES += xslt/test_xslt.cxx endif + +EXTRA_DIST = \ + $(srcdir)/*/data/*.out \ + $(srcdir)/*/data/*.xml \ + $(srcdir)/*/data/*.xsl \ + $(srcdir)/*/data/*.dtd \ + $(srcdir)/*/data/output This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-07-06 16:26:27
|
Revision: 154 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=154&view=rev Author: vaclavslavik Date: 2009-07-06 16:26:26 +0000 (Mon, 06 Jul 2009) Log Message: ----------- tagged 0.6.1 release Added Paths: ----------- tags/release-0.6.1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-06-02 19:07:30
|
Revision: 153 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=153&view=rev Author: vaclavslavik Date: 2009-06-02 19:07:28 +0000 (Tue, 02 Jun 2009) Log Message: ----------- VC++ project files: added forgotten <include> path to headers Modified Paths: -------------- trunk/platform/Win32/xmlwrapp.bkl Modified: trunk/platform/Win32/xmlwrapp.bkl =================================================================== --- trunk/platform/Win32/xmlwrapp.bkl 2009-06-02 17:06:35 UTC (rev 152) +++ trunk/platform/Win32/xmlwrapp.bkl 2009-06-02 19:07:28 UTC (rev 153) @@ -6,6 +6,7 @@ <include file="presets/simple.bkl"/> <template id="xmlwrapp_lib" template="simple"> + <include>../../include</include> </template> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-06-02 17:06:37
|
Revision: 152 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=152&view=rev Author: vaclavslavik Date: 2009-06-02 17:06:35 +0000 (Tue, 02 Jun 2009) Log Message: ----------- removed configure.ac entries for tests subdirectories that are no longer present Modified Paths: -------------- trunk/configure.ac Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-02 17:03:19 UTC (rev 151) +++ trunk/configure.ac 2009-06-02 17:06:35 UTC (rev 152) @@ -122,11 +122,5 @@ examples/03-xml_generation/Makefile examples/04-xslt/Makefile tests/Makefile - tests/attributes/Makefile - tests/document/Makefile - tests/event/Makefile - tests/node/Makefile - tests/tree/Makefile - tests/xslt/Makefile ]) AC_OUTPUT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vac...@us...> - 2009-06-02 17:03:22
|
Revision: 151 http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=151&view=rev Author: vaclavslavik Date: 2009-06-02 17:03:19 +0000 (Tue, 02 Jun 2009) Log Message: ----------- updated version number to 0.6.1 in preparation for release Modified Paths: -------------- trunk/NEWS trunk/configure.ac Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2009-06-02 16:42:51 UTC (rev 150) +++ trunk/NEWS 2009-06-02 17:03:19 UTC (rev 151) @@ -1,3 +1,5 @@ +Version 0.6.1 + Added Visual C++ 200x projects and fixed VC6 project. Fixed xml::event_parser::parse_stream() to return false on empty Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-06-02 16:42:51 UTC (rev 150) +++ trunk/configure.ac 2009-06-02 17:03:19 UTC (rev 151) @@ -36,7 +36,7 @@ AC_REVISION($Id$)dnl AC_PREREQ(2.62) -AC_INIT(xmlwrapp, 0.6.0, [xml...@li...]) +AC_INIT(xmlwrapp, 0.6.1, [xml...@li...]) AC_CONFIG_SRCDIR([xmlwrapp.pc.in]) AC_CONFIG_AUX_DIR([admin]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |