Author: jkupec
Date: Wed Feb 27 16:58:32 2008
New Revision: 8935
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8935&view=rev
Log:
- use libzypp's xml encoder
Modified:
trunk/zypper/src/output/OutXML.cc
trunk/zypper/src/zypper-misc.cc
trunk/zypper/src/zypper-utils.cc
trunk/zypper/src/zypper-utils.h
Modified: trunk/zypper/src/output/OutXML.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/OutXML.cc?rev=8935&r1=8934&r2=8935&view=diff
==============================================================================
--- trunk/zypper/src/output/OutXML.cc (original)
+++ trunk/zypper/src/output/OutXML.cc Wed Feb 27 16:58:32 2008
@@ -2,6 +2,7 @@
#include <sstream>
#include "OutXML.h"
+#include "../zypper-utils.h"
using std::cout;
using std::endl;
@@ -36,6 +37,7 @@
return false;
}
+/*
string xmlEncode(const string & s)
{
string result;
@@ -62,13 +64,14 @@
return result;
}
+*/
void OutXML::info(const string & msg, Verbosity verbosity, Type mask)
{
if (infoWarningFilter(verbosity, mask))
return;
- cout << "" << xmlEncode(msg)
+ cout << "" << xml_encode(msg)
<< "</message>" << endl;
}
@@ -77,13 +80,13 @@
if (infoWarningFilter(verbosity, mask))
return;
- cout << "" << xmlEncode(msg)
+ cout << "" << xml_encode(msg)
<< "</message>" << endl;
}
void OutXML::error(const string & problem_desc, const string & hint)
{
- cout << "" << xmlEncode(problem_desc)
+ cout << "" << xml_encode(problem_desc)
<< "</message>" << endl;
//! \todo hint
}
@@ -102,7 +105,7 @@
if (!hint.empty())
s << hint << endl;
- cout << "" << xmlEncode(s.str())
+ cout << "" << xml_encode(s.str())
<< "</message>" << endl;
}
@@ -110,8 +113,8 @@
int value, bool done, bool error)
{
cout << "" << endl;
@@ -164,7 +167,7 @@
int rate)
{
cout << "" << endl;
@@ -173,7 +176,7 @@
void OutXML::dwnldProgressEnd(const zypp::Url & uri, int rate, bool error)
{
cout << "" << endl;
@@ -183,6 +186,6 @@
const string & prompt,
const string & answer_hint) // hint ignored for now, maybe an enumeration will be here in the future
{
- cout << "" << xmlEncode(prompt)
+ cout << "" << xml_encode(prompt)
<< "</prompt>" << endl;
}
Modified: trunk/zypper/src/zypper-misc.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=8935&r1=8934&r2=8935&view=diff
==============================================================================
--- trunk/zypper/src/zypper-misc.cc (original)
+++ trunk/zypper/src/zypper-misc.cc Wed Feb 27 16:58:32 2008
@@ -21,8 +21,6 @@
#include "zypp/Capabilities.h"
-#include "zypp/parser/xml_escape_parser.hpp"
-
#include "zypper.h"
#include "zypper-main.h"
#include "zypper-utils.h"
@@ -31,8 +29,6 @@
#include "zypper-callbacks.h"
#include "output/prompt.h"
-//using namespace zypp::detail;
-
using namespace std;
using namespace zypp;
using namespace boost;
@@ -118,12 +114,6 @@
return true;
}
-static std::string xml_escape( const std::string &text )
-{
- iobind::parser::xml_escape_parser parser;
- return parser.escape(text);
-}
-
/**
* Stops iterations on first item and stores edition of the found item.
*
@@ -1084,9 +1074,9 @@
cout << "interactive=\"" << ((patch->interactive()) ? "true" : "false") << "\" ";
cout << "kind=\"" << "patch" << "\" ";
cout << ">" << endl;
- cout << " <summary>" << xml_escape(patch->summary()) << " </summary>" << endl;
- cout << " <description>" << xml_escape(patch->description()) << "</description>" << endl;
- cout << " <license>" << xml_escape(patch->licenseToConfirm()) << "</license>" << endl;
+ cout << " <summary>" << xml_encode(patch->summary()) << " </summary>" << endl;
+ cout << " <description>" << xml_encode(patch->description()) << "</description>" << endl;
+ cout << " <license>" << xml_encode(patch->licenseToConfirm()) << "</license>" << endl;
if ( !patch->repoInfo().alias().empty() )
{
@@ -1457,9 +1447,9 @@
cout << "edition=\"" << res->edition ().asString() << "\" ";
cout << "kind=\"" << res->kind() << "\" ";
cout << ">" << endl;
- cout << " <summary>" << xml_escape(res->summary()) << " </summary>" << endl;
- cout << " <description>" << xml_escape(res->description()) << "</description>" << endl;
- cout << " <license>" << xml_escape(res->licenseToConfirm()) << "</license>" << endl;
+ cout << " <summary>" << xml_encode(res->summary()) << " </summary>" << endl;
+ cout << " <description>" << xml_encode(res->description()) << "</description>" << endl;
+ cout << " <license>" << xml_encode(res->licenseToConfirm()) << "</license>" << endl;
if ( !res->repoInfo().alias().empty() )
{
Modified: trunk/zypper/src/zypper-utils.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-utils.cc?rev=8935&r1=8934&r2=8935&view=diff
==============================================================================
--- trunk/zypper/src/zypper-utils.cc (original)
+++ trunk/zypper/src/zypper-utils.cc Wed Feb 27 16:58:32 2008
@@ -4,9 +4,10 @@
#include
#include
+#include "zypp/Pathname.h"
#include "zypp/base/Logger.h"
#include "zypp/media/MediaManager.h"
-#include "zypp/Pathname.h"
+#include "zypp/parser/xml_escape_parser.hpp"
#include "zypper-main.h"
#include "zypper-utils.h"
@@ -233,3 +234,9 @@
return Pathname();
}
+
+string xml_encode(const string & text)
+{
+ iobind::parser::xml_escape_parser parser;
+ return parser.escape(text);
+}
Modified: trunk/zypper/src/zypper-utils.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-utils.h?rev=8935&r1=8934&r2=8935&view=diff
==============================================================================
--- trunk/zypper/src/zypper-utils.h (original)
+++ trunk/zypper/src/zypper-utils.h Wed Feb 27 16:58:32 2008
@@ -55,4 +55,6 @@
zypp::Pathname cache_rpm(const std::string & rpm_uri_str,
const std::string & cache_dir);
+std::string xml_encode(const std::string & text);
+
#endif /*ZYPPER_UTILS_H*/
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org