XML Server Getting Started    
Authoring Custom Elements 
One of the most significant features introduced by Internet Explorer 5.0 is an ability to add properties, methods, and events to 
existing HTML or new, custom XML tags. The native name for this technology was 
DHTML behaviors
. These behaviors 
could be written in script using an HTML Component (HTC) file, or they can be implemented in a compiled language 
(binary DHTML behavior). In the version 5.5 Internet Explorer stepped further, providing the capability to define 
element behaviors
 in a complete object oriented fashion.  New versions of Internet Explorer are built on this 
technology internally and so is XMLSP.  
 come equally useful for building  system  and application components. As an example of authoring behaviors 
let's  remake  one of the controls from XMLSP control suite   xsp:groupbox. This is a simple examples, since 
does not need nor events or methods. We found it to be a compelling case, since however simple it is, it does not have a 
direct counterpart in HTML standard.  
To be more specific, starting with IE4.0 there is 
 element useful for grouping elements in a form and for 
distinctively marking text in a document. It draws a box around the text and other elements that the field set contains. There 
is also 
 element, which 
when specified as the first element in the FIELDSET
, inserts a caption into the box drawn 
by the latter. However, we would rather like to have a single  composite  control instead of two elements tied together by 
certain usage rules. We like to use this control the following way: 
                  .   .   .   Other HTML elements .   .  .   .   .  .   
To author custom control in JScript means to create the HTC file (in our case we named it groupbox.htc). This HTC file 
contains two distinct parts. The first part, confined between opening and closing tags 
component's interface: properties, event, methods. The second part   JavaScript immediately following the interface section   
contains declaration of instance variables and functions implementing events and methods declared in the  interface section . 
The following is the  interface section   from /xmlsp/htc/groupbox.htc: 
In the opening  tag we declare the tag name of the contol to be. The next line, with 
 tag, defines property  label  initialized as empty string. The 
 line ensures that every time a IE 
will finish parsing a closing GROUPBOX tag a method named 
 will be called. Accordingly, implementation 
section, which, for convenience reasons has been separated in the different file   /xmlsp/js/groupbox.js   has to incorporate 
function constructor() { 
  var legendHTML =  
     font:  + element.style.font +  ;  + 
     color:  + element.style.color +  ;  + 
     >  + label +   ; 
 2000 2002 Computer Technology Inc. All rights reserved. 
Page 17 

J2EE Web Hosting Tundra XML Server Pages J2EE Hosting

TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.