Monday, November 08, 2010 at 12:05 AM.

on getPost (postid, username, password) {
		<<12/21/02; 1:00:37 AM by JES
			<<Only return elements whose size is non-zero. Works around a bug in Apple's XML-RPC implementation.
			<<Details from Brent Simmons here:$2380
		<<11/20/02; 5:06:27 PM by JES
			<<Entity-encode high-ascii characters in the post title and description, source name, and category names. Convert the description to Latin text when running on MacOS.
		<<6/10/02; 7:31:33 PM by DW
			<<The struct returned now includes a string called permaLink.
		<<6/10/02; 7:07:53 PM by DW
			<<Return a new attribute, permaLink, which is the URL of the post.
		<<3/13/02; 8:48:51 PM by DW
	radio.weblog.bloggerApi.checkUser (client, false, username, password);
	local (adrblog = radio.weblog.init ());
	local (adrpost = @adrblog^.posts.[string.padwithzeros (postid, 8)]);
	on encode (s) {
		s = xml.entityEncode (s, false);
		return (s)};
	local (struct);
	new (tabletype, @struct);
	struct.userid =;
	struct.postid = postid;
	struct.dateCreated = adrpost^.when;
	struct.description = string (adrpost^.text);
	if system.environment.isMac { //convert to latin charset
		struct.description = latinToMac.macToLatin (struct.description)};
	struct.description = encode (struct.description);
	try {radio.weblog.getUrlForPost (adrpost, @struct.permaLink, adrdata:adrblog)};
	if defined (adrpost^.title) {
		if sizeOf (adrpost^.title) > 0 {
			struct.title = encode (string (adrpost^.title))}};
	if defined (adrpost^.link) {
		if sizeOf (adrpost^.link) > 0 { = string (adrpost^.link)}};
	if defined (adrpost^.enclosure) {
		if sizeOf (adrpost^.enclosure.url) > 0 {
			new (tabletype, @struct.enclosure);
			struct.enclosure.length = adrpost^.enclosure.length;
			struct.enclosure.type = adrpost^.enclosure.type;
			struct.enclosure.url = adrpost^.enclosure.url}};
	if defined (adrpost^.sourceName) {
		if (sizeOf (adrpost^.sourceUrl) > 0) and (sizeOf (adrpost^.sourceName) > 0) {
			new (tabletype, @struct.source); = encode (adrpost^.sourceName);
			struct.source.url = adrpost^.sourceUrl}};
	if defined (adrpost^.categories) {
		if sizeOf (adrpost^.categories) > 0 {
			local (adr);
			struct.categories = {};
			for adr in @adrpost^.categories {
				struct.categories = struct.categories + {encode (nameof (adr^))}}}};
	return (struct)}
<<bundle //test code
	<<local (client = "")
	<<scratchpad.struct = getpost (762,,

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.