* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <config.h>
+#include <libxml++/libxml++.h>
+
#include <cstdlib>
#include <glibmm.h>
#include <stdexcept>
-#include <libxml++/libxml++.h>
-
-
class OnCdataBlockTestParser : public xmlpp::SaxParser
{
protected:
{
parser.parse_memory("<root><![CDATA[some CDATA]]></root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_cdata_block runtime exception");
{
parser.parse_memory("<root>abc</root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_characters runtime exception");
{
parser.parse_memory("<root><!--a comment--></root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_comment runtime exception");
{
parser.parse_memory("<root></root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_end_document runtime exception");
{
parser.parse_memory("<a:root xmlns:a=\"urn:test\"></a:root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_end_element runtime exception");
{
parser.parse_memory("<!DOCTYPE MyDocument [<!ENTITY number \"42\">]><root></root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_entity_declaration runtime exception");
{
parser.parse_memory("<root>&unknown;</root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_error runtime exception");
{
parser.parse_memory("<!DOCTYPE MyDocument [<!ENTITY number \"42\">]><root>&number;</root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_get_entity runtime exception");
{
parser.parse_memory("<root></root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_start_document runtime exception");
{
parser.parse_memory("<b:root xmlns:b=\"urn:test\" someattr=\"test\"></b:root>");
}
+#ifdef LIBXMLXX_HAVE_EXCEPTION_PTR
catch(const std::runtime_error& e)
+#else
+ catch(const xmlpp::exception& e)
+#endif
{
exceptionThrown = true;
g_assert_cmpstr(e.what(), ==, "on_start_element runtime exception");