Accessibility
 
 
Advanced Homesite: Inside the Homesite Validator VTML Configuration Files

Darren Forcier
Senior Software Engineer, Macromedia

Overview

The Validator feature is a very useful and well-liked tool in Homesite. Many developers use it to validate their documents against the supported namespaces in the VTML based Validator tag definitions. Up until this writing however, the internal layout of the Validator configuration files has never been fully documented. There are many reasons for this:

  1. Homesite provides a visual interface for adding new tags, attributes, and even completely new namespaces.
  2. The layout uses Visual Tools Markup Language (VTML) and is sometimes in a state of flux.
  3. The layout is subject to change with every release.
So why would one want to work directly with the Validator .VTV files by hand? If you are a hand coder at heart, and you take the time to understand the VTML tags, editing the .VTV files by hand is a lot faster than drilling down through the tree-based GUI in the Validtor portion of the Settings dialog. If you are XML/XSLT savvy and/or prone to writing your own scripting/parsing tools, you could also automate the process of generating .VTV tag entries from a XML DTD or Schema.

The goal of this article is to completely document the current .VTV tag layout, and then provide a brief example for a sample XML namespace called VidML (Video Markup Language, and XML markup specification for tracking Videocassettes and DVD's)

Up Front Disclaimer

The Validator internal VTML format is considered to be a non-published, internal format and as such is subject to change without notice. Once you understand the current definition however, any minute changes down the road should be fairly easy to absorb.

What is a Namespace?

Throughout this article you will notice I use the term Namespace frequently. Namespace in the classic Computer Science sense is a common grouping of related symbols. In the definition of a set of Validator tag definitions, a namespace is a logical grouping of related tags.

Locating the Validator .VTV files

There are three files that comprise the Validator .VTV tag definition database:
  • Versions.vtv - This exists in the Program Files\Macromedia\Homesite 5.0\Extensions folder
  • ValueMap.vtv - This exists in the Program Files\Macromedia\Homesite 5.0\Extensions folder
  • Validator.vtv - exists in the Program Files\Macromedia\Homesite 5.0\Extensions\TagDefs folder

Note that if you are using an earlier version of Homesite the default folder is Program Files\Allaire.

Validator VTV Configuration File Architecture

The validator engine works from a tag rules validation database which consists of three VTML tag-based files:

File Name Description
Versions.vtv Active Validation namespace. This is a table which contains pointers to all the available namespaces within validator.vtv and keeps track of which namespaces are currently active (user selectable).
Valdator.vtv Tag specific validator rules hierarchy. This table represents each tag, it's associated namespace, and all of the tag level and attribute level validation rules, including pointers to common attribute value associates and regular expression based rule masks.
Valuemap.vtv This is a cross-reference lookup table for attribute value rules. Attribute value rules come in two flavors: fixed literal values (i.e. "Center", "Left") and regular expression based rule masks for validating rules like "Alphanumeric" (example: [a-z][A-Z][0-9]+ ) or complex rules such as CF expressions (example: "DynamicExpression" ( )?#([A-Za-z][A-Za-z0-9_\.]*)#( )?

Versions.VTV Layout

The Versions.vtv file is the master manifest for the active namespace definitions. It represents each markup namespace as well as the parent-child relationships for the tag validation rules. The following tags/attributes are supported:

Tag Name: VERSIONS Description: Outer markup tag for versions markup.

Attributes: None

Tag Name: VERKEY Description: Version Namespace specific information
Attributes:

VERKEY Tag Description
Attribute Name Valid Values Description
ACTIVE "YES"|"NO" Namespace active indicator
DISPLAY Alphanumeric Display name for UI
NAME Alphanumeric Internal name for parent/childing
PARENT Valid Parent Name | "None" Name attribute for parent or "None" if this is a standalone namespace
Following is an example of Versions.VTV
    <VERSIONS>   
    <VERKEY ACTIVE="YES" DISPLAY="HTML 2.0" NAME="HTML20" PARENT="None"/> 
    <VERKEY ACTIVE="YES" DISPLAY="HTML 3.2" NAME="HTML32" PARENT="HTML20"/> 
    <VERKEY ACTIVE="YES" DISPLAY="HTML 4.0" NAME="HTML4" PARENT="HTML32"/> 
    <VERKEY ACTIVE="NO" DISPLAY="Internet Explorer 3.0 Extensions" NAME="IE3" PARENT="HTML32"/>                                    
    <VERKEY ACTIVE="NO" DISPLAY="Internet Explorer 4.0 Extensions" NAME="IE4" PARENT="HTML32"/>                                    
    <VERKEY ACTIVE="NO" DISPLAY="Netscape Navigator 3.0 Extensions" NAME="NN3" PARENT="HTML32"/>                                    
    <VERKEY ACTIVE="NO" DISPLAY="Netscape Navigator 4.0 Extensions" NAME="NN4" PARENT="HTML32"/>                                    
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion" NAME="CF" PARENT="None"/> 
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion 3.0" NAME="CF30" PARENT="CF"/> 
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion 3.1" NAME="CF31" PARENT="CF30"/> 
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion 4.0" NAME="CF40" PARENT="CF31"/> 
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion 4.5" NAME="CF45" PARENT="CF40"/> 
    <VERKEY ACTIVE="YES" DISPLAY="ColdFusion 5.0" NAME="CF50" PARENT="CF45"/> 
    <VERKEY ACTIVE="YES" DISPLAY="Synchronized Multimedia Integration Language 1.0" NAME="SMIL"                                    PARENT="None"/> 
    <VERKEY ACTIVE="YES" DISPLAY="Wireless Markup Language" NAME="WML" PARENT="None"/> 
    <VERKEY ACTIVE="YES" DISPLAY="JavaServer Page Tags" NAME="jsp" PARENT="None"/> 
    <VERKEY ACTIVE="YES" DISPLAY="CF 6.0" NAME="CF60" PARENT="CF"/> 
    <VERKEY ACTIVE="YES" DISPLAY="Cold Fusion 6.0" NAME="CF6.0" PARENT="CF50"/> 
</VERSIONS> 
                                

Tag Namespace Inheritence relationships

Versions.vtv defines the parent-child hierarchy rules for tag namespaces. Each VERKEY tag supports the PARENT attribute which specifies the parent namespace, if any. This reduces the amount of redundancy between similar namespaces such as HTML 2.0, 3.2, and 4.0. Each child namespace adds new rules and automatically inherits all of the existing rules of the parent namespace.

Validator.VTV Layout

</VALIDATION >                                  

<VALIDATION> 
<TAG NAME="!DOCTYPE" > 
<VERSIONINFO VERSIONS="HTML20"/> 


<ATTRIBUTES> 
<ATTRIB AVALKEYS="82" AVER="HTML20" NAME="HTML"/> 
<ATTRIB AVALKEYS="82" AVER="HTML20" NAME="PUBLIC"/> 


</ATTRIBUTES> 


<TAGOPTIONS> 
<TAGOPTION NAME="CLOSINGTAG" VALUE="No" VERSION="HTML20"/> 


</TAGOPTIONS> 


<TAGCONTEXT> 
</TAGCONTEXT> 


</TAG > 


<TAG NAME="A"> 
<VERSIONINFO VERSIONS="HTML20"/> 


<ATTRIBUTES > 
<ATTRIB AVALKEYS="0, 1, 2, 250" AVER="HTML20" NAME="HREF"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="METHODS"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="NAME"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="REL"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="REV"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="URN"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML20" NAME="TITLE"/> 
<ATTRIB AVALKEYS="1, 4, 5" AVER="HTML4" NAME="ACCESSKEY"/> 
<ATTRIB AVALKEYS="0, 1, 3" AVER="HTML4" NAME="CHARSET"/> 
<ATTRIB AVALKEYS="1, 89, 90" AVER="HTML4" NAME="DIR"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="LANG"/> 
<ATTRIB AVALKEYS="1, 101, 80" AVER="HTML4" NAME="TABINDEX"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="TITLE"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="CLASS"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="ID"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="STYLE"/> 
<ATTRIB AVALKEYS="0, 1, 2" AVER="HTML4" NAME="TARGET"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONCLICK"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONDBLCLICK"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONMOUSEDOWN"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONMOUSEUP"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONMOUSEOVER"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONMOUSEMOVE"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONMOUSEOUT"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONKEYPRESS"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONKEYDOWN"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONKEYUP"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONBLUR"/> 
<ATTRIB AVALKEYS="3, 0, 1" AVER="HTML4" NAME="ONFOCUS"/> 


</ATTRIBUTES> 


<TAGOPTIONS> 
<TAGOPTION NAME="CLOSINGTAG" VALUE="Required" VERSION="HTML20"/> 


</TAGOPTIONS> 


<TAGCONTEXT> 
<VALID TAG="ADDRESS" VERSION="HTML20"/> 
<VALID TAG="B" VERSION="HTML20"/> 
<VALID TAG="BODY" VERSION="HTML20"/> 
<VALID TAG="CITE" VERSION="HTML20"/> 
<VALID TAG="CODE" VERSION="HTML20"/> 
<VALID TAG="DD" VERSION="HTML20"/> 
<VALID TAG="DT" VERSION="HTML20"/> 
<VALID TAG="EM" VERSION="HTML20"/> 
<VALID TAG="H1" VERSION="HTML20"/> 
<VALID TAG="H2" VERSION="HTML20"/> 
<VALID TAG="H3" VERSION="HTML20"/> 
<VALID TAG="H4" VERSION="HTML20"/> 
<VALID TAG="H5" VERSION="HTML20"/> 
<VALID TAG="H6" VERSION="HTML20"/> 
<VALID TAG="I" VERSION="HTML20"/> 
<VALID TAG="KBD" VERSION="HTML20"/> 
<VALID TAG="LI" VERSION="HTML20"/> 
<VALID TAG="P" VERSION="HTML20"/> 
<VALID TAG="PRE" VERSION="HTML20"/> 
<VALID TAG="SAMP" VERSION="HTML20"/> 
<VALID TAG="STRONG" VERSION="HTML20"/> 
<VALID TAG="TT" VERSION="HTML20"/> 
<VALID TAG="VAR" VERSION="HTML20"/> 
<VALID TAG="U" VERSION="HTML32"/> 
<VALID TAG="STRIKE" VERSION="HTML32"/> 
<VALID TAG="BIG" VERSION="HTML32"/> 
<VALID TAG="SMALL" VERSION="HTML32"/> 
<VALID TAG="SUB" VERSION="HTML32"/> 
<VALID TAG="SUP" VERSION="HTML32"/> 
<VALID TAG="DFN" VERSION="HTML32"/> 
<VALID TAG="FONT" VERSION="HTML32"/> 
<VALID TAG="APPLET" VERSION="HTML32"/> 
<VALID TAG="CAPTION" VERSION="HTML32"/> 
<VALID TAG="BODY" VERSION="HTML32"/> 
<VALID TAG="DIV" VERSION="HTML32"/> 
<VALID TAG="CENTER" VERSION="HTML32"/> 
<VALID TAG="FORM" VERSION="HTML32"/> 
<VALID TAG="TH" VERSION="HTML32"/> 
<VALID TAG="TD" VERSION="HTML32"/> 
<VALID TAG="ABBR" VERSION="HTML4"/> 
<VALID TAG="ACRONYM" VERSION="HTML4"/> 
<VALID TAG="NOFRAMES" VERSION="HTML4"/> 
<VALID TAG="SPAN" VERSION="HTML4"/> 
<VALID TAG="BDO" VERSION="HTML4"/> 
<VALID TAG="Q" VERSION="HTML4"/> 
<VALID TAG="LABEL" VERSION="HTML4"/> 
<VALID TAG="LEGEND" VERSION="HTML4"/> 
<VALID TAG="NOSCRIPT" VERSION="HTML4"/> 
<VALID TAG="IFRAME" VERSION="HTML4"/> 
<VALID TAG="FIELDSET" VERSION="HTML4"/> 
<VALID TAG="INS" VERSION="HTML4"/> 
<VALID TAG="DEL" VERSION="HTML4"/> 
<VALID TAG="BLOCKQUOTE" VERSION="HTML20"/> 
<VALID TAG="OBJECT" VERSION="HTML4"/> 
<INVALID TAG="A" VERSION="HTML20"/> 


</TAGCONTEXT > 


</TAG > 


</VALIDATION >
VALIDATOR.VTV Tag Namespace Descriptor
VALIDATION Tag Description
Main outer tag for validation rule set.
Attributes
TAG Tag Description
Wrapper tag for a complete set of tag rules. This is the outer level "body" tag for the complete validation suite of rules.
Attributes
Attribute Name Valid Values Description
Name Alphanumeric Tag Name
VERSIONINFO Tag Description
Wrapper tag for first version in version hierarchy tag was introduced. Tag validation follows an inheritence chain which starts with the first version the tag was flagged for validtion, but uses the most current (i.e. overridden) rules in the latest markup version checked off.
Attributes
Attribute Name Valid Values Description
VERSION Alphanumeric Markup Version Tag was introduced
ATTRIBUTES Tag Description
Wrapper tag for a complete set of attribute rules. Attribute rules are specified in two subtags, ATTRIB and ATTRIBREQSET. The ATTRIB tag encompasses attribute value rules which are stored in ValueMap.VTV. ATTRIBREQSET tags are used to specify required attribute sets.
Attributes
ATTRIB Tag Description
Wrapper tag for an individual attribute rule. The attribute value validation rules are expressed in the AVAKEYS attribute as a comma separated list of ID rule pointers which point to value rules stored in ValueMap.vtv. This is a One-to-Many relationship. The AVER attribute specifies which version of the markup this rule became active for. The NAME attribute specifies the actual name of the attribute.
Attributes
Attribute Name Valid Values Description
AVALKEYS Numeric Comma Separated List List of attribute value rule ID pointers into ValueMap.vtv
AVER Alpha Version of markup attribute was introduced
NAME AlphaNumeric Attribute Name
ATTRIBREQUIREMENTS Tag Description
Wrapper tag for required attributes enforcement. The REQSET tag specifies an individual set of required attributes.
Attributes
REQSET Tag Description
Wrapper tag for required attributes enforcement. ELEMENTS represents a comma separated list of attributes that are required. VERSION represents the namespace version that the attributes became required.
Attributes
Attribute Name Valid Values Description
ELEMENTS Comma separated element list Attribute elements
VERSION Alpha Version of markup attribute requirement was introduced
TAGOPTIONS Tag Description
Wrapper tag for other optional tag rules. This is a catch-basin for any other types of specialized validation processing. Currently there are only two supported rule types, CLOSINGTAG and MESSAGE.
Attributes
TAGOPTION Tag Description
Wrapper tag for other individual tag optional rule. Currently only two rules are supported, CLOSINGTAG and MESSAGE. CLOSINGTAG is a specifier for whether or not a closing tag is required and MESSAGE is used as a custom message specifier which will always trigger for a particular tag.
Attributes
Attribute Name Valid Values Description
NAME Alpha Tag Option Name
VALUE Option Value Boolean "Yes" or "No" indicator
VERSION AlphaNumeric Markup version rule was introduced
TAGCONTEXT Tag Description
Wrapper tag context rule
Attributes
VALID Tag Description
Tag within context rule
Attributes
Attribute Name Valid Values Description
TAG Alpha Name of parent tag within context
VERSION AlphaNumeric Markup version rule was introduced
INVALID Tag Description
Tag Out Of Context Rule
Attributes
Attribute Name Valid Values Description
TAG Alpha Tag Out of Context Rule
VERSION AlphaNumeric Markup version rule was introduced


ValueMap.VTV Layout

The ValueMap.VTV file is essentially a lookup table of tag attribute value rules. It promotes rule reusability by assigning a unique identifier (ID) to each rule. Validator.VTV attribute rules can point to multiple value rules by specifying a comma-delimited list of ID pointers.

Attribute value rules come in two flavors, (1) One or more literal values that are compared against for an attribute, i.e. "Centered", "Left", "Right", or a regular expression. Regular Expression rules are a much more powerful way of validating for genericity, such as "negative Integer": "-[1-9]+[0-9]*". Regular Expression attribute value rules are a somewhat advanced feature from a user perspective, but they allow for complex validations against server side markup such as Cold Fusion expressions.

ValueMap.VTV Sample

<VALUEMAP> <VALKEY ID="0" NOTE="alphanum string" QUOTE="May Be Double" RE="Yes" TYPE="[a-zA-Z0-9]+"/> <VALKEY ID="1" NOTE="Dynamic expression" QUOTE="May Be Quoted" RE="Yes" TYPE="(<CFOUTPUT>)?#([A-Za-z][A-Za-z0-9_\.]*)#(</CFOUTPUT>)?"/> <VALKEY ID="10" QUOTE="May Be Double" TYPE="read"/> <VALKEY ID="100" QUOTE="May Be Double" TYPE="1"/> <VALKEY ID="101" NOTE="negative integer" QUOTE="May Be Double" RE="Yes" TYPE="-[1-9]+[0-9]*"/> <VALKEY ID="102" QUOTE="May Be Double" TYPE="centered"/> <VALKEY ID="103" QUOTE="May Be Double" TYPE="scaled"/> <VALKEY ID="104" QUOTE="May Be Double" TYPE="tiled"/> <VALKEY ID="105" QUOTE="May Be Double" TYPE="daily"/> <VALKEY ID="106" QUOTE="May Be Double" TYPE="execute"/> <VALKEY ID="107" QUOTE="May Be Double" TYPE="monthly"/> <VALKEY ID="108" QUOTE="May Be Double" TYPE="weekly"/> <VALKEY ID="109" QUOTE="May Be Double" TYPE="READ_COMMITTED"/> <VALKEY ID="11" QUOTE="May Be Double" TYPE="rename"/> <VALKEY ID="110" QUOTE="May Be Double" TYPE="READ_UNCOMMITTED"/> <VALKEY ID="111" QUOTE="May Be Double" TYPE="REPEATABLE_READ"/> <VALKEY ID="112" QUOTE="May Be Double" TYPE="SERIALIZABLE"/> <VALKEY ID="113" QUOTE="May Be Double" TYPE="VERSIONING"/> <VALKEY ID="114" QUOTE="May Be Double" TYPE="-1"/> <VALKEY ID="115" QUOTE="May Be Double" TYPE="infinite"/> <VALKEY ID="116" QUOTE="May Be Double" TYPE="get"/> <VALKEY ID="117" QUOTE="May Be Double" TYPE="post"/> <VALKEY ID="118" QUOTE="May Be Double" TYPE="Error"/> <VALKEY ID="119" QUOTE="May Be Double" TYPE="makeunique"/> <VALKEY ID="12" QUOTE="May Be Double" TYPE="upload"/> <VALKEY ID="120" QUOTE="May Be Double" TYPE="overwrite"/> <VALKEY ID="121" QUOTE="May Be Double" TYPE="skip"/> <VALKEY ID="122" QUOTE="May Be Double" TYPE="httprequest"/> <VALKEY ID="123" QUOTE="May Be Double" TYPE="background"/> <VALKEY ID="124" QUOTE="May Be Double" TYPE="foreground"/> <VALKEY ID="125" QUOTE="May Be Double" TYPE="basic"/> <VALKEY ID="126" QUOTE="May Be Double" TYPE="cols"/> <VALKEY ID="127" QUOTE="May Be Double" TYPE="rows"/> <VALKEY ID="128" QUOTE="May Be Double" TYPE="groups"/> <VALKEY ID="129" QUOTE="May Be Double" TYPE="server"/> <VALKEY ID="13" QUOTE="May Be Double" TYPE="write"/> <VALKEY ID="130" QUOTE="May Be Double" TYPE="base"/> <VALKEY ID="131" QUOTE="May Be Double" TYPE="onelevel"/> <VALKEY ID="132" QUOTE="May Be Double" TYPE="subtree"/> <VALKEY ID="133" QUOTE="May Be Double" TYPE="auto"/> <VALKEY ID="134" QUOTE="May Be Double" TYPE="browse"/> <VALKEY ID="135" QUOTE="May Be Double" TYPE="column"/> <VALKEY ID="136" QUOTE="May Be Double" TYPE="edit"/> <VALKEY ID="137" QUOTE="May Be Double" TYPE="row"/> <VALKEY ID="138" QUOTE="May Be Double" TYPE="single"/> <VALKEY ID="139" QUOTE="May Be Double" TYPE="circ"/> <VALKEY ID="14" QUOTE="May Be Double" TYPE="optimize"/> <VALKEY ID="140" QUOTE="May Be Double" TYPE="circle"/> <VALKEY ID="141" QUOTE="May Be Double" TYPE="poly"/> <VALKEY ID="142" QUOTE="May Be Double" TYPE="polygon"/> <VALKEY ID="143" QUOTE="May Be Double" TYPE="rect"/> <VALKEY ID="144" QUOTE="May Be Double" TYPE="rectangle"/> <VALKEY ID="145" QUOTE="May Be Double" TYPE="default"/> <VALKEY ID="146" NOTE="integer offset -6 to +6" QUOTE="May Be Double" RE="Yes" TYPE="(-|\+)[0-6]"/> <VALKEY ID="147" NOTE="integers 1 to 7" QUOTE="May Be Double" RE="Yes" TYPE="[1-7]"/> <VALKEY ID="148" QUOTE="May Be Double" TYPE="ascii"/> <VALKEY ID="149" QUOTE="May Be Double" TYPE="autodetect"/> <VALKEY ID="15" QUOTE="May Be Double" TYPE="purge"/> <VALKEY ID="150" QUOTE="May Be Double" TYPE="binary"/> <VALKEY ID="151" QUOTE="May Be Double" TYPE="checkbox"/> <VALKEY ID="152" QUOTE="May Be Double" TYPE="hidden"/> <VALKEY ID="153" QUOTE="May Be Double" TYPE="image"/> <VALKEY ID="154" QUOTE="May Be Double" TYPE="password"/> <VALKEY ID="155" QUOTE="May Be Double" TYPE="radio"/> <VALKEY ID="156" QUOTE="May Be Double" TYPE="reset"/> <VALKEY ID="157" QUOTE="May Be Double" TYPE="submit"/> <VALKEY ID="158" QUOTE="May Be Double" TYPE="text"/> <VALKEY ID="159" QUOTE="May Be Double" TYPE="disc"/> <VALKEY ID="16" QUOTE="May Be Double" TYPE="refresh"/> <VALKEY ID="160" QUOTE="May Be Double" TYPE="square"/> <VALKEY CASESENSITIVE="Yes" ID="161" QUOTE="May Be Double" TYPE="a"/> <VALKEY CASESENSITIVE="Yes" ID="162" QUOTE="May Be Double" TYPE="A"/> <VALKEY CASESENSITIVE="Yes" ID="163" QUOTE="May Be Double" TYPE="I"/> <VALKEY CASESENSITIVE="Yes" ID="164" QUOTE="May Be Double" TYPE="i"/> <VALKEY ID="165" QUOTE="May Be Double" TYPE="block"/> <VALKEY ID="166" QUOTE="May Be Double" TYPE="horizontal"/> <VALKEY ID="167" QUOTE="May Be Double" TYPE="vertical"/> <VALKEY ID="168" QUOTE="May Be Double" TYPE="file"/> <VALKEY ID="169" QUOTE="May Be Double" TYPE="textarea"/> <VALKEY ID="17" QUOTE="May Be Double" TYPE="update"/> <VALKEY ID="170" QUOTE="May Be Double" TYPE="button"/> <VALKEY ID="171" QUOTE="May Be Double" TYPE="request"/> <VALKEY ID="172" QUOTE="May Be Double" TYPE="validation"/> <VALKEY ID="173" QUOTE="May Be Double" TYPE="html"/> <VALKEY ID="174" QUOTE="May Be Double" TYPE="explicit"/> <VALKEY ID="175" QUOTE="May Be Double" TYPE="simple"/> <VALKEY ID="176" QUOTE="May Be Double" TYPE="cgi"/> <VALKEY ID="177" QUOTE="May Be Double" TYPE="cookie"/> <VALKEY ID="178" QUOTE="May Be Double" TYPE="formfield"/> <VALKEY ID="179" QUOTE="May Be Double" TYPE="url"/> <VALKEY ID="18" QUOTE="May Be Double" TYPE="add"/> <VALKEY ID="180" QUOTE="May Be Double" TYPE="custom"/> <VALKEY ID="181" QUOTE="May Be Double" TYPE="path"/> <VALKEY ID="182" QUOTE="May Be Double" TYPE="numeric"/> <VALKEY ID="183" QUOTE="May Be Double" TYPE="en"/> <VALKEY ID="184" QUOTE="May Be Double" TYPE="pixels"/> <VALKEY ID="185" QUOTE="May Be Double" TYPE="creditcard"/> <VALKEY ID="186" QUOTE="May Be Double" TYPE="date"/> <VALKEY ID="187" QUOTE="May Be Double" TYPE="eurodate"/> <VALKEY ID="188" QUOTE="May Be Double" TYPE="float"/> <VALKEY ID="189" QUOTE="May Be Double" TYPE="integer"/> <VALKEY ID="19" QUOTE="May Be Double" TYPE="modify"/> <VALKEY ID="190" QUOTE="May Be Double" TYPE="social_security_numBe r"/> <VALKEY ID="191" QUOTE="May Be Double" TYPE="telephone"/> <VALKEY ID="192" QUOTE="May Be Double" TYPE="time"/> <VALKEY ID="193" QUOTE="May Be Double" TYPE="zipcode"/> <VALKEY ID="194" QUOTE="May Be Double" TYPE="data"/> <VALKEY ID="195" QUOTE="May Be Double" TYPE="object"/> <VALKEY ID="196" QUOTE="May Be Double" TYPE="ref"/> </VALUEMAP>
VALUEMAP.VTV Tag Namespace Descriptor
VALUEMAP Tag Description
Main outer tag for VALUEMAP rule set.
Attributes
VALKEY Tag Description
The VALKEY tag specifies an individual attribute Value rule.
Attributes
Attribute Name Valid Values Description
ID Alphanumeric ID is a numeric index to the specific attribute value rule. Different combinations of IDs can be put together to form a complete set of attribute validation rules for any particular attribute. For example IDs "0" and "1" can be combined on an attribute to form a combined AlphaNumeric|Dynamic Expression rule.
CASESENSITIVE "Yes"|"No" CASESENSITIVE simply specifies whether the attribute value is case sensitive or not. If this attribute is left off then the attribute value is not checked for case sensitivity.
QUOTE Alphanumeric QUOTE is used to specify whether attribute values are quoted or not. If the QUOTE attribute is present then quotes are required. The QUOTE attribute can also specify the additional rule "May be Double"
RE "Yes"|"No" (boolean attribute) RE is an indicator that the TYPE is a regular expression, not a literal value
TYPE Alphanumeric TYPE is either a literal attribute value or a regular expression if the RE attribute is "Yes". When the Validator runs regular expressions are parsed by a POSIX compliant regular expression handling engine.


Adding A New Namespace: VideoML.



Rather than bore you to tears with a DTD or XML Schema specification, I'll simply describe our new markup language, VideoML. VideoML is a simple markup language which allows you to track Videos. The markup namespace is insanely simple, only two tags are supported, <VIDEOML> and <VIDEO> !. The VIDEOML tag will be used in a fashion similar to the HTML tag, it will delimit a complete VIDEOML document.

The first step is to create a new entry in Versions.VTV and mark the namespace as active. To do this load up Versions.VTV into your favorite editor (hopefully Homesite!). Add the following tag anywhere inside the VERSIONS tag.
<VERKEY ACTIVE="YES" DISPLAY="Video Markup Language 1.0" NAME="VIDML" PARENT="None"/>

Here we have added a single Versions tag, made it an active namespace, and specified no parent. It is a standalone namespace at this point.

Adding the VIDEOML Tag

The VIDEOML tag will have no attributes. We will define it as follows in Validator.VTV:

<TAG NAME="VIDEOML"> 
  <VERSIONINFO VERSIONS="VIDML"/> 
   <TAGOPTIONS> 
     <TAGOPTION NAME="CLOSINGTAG" VALUE="Required" VERSION="VIDML"/> 
     <TAGOPTION NAME="MESSAGE" VALUE="This document is Using VIDML Markup LanguageI" VERSION="VIDML"/> 
   </TAGOPTIONS> 
  <TAGCONTEXT> 
  </TAGCONTEXT> 
</TAG>
Here we have defined our outer VIDEOML tag. We have defined no attributes, as VIDEOML will not use any. We have defined two TAGOPTION rules. The first one, "CLOSINGTAG" specifies that this tag will require a closing </VIDEOML> tag. The second rule employs the "MESSAGE" tag option. This simply tells the validator engine to output our own custom message whenever the tag is discovered. The Message TAGOPTION is a way of alerting yourself for specific tag constructs.

Adding the VIDEO Tag

We will now define the VIDEO tag. The VIDEO tag tag supports the following attributes:
  • Name - The name of the video. Any alphanumeric entry will suffice
  • Type - A category type. Allowable entries here will be:
    • SciFi
    • Action
    • Drama
    • Comedy
    • Horror
    • Mystery
    • Documentary

The next step is to open up Validator.VTV and add an entry for our VIDEO tag.
                                
<TAG NAME="VIDEO"> 
  <VERSIONINFO VERSIONS="VIDML"/> 
  <ATTRIBUTES> 
    <ATTRIB AVALKEYS="" AVER="VIDML" NAME="NAME"/> 
    <ATTRIB AVALKEYS="" AVER="VIDML" NAME="TYPE"/> 
  <ATTRIBREQUIREMENTS> 
    <REQSET ELEMENTS="NAME, TYPE" VERSION="VIDML"> 
  </ATTRIBREQUIREMENTS> 
  </ATTRIBUTES> 
  <TAGOPTIONS> 
    <TAGOPTION NAME="CLOSINGTAG" VALUE="Required" VERSION="VIDML"/> 
  </TAGOPTIONS> 
  <TAGCONTEXT> 
    <VALID TAG="VIDEOML" VERSION="HTML20"> 
  </TAGCONTEXT> 
</TAG> 
Here we have defined a new tag, VIDEO and assigned the following rules:
  • Version - We have designated this tag to be part of the "VIDML" version namespace in VERSIONS.VTV.
  • Attributes - We have defined two attributes, Name and Type, and made them required via the ATTRIBREQUIREMENTS subtag
  • We have used TAGOPTIONS to require a closing tag for all occurrences of the VIDEO tag
  • We have assigned a TAGCONTEXT rule specifying that the VIDEO tag can only appear inside a VIDEOML tag


There are several items here that are incomplete. In the ATTRIBUTES subtag section you will notice that the AVALKEYS attribute is empty. The AVALKEYS attribute is used to map a comma separated list of attribute value rules from the table specified in ValueMap.vtv. We will create these rules now. The rules are fairly simple. The Name attribute can take any alphanumeric value. The Type attribute can only contain a specific set of keywords, namely the list of movie types I defined above.
The first rule is fairly simple as it is already done. Look at the following entry in ValueMap.vtv:
<VALKEY ID="0" NOTE="alphanum string" QUOTE="May Be Double" RE="Yes" TYPE="[a-zA-Z0-9]+"/> 

This rule sports a regular expression in the TYPE attribute which can be used to represent any alphanumeric string. We will now go back to our VIDEO tag entry in Validator.vtv and map the Name attribute to this rule using the ID value:
For those not famiiar with regular expressions, they employ specific wildcard symbols to match character expressions. The expression above essentially means "Take any combination of letters or numbers". There are many books and websites that teach the basics of regular expressions.
 <ATTRIB AVALKEYS="0" AVER="VIDML" NAME="NAME"/> 
The next attribute, Type, will require us to actually add some new literal entries to the ValueMap. Before you add any literal entries, you should perform a search through ValueMap.VTV. Many common entries already exist in there. For our Type attribute values however, we will need to create new entries. In order to do this you will need to locate the following tag within ValueMap.vtv: <NEXTKEY>. This is a sequential counter used by Homesite to keep track of the next ValueMap ID value to be generated. Since we are editing by hand, you will need to use this ID value as your starting value for your next entry. Add the following VALKEY tag entries, being careful to add one to the ID value for each one. (My current ValueMap has a starting NEXTKEY of 277.)

<VALKEY ID="277" QUOTE TYPE="SciFi"/>
<VALKEY ID="278" QUOTE TYPE="Action"/>
<VALKEY ID="279" QUOTE TYPE="Drama"/>
<VALKEY ID="280" QUOTE TYPE="Comedy"/>
<VALKEY ID="281" QUOTE TYPE="Horror"/>
<VALKEY ID="282" QUOTE TYPE="Mystery"/>
<VALKEY ID="283" QUOTE TYPE="Documentary"/>
<VALKEY ID="284" QUOTE TYPE="pie"/>

Once you have added these entries (remember, if your NEXTKEY ID is different you will need to offset accordingly. Once you have finished make sure you bump the NEXTKEY tag up to the appropriate value, as the Homesite Validator settings in the Settings dialog uses it to automatically generate the next value ID. Here is he ATTRIB tag to support our TYPE attribute:

 <ATTRIB AVALKEYS="277,78,279,80,281,282,283,284" AVER="VIDML" NAME="TYPE"/>
This rule maps the literal VALKEY entries in ValueMap.VTV to the TYPE attribute. Any other values will be flagged as errors.

Test Document

To test your new namespace, the following document can be used:

 <VIDEOML> 
   <VIDEO NAME="The Matrix" TYPE="SciFi"> 
</VIDEO>
</VIDEOML>
Try playing around with the attributes, mixing the tag order up, and whatever else you can think of to cause the validator engine to trigger errors on your document.

Conclusion

Now that you have a better understanding of the internal Validator VTML definitions, you have a much quicker way of adding new tag namespaces to the Validator configuration. GUI interfaces sometimes just get in the way, especially if you are a fast hand coder. There are a lot of other possibilities you could employ as well, including XML/XSLT translations to generate Validtor tag definitions automatically.

-----------------------------------------------------------------------

About the Author
Darren is a Senior Software Engineer with Macromedia. A principal member of the Visual Tools Team, Darren has contributed heavily to the Homesite, Cold Fusion Studio and JRun Studio products. Darren is currently working on the Dreamweaver/UltraDev product line. He can be reached at dforcier@macromedia.com