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


on listDomains (adrlist, adrerrorstring=nil) {
		<<1/4/08; 4:12:16 PM by DW
	local (nexttoken = nil);
	adrlist^ = {};
	loop {
		local (t, xstruct);
		new (tabletype, @t);
		t.MaxNumberOfDomains = 100;
		if nexttoken != nil {
			t.NextToken = nexttoken};
		if not s3.simpleDb.httpClient ("ListDomains", @t, adrerrorstring, @xstruct) { //error
			return (false)};
		<<scratchpad.xstruct = xstruct
		nexttoken = nil;
		local (adrListDomainsResponse = xml.getaddress (@xstruct, "ListDomainsResponse"));
		local (adrListDomainsResult = xml.getaddress (adrListDomainsResponse, "ListDomainsResult"), adr);
		for adr in adrListDomainsResult {
			if nameof (adr^) endswith "DomainName" {
				adrlist^ = adrlist^ + adr^}
			else {
				if nameof (adr^) endswith "NextToken" {
					nexttoken = adr^}}};
		if nexttoken == nil { //hit the end of the list
			return (true)}}};
bundle { //test code
	local (errorstring);
	if not listDomains (@scratchpad.domainlist, @errorstring) {
		dialog.alert (errorstring)}}

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.