10 #ifndef BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_UTILS_HPP_INCLUDED
11 #define BOOST_PROPERTY_TREE_DETAIL_XML_PARSER_UTILS_HPP_INCLUDED
20 namespace boost {
namespace property_tree {
namespace xml_parser
26 typedef typename Str::value_type
Ch;
30 typename Str::const_iterator
end =
s.end();
31 for (
typename Str::const_iterator it =
s.begin();
34 if (isspace(*it, loc) || *it ==
Ch(
'\n'))
37 r +=
Ch(
' '), space =
true;
40 r += *it, space =
false;
50 if(
s.empty())
return s;
52 typedef typename Str::value_type
Ch;
58 if(
s.find_first_not_of(sp) == Str::npos) {
60 r = detail::widen<Str>(
" ");
61 r += Str(
s.size() - 1,
Ch(
' '));
63 typename Str::const_iterator
end =
s.end();
64 for (
typename Str::const_iterator it =
s.begin(); it !=
end; ++it)
68 case Ch(
'<'): r += detail::widen<Str>(
"<");
break;
69 case Ch(
'>'): r += detail::widen<Str>(
">");
break;
70 case Ch(
'&'): r += detail::widen<Str>(
"&");
break;
71 case Ch(
'"'): r += detail::widen<Str>(
""");
break;
72 case Ch(
'\''): r += detail::widen<Str>(
"'");
break;
73 default: r += *it;
break;
83 typedef typename Str::value_type
Ch;
85 typename Str::const_iterator
end =
s.end();
86 for (
typename Str::const_iterator it =
s.begin(); it !=
end; ++it)
90 typename Str::const_iterator semicolon = std::find(it + 1,
end,
Ch(
';'));
93 Str ent(it + 1, semicolon);
94 if (ent == detail::widen<Str>(
"lt")) r +=
Ch(
'<');
95 else if (ent == detail::widen<Str>(
"gt")) r +=
Ch(
'>');
96 else if (ent == detail::widen<Str>(
"amp")) r +=
Ch(
'&');
97 else if (ent == detail::widen<Str>(
"quot")) r +=
Ch(
'"');
98 else if (ent == detail::widen<Str>(
"apos")) r +=
Ch(
'\'');
112 static Str
s = detail::widen<Str>(
"<?xml>");
119 static Str
s = detail::widen<Str>(
"<xmlattr>");
126 static Str
s = detail::widen<Str>(
"<xmlcomment>");
133 static Str
s = detail::widen<Str>(
"<xmltext>");