do i--; while (i != s.begin() && isXmlSpace(*i));
while (i != s.begin() && isXmlSpace(*(i - 1))) i--;
trimSpacesRight(const String& s){  String::const_iterator i = s.end();  do i--; while (i != s.begin() && isXmlSpace(*i));  if (i != s.end())    return String(s.begin(), i + 1);  else    return s;}