Notes

Set Up The Channel Build Environment

  1. Copy this Channel to A Web Server

    Every channel must be hosted by a web server. This can be any http server, including any Mac OS X machine running Personal Web Server.

    Some possible locations:

    Path Base URL
    /Library/WebServer/Documents/ http://localhost/
    <your home directory>/Sites/ http://localhost/~yourUserName/
    <your iDisk>/Sites/ http://homepage.mac.com/<iDiskUserName>/

    If you choose to use your local machine as a the host server (the first two options listed), you will need to turn on Personal Web Server. Open the Sharing panel of System Preferences and make sure "Personal Web Sharing" is checked. In order for Sherlock to access channels on the same machine or "localhost", the environment variable SHERLOCK_DEBUG_CHANNELS must be set. To enable this configuration, open a Terminal window on your system and define the environment variable SHERLOCK_DEBUG_CHANNELS with a value of 1.
  2. Launch Sherlock in Debug Mode
    The Project Builder project for the Sherlock Channel template is set up to run Sherlock as the execution environment. When Sherlock is opened by selecting Run Executable from Project Builder's Debug menu, the SHERLOCK_DEBUG_CHANNELS environment variable is set to 1, enabling a channel debugging mode. This enables a Debug menu within Sherlock, and also enables debug messages to be sent from JavaScript and XQuery to the Console.

  3. Adding The Channel To Sherlock's Toolbar
    Typically, users will add your channel to their toolbar by clicking a sherlock:// URL from a web page or an email sent to them. You can add this channel by typing in a link to the channel's xml file in a popular browser, and hitting return. The URL will depend on where you put the channel. For example, a URL for a channel hosted in the /Library/WebServer/Documents/ folder might look like...

          sherlock://localhost/MyChannel/SherlockChannel.xml?action=add



Using The Channel

  1. Enter a URL in the first text field (or use the default).

  2. Click the "Get HTML" button. The HTML at the URL will be downloaded, and entered in the text field in the upper right hand of the channel. Also, note that the HTML has been parsed, and there should be one or more entries in the column browser below the URL (typically, there is a single entry, "HTML"). This value(s) in the column browser represents the HTML tag(s) at the root of the document.

  3. Navigate the column browser. As you select different columns in the browser, notice a few things: (1) the HTML at the currently selected path is rendered (assuming the "Render" checkbox is checked), and (2) the path to the currently selected item is displayed down below.


Using The Path

    "So", you ask, "what is this path good for?" Well, it can be used to access a particular piece of data from a given URL. For example, if you knew the URL of where to get the temperature, given a zip code, you could enter the URL to a web page with that information, navigate down the HTML tree until only the temperature is showing, and use that path in an XQuery function...
    define function TemperatureFromZip($zip)
    {
        {-- Get the temperature based on a zip code, now that I know the path to it. --}
        let $homeTownTemp := document(...$zip...)/HTML/BODY/...
        return $homeTownTemp
    }