[passepartout/passepartout-0-7: 3/9] ported the xml parsing to libxml++ 2.6
- From: Sven Herzberg <herzi src gnome org>
- To: svn-commits-list gnome org
- Subject: [passepartout/passepartout-0-7: 3/9] ported the xml parsing to libxml++ 2.6
- Date: Thu, 23 Apr 2009 03:26:42 -0400 (EDT)
commit 8c8cc79f7c21108f4521f4f50829cf5b03523e64
Author: Sven Herzberg <sven lanedo com>
Date: Wed Apr 22 11:12:07 2009 +0200
ported the xml parsing to libxml++ 2.6
* src/xml2ps/typesetter.cc,
* src/xml2ps/typesetter.hh: replace std::string with Glib::ustring to get things working, again
---
src/xml2ps/typesetter.cc | 21 +++++++++++++--------
src/xml2ps/typesetter.hh | 16 ++++++++--------
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/xml2ps/typesetter.cc b/src/xml2ps/typesetter.cc
index d29f75f..5a8d9ce 100644
--- a/src/xml2ps/typesetter.cc
+++ b/src/xml2ps/typesetter.cc
@@ -28,8 +28,13 @@ xml2ps::PsConverter::PsConverter(xml2ps::Canvas& output)
xml2ps::PsConverter::~PsConverter() {}
-void xml2ps::PsConverter::on_start_element(const std::string& n,
- const xmlpp::SaxParser::AttributeList &p) {
+void xml2ps::PsConverter::on_start_element(const Glib::ustring& n,
+ const xmlpp::SaxParser::AttributeList &p)
+{
+#ifdef DEBUG
+ std::cerr << G_STRLOC << ":" << G_STRFUNC << std::endl;
+#endif
+
// remember which element we are in, for better error messages:
element_stack.push_back(n);
try {
@@ -65,7 +70,7 @@ void xml2ps::PsConverter::on_start_element(const std::string& n,
throw(ParserError("open <" + n + "> - " + err.what()));
}
}
-void xml2ps::PsConverter::on_end_element(const std::string &n) {
+void xml2ps::PsConverter::on_end_element(const Glib::ustring &n) {
try {
node->close();
node = &node->getParent();
@@ -83,10 +88,10 @@ void xml2ps::PsConverter::on_end_element(const std::string &n) {
if(!element_stack.empty())
element_stack.pop_back();
}
-void xml2ps::PsConverter::on_cdata_block(const std::string& s) {
+void xml2ps::PsConverter::on_cdata_block(const Glib::ustring& s) {
on_characters(s);
}
-void xml2ps::PsConverter::on_characters(const std::string& s) {
+void xml2ps::PsConverter::on_characters(const Glib::ustring& s) {
try {
using xml2ps::TextContainer;
if(TextContainer* tc = dynamic_cast<TextContainer*>(node)) {
@@ -109,18 +114,18 @@ void xml2ps::PsConverter::on_characters(const std::string& s) {
}
}
-void xml2ps::PsConverter::on_warning(const std::string &s) {
+void xml2ps::PsConverter::on_warning(const Glib::ustring &s) {
if(!element_stack.empty())
std::cerr << "inside <" << element_stack.back() << "> - ";
std::cerr << s << std::endl;
}
-void xml2ps::PsConverter::on_error(const std::string &s) {
+void xml2ps::PsConverter::on_error(const Glib::ustring &s) {
std::string tmp;
if(!element_stack.empty())
tmp = "inside <" + element_stack.back() + "> - ";
throw(ParserError(tmp + s));
}
-void xml2ps::PsConverter::on_fatal_error(const std::string &s) {on_error(s);}
+void xml2ps::PsConverter::on_fatal_error(const Glib::ustring &s) {on_error(s);}
namespace xml2ps {
Typesetter::~Typesetter() {
diff --git a/src/xml2ps/typesetter.hh b/src/xml2ps/typesetter.hh
index a766164..4241b37 100644
--- a/src/xml2ps/typesetter.hh
+++ b/src/xml2ps/typesetter.hh
@@ -21,15 +21,15 @@ namespace xml2ps {
public:
PsConverter(xml2ps::Canvas& output);
virtual ~PsConverter();
-
- void on_start_element(const std::string& n,
+
+ void on_start_element(const Glib::ustring& n,
const xmlpp::SaxParser::AttributeList &p);
- void on_end_element(const std::string &n);
- void on_characters(const std::string& s);
- void on_cdata_block(const std::string& s);
- void on_warning(const std::string &s);
- void on_error(const std::string &s);
- void on_fatal_error(const std::string &s);
+ void on_end_element(const Glib::ustring &n);
+ void on_characters(const Glib::ustring& s);
+ void on_cdata_block(const Glib::ustring& s);
+ void on_warning(const Glib::ustring &s);
+ void on_error(const Glib::ustring &s);
+ void on_fatal_error(const Glib::ustring &s);
private:
xml2ps::Canvas& out;
xml2ps::RootNode root;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]