PDA

View Full Version : Validation to HTML 4.01 Transitional


vwphillips
09-04-2006, 01:11 PM
I am attempting to validate my documents to HTML 4.01 Transitional
(these contain JavaScript code which is displayed a a text area value)

but is picking up errors in the JS comment lines

Error Line 172 column 11: end tag for element "FORM" which is not open.

// </form>



and text area lines

Warning Line 700 column 27: cannot generate system identifier for general entity "zxcopc".

if (window['zxcOpacity']&&zxcopc){ zxcOpacity(zxcp,zxcopc); }

An entity reference was found in the document, but there is no reference by that name defined. Often this is caused by misspelling the reference name, unencoded ampersands, or by leaving off the trailing semicolon (;). The most common cause of this error is unencoded ampersands in URLs as described by the WDG in "Ampersands in URLs".

Entity references start with an ampersand (&) and end with a semicolon (;). If you want to use a literal ampersand in your document you must encode it as "&amp;" (even inside URLs!). Be careful to end entity references with a semicolon or your entity reference may get interpreted in connection with the following text. Also keep in mind that named entity references are case-sensitive; &Aelig; and &aelig; are different characters.

If this error appears in some markup generated by PHP's session handling code, this article has explanations and solutions to your problem.

Note that in most documents, errors related to entity references will trigger up to 5 separate messages from the Validator. Usually these will all disappear when the original problem is fixed.



the actual HTML Code has not errors

so can I exclude these 'errors' from the validation?

Thanks

Bill Posters
09-04-2006, 02:01 PM
The problem is arising from the lack of space in the following string of characters…

&&zxcopc
As there's no space between the && and the var, the browser thinks it's looking at an SGML character code (i.e. &zxcopc;) whicg, of course, isn't what you want it to do.

Solution, add spaces where appropriate.

i.e.
&& zxcopc

You may have thought that you were being efficient by taking out the space, but you were only creating potential issues for yourself.
Some corners can't be cut.


As for validating documents which contain js, why not just throw all the js in an external js file and bring it in via a sourced script element?
That way, you can avoid presenting the js to the markup validator altogether.

Remember, separation of structure, presentation and behaviour/functionality means a place for all things and all things in their place.

i.e. keep your js out of your markup and in external files.