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


on resolveHref (adrmsg, adrelement) {
		<<04/05/01; 5:49:40 PM by JES
			<<Look for elements whose id matches the href value, without a leading '#' character. Fixes a bug where referenced elements would never be found.
	on resolveOneReference (adrmsg, id) {
		if id beginsWith "#" {
			id = string.mid (id, 2, infinity)};
		if defined (adrmsg^.elementIDs.[id]) {
			return (adrmsg^.elementIDs.[id])};
		if defined (adrmsg^.elementIDs.["#" + id]) { //fallback: try the #id version
			return (adrmsg^.elementIDs.["#" + id])};
		scripterror ("Can't resolve the href because there is no element with the id \"" + id + "\".")};
	loop {
		local (href = soap.xmlutils.getAttributeValue (adrelement, "href"));
		if href {
			adrelement = resolveOneReference (adrmsg, href)}
		else {
	return (adrelement)}

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.