Smart Tags: Dumb Technology? (3/4) - exploring XML | WebReference

Smart Tags: Dumb Technology? (3/4) - exploring XML

Smart Tags: Dumb Technology?

How Does It Work?

To summarize the smart tag technology, smart tags consist of recognizers and actions. As their names imply, recognizers recognize certain strings of text as smart-tag actionable. Actions (also known as verbs) are the instructions that can be executed by the user when these strings of text are recognized. For example, suppose I type the text "Andy King" in a Word document. The recognizer recognizes the text "Andy King" as smart-tag actionable. When I click the Smart Tag Actions button over the text, I see a list of verbs such as Send Mail, Schedule a Meeting, and Open Contact.

Now, let's explore how to develop and deploy your own smart tags.

Development and Deployment Approaches

Smart tags can be developed in two ways: one approach is to use an Extensible Markup Language (XML) file; the other approach is to use a dynamic-link library (DLL). The XML approach is ideal for developers who want to develop and deploy smart tags quickly. The XML approach also allows you to automatically update recognizers and actions on the user's computer. The one drawback to the XML approach is that you can only supply Uniform Resource Locators (URLs) as verbs. To supply other types of actions, you must use the DLL approach. The DLL approach is more complicated. You should have a thorough understanding of Component Object Model (COM) programming and interface implementation before you take the DLL approach. Once you understand it, though, you have a great deal more flexibility over the XML approach.

To deploy smart tags, you have several options. One option is to install the XML file or register the DLL on the user's computer. Another option is to embed smart tags in a particular source Word document or Excel spreadsheet. Note that this option only works for the document or worksheet in which the smart tags are embedded. A final option is to embed smart tags in Web pages. Although this option also requires that the corresponding XML file or DLL is installed or registered on the user's computer, you can label text in your Web pages as smart-tag actionable.

Developing a Smart Tag XML File

For these examples, let's use the following scenario. To look up my favorite stock quote on the Yahoo Finance site, currently I go to https://yahoo.com/, and then click on "Finance." I enter the stock ticker symbol into the respective field and submit it. Finally, there's my stock price. Wouldn't it be easier to type the symbol in a Word document or an Excel spreadsheet and associate a link that sends that symbol directly to Yahoo Finance and displays the stock price with one mouse click? We can do this by building a stock symbol look up smart tag.

If you go through the steps by using Microsoft Internet Explorer in the previous paragraph, you will notice that the URL to look up the stock price has the following format:

https://finance.yahoo.com/q?s=intm

In this URL, the symbol INTM represents the stock ticker symbol of the INT Media Group. You can replace this with your favorite symbol in the URL and see the price for your stock. So all we have to do for this smart tag is to use the URL

https://finance.yahoo.com/q?s=

and append the ticker symbol at the end. Here's an XML representation of that smart tag:

<FL:smarttaglist xmlns:FL="urn:schemas-microsoft-com:smarttags:list">
   <FL:name>Stock Quotes</FL:name>
   <FL:description>Your favorite stocks.</FL:description>
   <FL:smarttag type="https://internet.com/namespaces/smarttags#myterms">
      <FL:caption>Quotes by Yahoo</FL:caption>
      <FL:terms>
         <FL:termlist>INTM,INTC</FL:termlist>
      </FL:terms>
      <FL:actions>
         <FL:action id="StockQuote">
            <FL:caption>Stock Quote by Symbol</FL:caption>
            <FL:url>https://finance.yahoo.com/q?s={TEXT}</FL:url>
         </FL:action>
      </FL:actions>
   </FL:smarttag>
</FL:smarttaglist>

How to test the sample...

Produced by Michael Claßen

URL: https://www.webreference.com/xml/column38/3.html
Created: Aug 29, 2001
Revised: Aug 29, 2001