From d82627dc081ef0704f11b45b896b35738528e73a Mon Sep 17 00:00:00 2001 From: Mirko Lindner Date: Fri, 30 Oct 2009 13:44:51 +0100 Subject: [PATCH] get namespace from url -- not perfect Signed-off-by: Mirko Lindner --- src/vido.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/vido.cc b/src/vido.cc index 8ae7e3d..b587160 100644 --- a/src/vido.cc +++ b/src/vido.cc @@ -100,9 +100,25 @@ void set_html(const gchar *url){ // // replace '+' signs with spaces in url std::replace(term.begin(), term.end(), '+', ' '); + +// // find and declare namespace + size_t found; + size_t found2; + char *ns; -// // declare namespace - char *ns = "A"; + found=term.find("/"); + if (found!=std::string::npos){ + if (found != (int) 0){ + ns = &term[0]; + }else{ + term = term.substr(1, strlen(url)); + ns = &term[0]; + found2 = term.find("/"); + term = term.substr(found2 + 1, strlen(url)); + } + }else{ + ns = "A"; + } // // try to retrieve article try { @@ -129,7 +145,8 @@ void set_html(const gchar *url){ // // load new data into gtkhtml widget gtk_html_load_from_string(GTK_HTML(html_wg), str2.c_str(), -1); -// std::cout<