}
-docstring xml::escapeString(docstring const & raw, XMLStream::EscapeSettings e)
+docstring escapeString(docstring const & raw, XMLStream::EscapeSettings e)
{
docstring bin;
bin.reserve(raw.size() * 2); // crude approximation is sufficient
}
-// escape what needs escaping
-docstring xmlize(docstring const &str, XMLStream::EscapeSettings e)
-{
- return xml::escapeString(str, e);
-}
-
-
docstring cleanAttr(docstring const & str)
{
docstring newname;
{
docstring output = '<' + tag_;
if (!attr_.empty()) {
- docstring attributes = xml::xmlize(attr_, XMLStream::ESCAPE_NONE);
+ docstring attributes = xml::escapeString(attr_, XMLStream::ESCAPE_NONE);
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
[](int c) {return !std::isspace(c);}));
if (!attributes.empty()) {
if (!attr_.empty()) {
// Erase the beginning of the attributes if it contains space characters: this function deals with that
// automatically.
- docstring attributes = xmlize(from_utf8(attr_), XMLStream::ESCAPE_NONE);
+ docstring attributes = escapeString(from_utf8(attr_), XMLStream::ESCAPE_NONE);
attributes.erase(attributes.begin(), std::find_if(attributes.begin(), attributes.end(),
[](int c) {return !std::isspace(c);}));
if (!attributes.empty()) {
XMLStream &XMLStream::operator<<(docstring const &d)
{
clearTagDeque();
- os_ << xml::xmlize(d, escape_);
+ os_ << xml::escapeString(d, escape_);
escape_ = ESCAPE_ALL;
return *this;
}
{
clearTagDeque();
docstring const d = from_ascii(s);
- os_ << xml::xmlize(d, escape_);
+ os_ << xml::escapeString(d, escape_);
escape_ = ESCAPE_ALL;
return *this;
}
string estr = "Closing tag `" + to_utf8(etag.tag_)
+ "' when other tags are pending. Discarded pending tags:\n";
for (dit = pending_tags_.begin(); dit != den; ++dit)
- estr += to_utf8(xml::xmlize((*dit)->writeTag(), XMLStream::ESCAPE_ALL)) + "\n";
+ estr += to_utf8(xml::escapeString((*dit)->writeTag(), XMLStream::ESCAPE_ALL)) + "\n";
writeError(estr);
// clear the pending tags...
pending_tags_.clear();