OBSOLETE: This document is now considered obsolete but is still available for reference. If possible, use TNPL and user functions for advanced customization. See also: Configuration Editor
Using the Configuration Editor
The Configuration Editor, which lets you define your own tags, attributes, messages, etc., is not available in the Lite and Home editions. It is only available in the Pro and Enterprise editions.
To go to the Configuration Editor, go to Options > Configuration Editor or press Ctrl+F5.
Adding a character entity is a relatively simple process. Follow these steps:
- Load CSS HTML Validator, go to the Configuration Editor and then the Entities tab.
- Enter the character entity that you wish to add in the text box. Do not include the ampersand (&) or semicolon. Do include all characters between the ampersand and semicolon.
- Click the New Entity button.
- Select the category to which the new entity belongs. Choose (all) if you don't care or want the entity to always be valid.
- Repeat the process for another entity or click the Close button if you are finished. If you are using CSS HTML Validator with a 3rd party HTML or text editor (or other program), then ensure that the new configuration file has been saved to disk in order for the new entity to become valid when using CSS HTML Validator within the 3rd party program.
Displaying a Message when an Element or Attribute is Used
Adding a simple message when an element or attribute is used is a relatively simple process. Follow these steps:
- Load CSS HTML Validator, go to the Configuration Editor and then the Programs tab.
- If you want to display a message when an element is used, then select the element that you want to display the message for in the Tag Name Being Configured drop-down. Select the Open tag name radio button. The tag name program (if any) that is executed when that element is used should appear in the Program Editor. Also make sure that the Enable open program for tag checkbox is checked so that the program will be enabled.
- If you want to display a message when an attribute is used, then select the attribute that you want to display the message for in the Attribute Being Configured drop-down. Select the Attribute program radio button. The program (if any) that is executed when that attribute is used should appear in the Program Editor. Also make sure that the Enable attribute program checkbox is checked so that the program will be enabled.
- Add the command to display a message to the program that is displayed. A basic command to do this looks like this:
Message(1, MSG_WARNING, "Message text here.");
. Instead of MSG_WARNING, these may also be used: MSG_ERROR, MSG_MESSAGE, and MSG_COMMENT.
- Save the configuration. We recommend using the Save Config As button to save your modified configuration file to a unique filename and not the default configuration filename. This is because the default configuration file may be overwritten the next time you install a different version or reinstall the same version.
- You're done!
Additional Examples
To display a message only if a flag is set (in this example, flag 150):
if (isFlagSet(150)) {
Message(1, MSG_WARNING, "[150] Message text here.");
}
Adding Elements and Attributes
One of the best features of CSS HTML Validator is that you can add your own tags to its configuration so that your own tags will validate. If you feel that your additions should have been in the default configuration that came with the program, then please let us know so that the additions may be included in a future release.
The documentation that comes with HTML Validator contains helpful information that you should use when trying to become familiar with customizing HTML Validator, although it is not currently complete and does not provide a 'step through' type guide. This page contains the steps you can take to configure HTML Validator to accept new tags. Use these examples and explanations to add other tags to CSS HTML Validator's configuration.
Example 1
Here is an example of some HTML tags and attributes that we would like CSS HTML Validator to accept as valid:
<object id=Crescendo
classid="clsid:0FC6BF2B-E16A-11CF-AB2E-0080AD08A326"
height=55
width=200>
<param name="Song"
value="../jbroo/midi/timewarp.mid">
<embed type="music/crescendo"
song="../jbroo/midi/timewarp.mid"
pluginspage="http://www.liveupdate.com/dl.html"
width=200
height=55>
<bgsound src="../jbroo/midi/timewarp.mid">
</object>
To begin edit the configuration, go to the Configuration Editor. From the dialog box that appears, you can change what tags and attributes HTML Validator accepts as correct or incorrect.
HTML Validator classifies tag names and attributes as belonging to a category. For instance, if a tag name is valid for HTML 2.0, that tag name will be classified as belonging to the HTML 2.0 category. If a tag name works only in Microsoft Internet Explorer, that tag name will belong to the category Microsoft IE Extensions.
You can add your own categories to HTML Validator, so let's add an Active X category for the "object" tag name that we will need to add later.
- Select the Categories tab.
- Type in 'Active X' in the text box (without the apostrophes).
- Click the New Category button.
- Double click Active X in the Categories list box so that it will appear in the Active categories list box; this will tell HTML Validator to recognize all tag names and tag attributes that are assigned to the Active X category when validating a document; this is like turning these tag names and attribute 'on'.
- Move to the Tag Names tab (v2.0 and older: click the Close button).
We can now add the "object" tag name and assign it to the Active X category by doing the following:
- Type 'object' in the text box in the Tag Name Controls section.
- Click the New Tag button.
- Choose Active X from the Tag Name Category drop down list box to assign this tag to the Active X category.
- This tag requires an end tag (a </object>) so ensure that Required is selected.
- We do not want to ignore any text between the <object> and the </object> tags so ensure that Ignore to end tag is NOT checked.
- Select Valid in the Range View section to display the locations where the new tag can appear.
- Double click "body" in the Tag names list box so the new tag can appear between <body> and </body> tags; this is called the range in which the tag may appear.
That's all that is need in order for HTML Validator to now accept the "object" tag name in the body section when the Active X category is active. Now we need to configure HTML Validator to accept the attributes and attribute values for the "object" tag name.
The first attribute we want to add is the "id" attribute. First click the Attributes tab. You can now add the attribute "id" by typing "id" into the edit box and clicking the New Attribute button. "id" will now appear in the Attributes list box. If you click on the new "id" attribute in the Attributes list box, you should see that the category is (undefined). Assign the attribute "id" to all categories by making sure that the attribute
"id" is selected in the Attributes list box (in the Attribute Controls section) and then by selecting (all) in the Attribute category drop down list. You may want to instead select the Active X category you created above, but selecting (all) is more general. You can now add this attribute to the "object" tag by performing the following steps:
- Ensure that the Tag Name Being Configured is "object".
- Double click the attribute "id" in the Attributes list box so that it now appears in the Tag attributes list box.
The tag name "object" will now accept the attribute "id", but what about the attribute value for "id"? "id" can have an attribute value that is a string. We need to tell CSS HTML Validator what "id" can be by editing the configuration for this attribute. To do this, select "id" in the Attribute list box and move to the Attribute Values tab and perform the following steps:
- Double click (string 2) so that it appears in the Tag attrib. values list box; "id" will now accept a value that is a valid (string 2) value; note that the values in parenthesis are built-in values and you can get information about them by clicking Help.
- Double click (string) so that it appears in the Tag attrib. values list box.
- Go back to the Attributes editor by clicking the Attributes tab.
Why are there two strings? (string) accepts only quoted strings and (string 2) accepts non-quoted strings. Since the value of "id" can be either, both values should be allowed for "id". Now we need to take care of the attribute "classid".
Since there is no "classid" attribute, we need to create one. Perform the following steps to create the new attribute and to assign it to the "object" tag name:
- Type "classid" in the text box in the Attribute Controls section.
- Click the New Attribute button.
- Select (all) from the Attribute category drop down list to accept this attribute as valid for all categories.
- Ensure that the Tag Name Being Configured is "object".
- Double click the attribute "classid" in the Attributes list box so that it now appears in the Tag attributes list box.
Why do we assign the attribute to all categories instead of the Active X category? You could assign the attribute to the Active X category, but it is usually better to assign certain attributes to all categories instead. Later there may be another tag name (call it tag name X) in a different category that uses the same attribute. If the "classid" attribute was also valid for the same category as tag name X's category, you would have to create another attribute "classid" but assign it to the other category. By assigning all categories to the attribute, you do not have to create another attribute. Also, because tag names are assigned categories, if a tag name's category is not active (turned 'on'), it doesn't matter if its attributes are valid or not because the whole tag is not valid.
Because "classid" should have a value that is a quoted string, perform the following steps:
- Ensure that the "classid" attribute is selected in the Attributes list box.
- Go to the Attribute Values tab.
- Double click (string) so that it appears in the Tag attrib. values list box.
- Go back to the Attributes editor by clicking the Attributes tab.
Now the "height" and "width" attributes need to be added. Searching through the attributes that are already created in the Attributes list box, we see that we will need to add these attributes because all of the current "height" and "width" attributes are for different categories. We'll make a 'generic' one that we will assign to (all) categories. Perform the following steps to do this:
- Type "height" in the text box in the Attribute Controls section.
- Click the New Attribute button.
- Select (all) from the Attribute category drop down list to accept this attribute as valid for all categories.
- Ensure that the Tag Name Being Configured is "object".
- Double click the attribute "height" in the Attributes list box so that it now appears in the Tag attributes list box.
- Type "width" in the text box in the Attribute Controls section.
- Click the New Attribute button.
- Select (all) from the Attribute category drop down list to accept this attribute as valid for all categories.
- Ensure that the Tag Name Being Configured is "object".
- Double click the attribute "width" in the Attributes list box so that it now appears in the Tag attributes list box.
The "height" and "width" attributes that were just added can have values that are positive integers. To allow these attributes to have these values, perform the following steps:
- Ensure that the "height" attribute that you just created is selected in the Attributes list box (look at the number in parenthesis that follows the attribute (i.e. "height" (176), 176 is the number in parenthesis) to help you determine which "height" is the one that you just created)
- Go to the Attribute Values tab.
- Double click (pos integer) so that it appears in the Tag attrib. values list box.
- Go back to the Attributes editor by clicking the Attributes tab (v2.0 and older: click the Close button).
- Ensure that the "width" attribute that you just created is selected in the Attributes list box.
- Go to the Attribute Values tab (v2.0 and older: click the Edit Attribute Values button).
- Double click (pos integer) so that it appears in the Tag attrib. values list box.
- Click the Close button.
That's all that is needed to make the "object" tag and its attributes (as listed above) recognizable to HTML Validator. For the "param" tag name, you should notice that it is already in the configuration as a Java tag name, so nothing additional needs to be done for this tag name except to make sure that the Java category is in the Active categories list box (Java category is 'on'). You should also notice that the "bgsound" tag name is also already entered as a Microsoft IE Extension tag name, so nothing additional needs to be done for this tag name except to make sure that the Microsoft IE Extension category is in the Active categories list box. The last thing to do is to add the "embed" tag name. You should now be able to do this with some hints:
- Create the "embed" tag name as an Active X tag name.
- Remember to click No end tag because this tag does not have an end tag (</embed>).
- Remember to assign a valid range to this tag (i.e. "body").
- You will need to create "type", "song", and "pluginspage" attributes that have values of strings.
- You can use the "height" and "width" attributes that you created earlier for the "object" tag name so you should not create additional "height" and "width" attributes.
Example 2 (simple example)
You use a tag called "accessed" and want to add this tag to the configuration and ignore all of its attributes.
- Go to the Configuration Editor, Tag Names tab.
- Type "accessed" (without the quotes) in the text box in the Tag Name Controls section.
- Click the New Tag button.
- Choose (all) in the Tag Name Category drop down list to assign the new tag to all categories.
- Select the appropriate radio button option in the End Tag section to specify whether an end tag is not used, required, or optional for the new tag being added.
- Select Valid in the Range View section to display the locations where the new tag can appear.
- Double click (everywhere) in the Tag names list box. Alternatively, double click the tags where the tag being added may be used (like 'body' to allow use only in a "body" section).
- Now, to ignore all of this tag's attributes, go to the Attributes tab.
- Make sure that the Tag Name Being Configured is the tag that you just added (in this example it should be 'accessed').
- Double click the (ignore all) attribute in the Attributes list box to add the attribute to the Tag attributes list box.
- Save the configuration. We recommend using the Save Config As button to save your modified configuration file to a unique filename and not the default configuration filename. This is because the default configuration file may be overwritten the next time you install a different version or reinstall the same version.
- You're done!
You use an attribute called "ms_positioning" in the "body" element and want to add this attribute to the configuration and ignore it so it won't generate error messages.
- Go to the Configuration Editor, Attributes tab.
- Type "ms_positioning" (without the quotes) in the text box in the Attribute Controls section.
- Click the New Attribute button.
- Choose (all) in the Attribute category drop down list to assign the new attribute to all categories.
- Select "body (005)" as the Tag Name Being Configured.
- Double-click "ms_positioning" in the Attributes list box to add it to the Tag attributes list box.
- Go to the Attribute Values tab. Make sure that "ms_positioning" is the currently selected Attribute Being Configured.
- Double-click "(ignore value)" in the Attribute values list box to add it to the Attribute's attribute values list box. This will allow the "ms_positioning" attribute to have any value.
- Save the configuration. We recommend using the Save Config As button to save your modified configuration file to a unique filename and not the default configuration filename. This is because the default configuration file may be overwritten the next time you install a different version or reinstall the same version.
- You're done!