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


on getPathAddress (xtable, path, adrresult) {
	<<10/14/98; 7:46:15 AM by DW
		<<xtable is the address of an xml structure
		<<from the root of the table, travel from the top down the /-separated path
		<<something like "/ticket/header/title"
		<<set adrresult^ to point to the value at the end of the path and return true
		<<return false if the path is invalid
	local (nomad = xtable);
	loop {
		if path beginswith "/" {
			path = string.delete (path, 1, 1)};
		if path == "" {
		name = string.nthfield (path, "/", 1);
		path = string.delete (path, 1, sizeof (name) + 1);
		try {
			nomad = xml.getAddress (nomad, name)}
		else {
			return (false)}};
	adrresult^ = nomad;
	return (true)}
<<bundle //test code
	<<dialog.alert (getpathaddress (@notepad.testing.testTable, "/ticket/header/title")^)

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.