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


on opmlImport (opmltext) {
		<<12/26/09; 6:06:54 PM by DW
			<<Declare local variable -- adr.
		<<9/9/09; 10:15:17 AM by DW
			<<Rewritten to use new code for reading list support, much simpler and can deal with structured OPML, not just flat OPML. 
				<<Old code
					<<local (adrdata = river2suite.init (), xstruct)
					<<xml.compile (opmltext, @xstruct)
					<<scratchpad.xstruct = xstruct
					<<local (adropml = xml.getaddress (@xstruct, "opml"))
					<<local (adrbody = xml.getaddress (adropml, "body"), adr)
					<<for adr in adrbody
						<<if nameof (adr^) endswith "outline"
								<<local (url = xml.getattributevalue (adr, "xmlUrl"))
								<<river2Suite.subscribeFeed (url)
								<<adrdata^.stats.lastImportError = tryerror
								<<adrdata^.stats.whenLastImportError = ()
		<<6/22/09; 4:50:13 PM by DW
	local (adrdata = river2suite.init (), feeds, adr);
	xml.rss.getOpmlFeeds (opmltext, @feeds);
	for adr in @feeds {
		try {
			local (url = nameof (adr^));
			river2Suite.subscribeFeed (url)}
		else {
			adrdata^.stats.lastImportError = tryerror;
			adrdata^.stats.whenLastImportError = ()}}}
<<bundle //test code
	<<local (f = "Ohio:OPML Editor stuff:defaultFeeds.opml")
	<<file.writewholefile (f, op.outlinetoxml (
	<<local (s = file.readwholefile (f))
	<<opmlImport (s)

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.