Use XML-sanitized strings when serializing stanzas for the XMPP server

This commit is contained in:
Florent Le Coz
2013-12-15 00:34:30 +01:00
parent 3960e4d5af
commit 7d8ce3b563
2 changed files with 12 additions and 3 deletions
+4 -3
View File
@@ -192,12 +192,13 @@ std::string XmlNode::to_string() const
std::string res("<");
res += this->name;
for (const auto& it: this->attributes)
res += " " + it.first + "='" + it.second + "'";
res += " " + utils::remove_invalid_xml_chars(it.first) + "='" +
utils::remove_invalid_xml_chars(it.second) + "'";
if (this->closed && !this->has_children() && this->inner.empty())
res += "/>";
else
{
res += ">" + this->inner;
res += ">" + utils::remove_invalid_xml_chars(this->inner);
for (const auto& child: this->children)
res += child->to_string();
if (this->closed)
@@ -205,7 +206,7 @@ std::string XmlNode::to_string() const
res += "</" + this->name + ">";
}
}
res += this->tail;
res += utils::remove_invalid_xml_chars(this->tail);
return res;
}