Saturday, April 02, 2011 at 9:20 PM.


on restReturnSuccess (flSuccess, msgString, elementName="result") {
		<<7/23/09; 9:41:37 AM by DW
			<<Created. Build a return value, in XML, for a REST procedure call.
	local (xmltext = "", indentlevel = 0);
	on add (s) {
		xmltext = xmltext + string.filledstring ("\t", indentlevel) + s + "\r"};
	on encode (s) {
		if system.environment.isMac {
			return (xml.entityEncode (latinToMac.macToLatin (s), true))}
		else {
			return (xml.entityEncode (s, true))}};
	add ("<?xml version=\"1.0\"?>");
	add ("<" + elementName + " success=\"" + flSuccess + "\" msg=\"" + encode (msgstring) + "\" />");
	return (xmltext)}
<<bundle //test code
	<<local (s = restReturnSuccess (true, "It was 20 years ago today, Sgt Pepper taught the band to play."))
	<<xml.compile (s, @scratchpad.restresult)

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.