# Validating the code

Find Unbalanced Tags - To look for opening tags without a matching closing tag or vice versa. When checking Alpha knows which tags have optional opening tags, which have optional closing tags and which may not have closing tags. If any errors are found a window with error messages is opened. The possible error messages are:

TAG may not have a closing tag | A closing tag for an element which may not have one has been found, like </BR>.
TAG1 must be closed before TAG2 | A closing tag is missing, like in this case: <B><I></B>. When a closing tag is missing Alpha implicitly inserts one and continue the checking as if the closing tag would have been there. This may lead to that one error produces two error messages if the tags are nested.
Closing TAG without a matching opening tag | A tag </TAG> has been found with no corresponding <TAG>.

Check Tags - A more complete validation, and therefore more time consuming. Note: This is not a strict validation! There are several things which are not checked, in particular the attributes are not checked.

If there is an HTML 4.0 document type declaration on the beginning of the document Alpha will use it to determine which elements are legal. Currently all document type declarations other than HTML 4.0 are ignored. If there is no document type declaration in the beginning of the document the transitional or the frameset declaration will be used depending on what is appropriate.

In this case the possible error messages are:

Unmatched < | A single < has been found.
Unmatched > | A single > has been found.
TAG is unknown | An unknown tag has been found. Note: If you have added new custom elements to HTML mode they are all considered to be unknown when validating. There is no way for HTML mode to tell where they are allowed.
TAG1 may not contain TAG2 | TAG2 has been found in a context where it may not be. Example: `<TABLE><B>` <B> may not be inside <TABLE>.
TAG may not contain text | Plain text has been found inside a tag which may not contain text. Example: `<UL>text.` <UL> may only contain <LI> tags.
TAG may not have a closing tag | A closing tag for an element which may not have one has been found, like </BR>.
TAG1 must be closed before TAG2 | A closing tag is missing, like in this case: <B><I></B>. When a closing tag is missing Alpha implicitly inserts one and continue the checking as if the closing tag would have been there. This may lead to that one error produces two error messages if the tags are nested.
Closing TAG without a matching opening tag | A tag </TAG> has been found with no corresponding <TAG>.
Multiple HTML tags | More than one HTML tag have been found. This can be the result of an implicitly inserted HTML tag.
Multiple HEAD tags | More than one HEAD tag have been found. This can be the result of an implicitly inserted HEAD tag.
Multiple BODY tags | More than one BODY tag have been found. This can be the result of an implicitly inserted BODY tag.
Text after </HTML> | Some text have been found after the closing </HTML>.

Unfortunately the error messages are not always so very helpful. A few tips to help you debugging:

- Always try to fix the first error first. Often an error can produce more than one error message.
- Some tags have optional closing tags, P for example. That Alpha says there is a closing tag without a matching opening tag may be because a closing tag have been implicitly inserted.
- The element TBODY has both optional opening and closing tag. Therefore you may see error messages referring to TBODY although you have no TBODY tags in your document.
- The Web Design Group has very good documentation about in which context each element may appear.