Locate a resource in a resource tree. Any attribute name is interpreted as a
URI with the last part being the resource name unless it ends with a slash.
The URI is checked if the resource exists and the URI is returned. If the
resource does not exist, the URI is shortened until the resource name is found
and the new URI is returned. If no resource with the given name exists, null
is returned.
A use case is to locate the closest menu file or when moving a site from
a filesystem path == URL system from a httpd to Cocoon and provide similar
functions to .htaccess files.
Example: for context:/some/path/to/a/file.xml the following URIs
are tested: context:/some/path/to/a/file.xml, context:/some/path/to/file.xml,
context:/some/path/file.xml, context:/some/file.xml, and context:/file.xml.
For the attribute name context:/some/path/foo/ tests context:/some/path/foo/,
context:/some/path/, context:/some/, and context:/ are tested.
The getAttribute() method will return the URI for the first match while
getAttributeValues() will return an array of all existing paths.
getAttributeNames() will return an Iterator to an empty collection.
A use case is to locate the closest menu file or when moving a site from a filesystem path == URL system from a httpd to Cocoon and provide similar functions to .htaccess files.
Example: for context:/some/path/to/a/file.xml the following URIs are tested: context:/some/path/to/a/file.xml, context:/some/path/to/file.xml, context:/some/path/file.xml, context:/some/file.xml, and context:/file.xml. For the attribute name context:/some/path/foo/ tests context:/some/path/foo/, context:/some/path/, context:/some/, and context:/ are tested.
The getAttribute() method will return the URI for the first match while getAttributeValues() will return an array of all existing paths. getAttributeNames() will return an Iterator to an empty collection.