#include "attribute/ExtensibleAttribute.h"
#include "util/SPConstants.h"
+#include <boost/algorithm/string/trim.hpp>
+
using namespace shibsp;
using namespace xmltooling;
using namespace std;
string& processed = m_serialized.back();
string::size_type i=0,start=0;
- while (start!=string::npos && start<msg.length() && (i=msg.find("$",start))!=string::npos) {
+ while (start != string::npos && start < msg.length() && (i = msg.find("$",start)) != string::npos) {
if (i>start)
- processed += msg.substr(start,i-start); // append everything in between
- start=i+1; // move start to the beginning of the token name
- i=msg.find_first_not_of(legal,start); // find token delimiter
- if (i==start) { // append a non legal character
- processed+=msg[start++];
+ processed += msg.substr(start, i-start); // append everything in between
+ start = i+1; // move start to the beginning of the token name
+ i = msg.find_first_not_of(legal, start); // find token delimiter
+ if (i == start) { // append a non legal character
+ processed += msg[start++];
continue;
}
- string tag = msg.substr(start,(i==string::npos) ? i : i-start);
+ string tag = msg.substr(start, (i==string::npos) ? i : i-start);
if (tag == "_string" && val.string()) {
processed += val.string();
- start=i;
+ start = i;
}
else {
DDF child = val.getmember(tag.c_str());
processed += child.string();
else if (child.isstruct() && child["_string"].string())
processed += child["_string"].string();
- start=i;
+ start = i;
}
}
- if (start!=string::npos && start<msg.length())
+ if (start != string::npos && start < msg.length())
processed += msg.substr(start,i); // append rest of string
+ boost::trim(processed);
val = m_obj.first().next();
}