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

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

Smart Tags: Dumb Technology?

Smart Tag Type Declaration and Usage

Once you have declared a smart tag namespace URI, you must declare at least one smart tag type, which includes properties such as the tag name, the associated namespace URI, and the URL from where to download the accompanying smart tag DLL or smart tag XML list description file if it isn't already installed on the user's computer. I am waiting for the first Smart Tag Virus DLL to appear...

Here is a sample smart tag type declaration:

<o:SmartTagType
    name="myterms"
    namespaceuri="http://internet.com/namespaces/smarttags"
    downloadurl="http://localhost/smarttags/myterms.cgi">
</o:SmartTagType>

Smart tag type declarations are placed in the Web page's HTML after the TITLE element if present, or after the HEAD element's opening tag.

Smart Tag OBJECT Element Insertion

To enable the Smart Tag Options button to display on the Web page as appropriate, you must add the following OBJECT element to the Web page's HTML, preferably in the HEAD element, as follows:

<OBJECT
    classid ="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
</OBJECT>

In the OBJECT element, the classid and id attributes must appear exactly as shown.

Smart Tag Element Behavior Declaration

In Internet Explorer 5 and above, Dynamic HTML (DHTML) behaviors are used to enhance the default behavior of specific elements. Office XP provides a DLL that associates smart tag namespace URIs to DHTML behaviors, and this association is required in your Web page's HTML code to properly activate the smart tag's shortcut menu. For example, the following DHTML behavior associates the Smart Tag Options button in the OBJECT element to any element that begins with myterms:

<STYLE>
    myterms\:*{behavior:url(#ieooui)}
</STYLE>  

In this example, myterms maps to the alias declared earlier, and ieooui maps to the id attribute of the OBJECT element.

Making Terms Smart-Tag Aware

One final step remains to adding a smart tag to a Web page: you must designate which terms on the Web page will display the Smart Tag Options button. To designate these terms, enclose each term on the Web page within a smart tag alias/tag name element. This element will take the form of the smart tag alias, followed by a colon, followed by the tag name. For example, if a smart tag's alias is myns, the tag name is myterms, and the smart-tag actionable term is Term, then the smart tag alias/tag name element would be myns:myterms and would be coded in HTML as follows:

<myns:myterms>Term</myns:myterms>.

An explanation of the inner workings follows.

Produced by Michael Claßen

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