SUPPORT : Technotes : Syntax Checker
Why does the syntax checker say my HTML files contain errors?
Short Answer
Because they contain errors! ;-)
Long Answer
The syntax checker in BBEdit 5.0 and later is based on language templates generated from published DTDs. As it ships, BBEdit 5.1 includes support for HTML 3.2 and 4.0 (Transitional, Frameset, and Strict). BBEdit 6.0 adds support for HTML 4.01, XHTML 1.0 and WML 1.1.
As of its release, there are no known errors in the language templates which the 5.1 syntax checker uses. If the syntax checker reports an error, odds are that the checker is correct. If BBEdit's HTML checker does report an error, and you don't believe that it is correct in doing so, please check the currently available on-line HTML references.
The Web Design Group maintains an excellent site that has current specifications for HTML 3.2 and 4.0 at http://www.htmlhelp.com/.
For the definitive (but somewhat dry) HTML specifications, refer to the World Wide Web Consortium http://www.w3.org/; there's also an on-line validator at http://validator.w3.org/.
A Note About Attributes
In addition to checking the placement of html tags, the syntax checker in BBEdit 5.0 will also check to ensure that:
- each tag contains all required attributes
- each tag only contains valid attributes
- each attribute has a value of the appropriate type.
Note: The HTML 3.2 and 4.0 DTD's each define the valid content types for each attribute. However, this information is contained in the DTD in the form of comments and is generally not checked by an SGML Validator such as James Clark's sp, which is in use at http://validator.w3.org/.
The syntax checker in BBEdit is driven by language templates which have been built off of DTD's. This makes the checker a bit more complex, but it also provides it with additional functionality.
As of its release, there are no known errors in the language templates which the 5.0 syntax checker uses. If the syntax checker reports an error, odds are that the checker is correct. If BBEdit's HTML checker does report an error, and you don't believe that it is correct in doing so, please check a definitive HTML reference source. (In order to determine whether BBEdit is reporting a valid error in the value of an attribute you will probably need to read the relevant DTD's itself.)
But it works fine in the browser!
As Jim writes:
A syntax checker's lot in life is to point out problems and complain as loudly as possible about them.
A browser's lot in life is to do the most sensible thing it can given whatever you feed it, valid or not. So it isn't too surprising that HTML which fails validation and is ill formed will "work" in a browser.
It is also true that in the long run you will have to make compromises. There are also many instances of perfectly valid HTML which simply won't work in any of the major web browsers being used today.
We believe that the best course to follow is to create HTML documents which abide as closely to the published standards as possible. BBEdit will help you do this better than any other authoring tool on the market.