46 if(attribute.first.empty())
48 out <<
' ' << attribute.first
68 for(const auto &element : elements)
69 element.output(out, indent+2);
71 do_indent(out, indent);
74 out << '<
' << '/
' << name << '>
' << "\n";
78 void xmlt::escape(const std::string &s, std::ostream &out)
80 for(const auto ch : s)
104 // � isn't allowed, but what shall we
do?
105 if((ch>=0 && ch<
' ') || ch==127)
117 for(
const auto ch : s)
139 if((ch>=0 && ch<
' ') || ch==127)
149 out << std::string(indent,
' ');
152 xmlt::elementst::const_iterator
xmlt::find(
const std::string &key)
const
154 for(elementst::const_iterator it=
elements.begin();
165 for(elementst::iterator it=
elements.begin();
175 const std::string &attribute,
182 const std::string &attribute,
189 const std::string &attribute,
190 unsigned long long value)
196 const std::string &attribute,
197 const std::string &value)
199 if((value[0]==
'\"' && value[value.size()-1]==
'\"') ||
200 (value[0]==
'\'' && value[value.size()-1]==
'\''))
202 attributes[attribute]=value.substr(1, value.size()-2);
217 result.reserve(str.size());
219 for(std::string::const_iterator it=str.begin();
228 while(it!=str.end() && *it!=
';')
237 else if(tmp[0]==
'#' && tmp[1]!=
'x')