out << " arch-old=\"" << rold->arch() << "\"";
}
if (!res->summary().empty())
- out << " summary=\"" << xml_encode(res->summary()) << "\"";
+ out << " summary=\"" << xml::escape(res->summary()) << "\"";
if (!res->description().empty())
- out << ">" << endl << xml_encode(res->description()) << "</solvable>" << endl;
+ out << ">" << endl << xml::escape(res->description()) << "</solvable>" << endl;
else
out << "/>" << endl;
}
if (infoWarningFilter(verbosity, mask))
return;
- cout << "<message type=\"info\">" << xml_encode(msg)
+ cout << "<message type=\"info\">" << xml::escape(msg)
<< "</message>" << endl;
}
if (infoWarningFilter(verbosity, mask))
return;
- cout << "<message type=\"warning\">" << xml_encode(msg)
+ cout << "<message type=\"warning\">" << xml::escape(msg)
<< "</message>" << endl;
}
void OutXML::error(const string & problem_desc, const string & hint)
{
- cout << "<message type=\"error\">" << xml_encode(problem_desc)
+ cout << "<message type=\"error\">" << xml::escape(problem_desc)
<< "</message>" << endl;
//! \todo hint
}
if (!hint.empty())
s << hint << endl;
- cout << "<message type=\"error\">" << xml_encode(s.str())
+ cout << "<message type=\"error\">" << xml::escape(s.str())
<< "</message>" << endl;
}
int value, bool done, bool error)
{
cout << "<progress";
- cout << " id=\"" << xml_encode(id) << "\"";
- cout << " name=\"" << xml_encode(label) << "\"";
+ cout << " id=\"" << xml::escape(id) << "\"";
+ cout << " name=\"" << xml::escape(label) << "\"";
if (done)
cout << " done=\"" << error << "\"";
// print value only if it is known (percentage progress)
void OutXML::dwnldProgressStart(const zypp::Url & uri)
{
cout << "<download"
- << " url=\"" << xml_encode(uri.asString()) << "\""
+ << " url=\"" << xml::escape(uri.asString()) << "\""
<< " percent=\"-1\""
<< " rate=\"-1\""
<< "/>" << endl;
long rate)
{
cout << "<download"
- << " url=\"" << xml_encode(uri.asString()) << "\""
+ << " url=\"" << xml::escape(uri.asString()) << "\""
<< " percent=\"" << value << "\""
<< " rate=\"" << rate << "\""
<< "/>" << endl;
void OutXML::dwnldProgressEnd(const zypp::Url & uri, long rate, bool error)
{
cout << "<download"
- << " url=\"" << xml_encode(uri.asString()) << "\""
+ << " url=\"" << xml::escape(uri.asString()) << "\""
<< " rate=\"" << rate << "\""
<< " done=\"" << error << "\""
<< "/>" << endl;
}
else
{
- cout << xml_encode(*cit) << '"';
+ cout << xml::escape(*cit) << '"';
}
++cidx;
}
{
cout << "<prompt id=\"" << id << "\">" << endl;
if (!startdesc.empty())
- cout << "<description>" << xml_encode(startdesc) << "</description>" << endl;
- cout << "<text>" << xml_encode(prompt) << "</text>" << endl;
+ cout << "<description>" << xml::escape(startdesc) << "</description>" << endl;
+ cout << "<text>" << xml::escape(prompt) << "</text>" << endl;
unsigned int i = 0;
for (PromptOptions::StrVector::const_iterator it = poptions.options().begin();
cout << "<option";
if (poptions.defaultOpt() == i)
cout << " default=\"1\"";
- cout << " value=\"" << xml_encode(option) << "\"";
- cout << " desc=\"" << xml_encode(poptions.optionHelp(i)) << "\"";
+ cout << " value=\"" << xml::escape(option) << "\"";
+ cout << " desc=\"" << xml::escape(poptions.optionHelp(i)) << "\"";
cout << "/>" << endl;
}
cout << "</prompt>" << endl;
#include <iostream>
#include <fstream>
-#include <boost/format.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/lexical_cast.hpp>
#include <iterator>
#include "getopt.h"
#include "Table.h"
#include "utils/messages.h"
-#include "utils/misc.h" // for xml_encode
+#include "utils/misc.h"
#include "repos.h"
using namespace std;
cout << "interactive=\"" << (patch->interactiveWhenIgnoring(ignoreFlags) ? "true" : "false") << "\" ";
cout << "kind=\"patch\"";
cout << ">" << 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;
+ cout << " <summary>" << xml::escape(patch->summary()) << " </summary>" << endl;
+ cout << " <description>" << xml::escape(patch->description()) << "</description>" << endl;
+ cout << " <license>" << xml::escape(patch->licenseToConfirm()) << "</license>" << endl;
if ( !patch->repoInfo().alias().empty() )
{
- cout << " <source url=\"" << xml_encode(patch->repoInfo().url().asString());
- cout << "\" alias=\"" << xml_encode(patch->repoInfo().alias()) << "\"/>" << endl;
+ cout << " <source url=\"" << xml::escape(patch->repoInfo().url().asString());
+ cout << "\" alias=\"" << xml::escape(patch->repoInfo().alias()) << "\"/>" << endl;
}
cout << " </update>" << endl;
cout << "arch=\"" << res->arch().asString() << "\" ";
cout << "kind=\"" << res->kind() << "\" ";
cout << ">" << 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;
+ cout << " <summary>" << xml::escape(res->summary()) << " </summary>" << endl;
+ cout << " <description>" << xml::escape(res->description()) << "</description>" << endl;
+ cout << " <license>" << xml::escape(res->licenseToConfirm()) << "</license>" << endl;
if ( !res->repoInfo().alias().empty() )
{
- cout << " <source url=\"" << xml_encode(res->repoInfo().url().asString());
- cout << "\" alias=\"" << xml_encode(res->repoInfo().alias()) << "\"/>" << endl;
+ cout << " <source url=\"" << xml::escape(res->repoInfo().url().asString());
+ cout << "\" alias=\"" << xml::escape(res->repoInfo().alias()) << "\"/>" << endl;
}
cout << " </update>" << endl;
#include <zypp/base/Easy.h>
#include <zypp/base/Regex.h>
#include <zypp/media/MediaManager.h>
-#include <zypp/parser/xml/XmlEscape.h>
#include <zypp/misc/CheckAccessDeleted.h>
#include <zypp/ExternalProgram.h>
return Pathname();
}
-string xml_encode(const string & text)
-{
- return zypp::xml::escape(text);
-}
-
std::string & indent(std::string & text, int columns)
{
string indent(columns, ' '); indent.insert(0, 1, '\n');
ostringstream str;
str
<< "<product"
- " name=\"" << xml_encode(p.name()) << "\""
+ " name=\"" << xml::escape(p.name()) << "\""
" version=\"" << p.edition().version() << "\""
" release=\"" << p.edition().release() << "\""
" epoch=\"" << p.edition().epoch() << "\""
" arch=\"" << p.arch() << "\""
" productline=\"" << p.productLine() << "\""
- " registerrelease=\"" << xml_encode(p.registerRelease()) << "\""
- " vendor=\"" << xml_encode(p.vendor()) << "\""
- " summary=\"" << xml_encode(p.summary()) << "\""
- " shortname=\"" << xml_encode(p.shortName()) << "\""
- " flavor=\"" << xml_encode(p.flavor()) << "\""
+ " registerrelease=\"" << xml::escape(p.registerRelease()) << "\""
+ " vendor=\"" << xml::escape(p.vendor()) << "\""
+ " summary=\"" << xml::escape(p.summary()) << "\""
+ " shortname=\"" << xml::escape(p.shortName()) << "\""
+ " flavor=\"" << xml::escape(p.flavor()) << "\""
" isbase=\"" << (p.isTargetDistribution() ? 1 : 0) << "\""
- " repo=\"" << xml_encode(p.repoInfo().alias()) << "\""
+ " repo=\"" << xml::escape(p.repoInfo().alias()) << "\""
" installed=\"" << (is_installed ? 1 : 0) << "\"";
if (p.description().empty())
str << "/>";
ostringstream str;
str
<< "<pattern"
- " name=\"" << xml_encode(p.name()) << "\""
+ " name=\"" << xml::escape(p.name()) << "\""
" version=\"" << p.edition().version() << "\""
" release=\"" << p.edition().release() << "\""
" epoch=\"" << p.edition().epoch() << "\""
" arch=\"" << p.arch() << "\""
- " vendor=\"" << xml_encode(p.vendor()) << "\""
- " summary=\"" << xml_encode(p.summary()) << "\""
- " repo=\"" << xml_encode(p.repoInfo().alias()) << "\""
+ " vendor=\"" << xml::escape(p.vendor()) << "\""
+ " summary=\"" << xml::escape(p.summary()) << "\""
+ " repo=\"" << xml::escape(p.repoInfo().alias()) << "\""
" installed=\"" << (is_installed ? 1 : 0) << "\""
" uservisible=\"" << (p.userVisible() ? 1 : 0) << "\"";
if (p.description().empty())
class Product;
class Pattern;
}
-
+using namespace zypp;
typedef std::set<zypp::ResKind> ResKindSet;
zypp::Pathname cache_rpm(const std::string & rpm_uri_str,
const std::string & cache_dir);
-std::string xml_encode(const std::string & text);
-
std::string & indent(std::string & text, int columns);
// comparator for RepoInfo set