I'm testing a new configuration file and just about all of it works as expected. However, I'm getting an error message that shouldn't be thrown (at least I don't think it should).
The error message in question is #3 (The tbody error)...
Generated by CSE HTML Validator Professional v16.03 (https://www.htmlvalidator.com/)
1. Error in line 2 at character 7: The "lang" attribute is not valid for the "html" element. This element cannot have any attributes.
2. Error in line 7 at character 13: The "span" element is not a recognized element. Is it misspelled? 3. Error in line 9 at character 2: The "tbody" element is not a recognized element. Is it misspelled?
4. Error in line 9 at character 10: The "table" element cannot be used here. It is nested in another "table" element (which was started in line and cannot be nested. Has the previous "table" element been ended with an end tag? This element may be contained in "BODY". This element may not be contained in "TABLE".
5. Comment: (Grouped->Search Engine) Keyword density: error (1x - 16.7%), message (1x - 16.7%), Should (1x - 16.7%), Test (1x - 16.7%), throw (1x - 16.7%). Remember: Don't write SEO optimized content. Write for people, which is what search engines want. Complete list. 1 word excluded.
If you look at the HTML I'm validating, the "tbody" element isn't even in the file...
I'm glad that almost all of it is working as expected.
The "tbody" tag is an implied tag that CSE HTML Validator automatically adds if it's missing. If you pull up that page in Chrome, inspect it, and look at the Elements tab then you will see that Chrome adds it as well (after the "table" tag and before the first "tr" tag).
You can also look at the Structure tab in CSE HTML Validator and it will show (i) after the implied tags.
Hi Jerry, no problem! I didn't even think of it as a backhanded compliment and am glad you think CSE HTML Validator is awesome.
If you just want to get rid of that "tbody" message then try adding a "tbody" tag to your custom config file (with category (all) or HTML 4.0) with an optional end tag and set the valid range to "table". I suspect you removed the "tbody" tag that was already in the config file but this won't prevent the parser from adding it as an implied tag in tables. I haven't tested this but I'm fairly certain that this should eliminate the message about "tbody" not being recognized.... then if you want to throw an error if "tbody" is used then you can create a user function for that element that generates your own custom error message.
And one more quick question, since you're being so generous with your support time...
Can I use the setFlag() function to change the maximumErrors flag? I don't see what number to use described in the Help file, but I see the entry in the registry.
Albert Wiersch wrote:If you just want to get rid of that "tbody" message then try adding a "tbody" tag to your custom config file (with category (all) or HTML 4.0) with an optional end tag and set the valid range to "table". I suspect you removed the "tbody" tag that was already in the config file but this won't prevent the parser from adding it as an implied tag in tables. I haven't tested this but I'm fairly certain that this should eliminate the message about "tbody" not being recognized.... then if you want to throw an error if "tbody" is used then you can create a user function for that element that generates your own custom error message.
Hi Albert:
I tried the above, and adding TBODY as a recognized tag stopped the error message for the implied tag, until I added my own message into the Program Editor...
Jerry K wrote:And one more quick question, since you're being so generous with your support time...
Can I use the setFlag() function to change the maximumErrors flag? I don't see what number to use described in the Help file, but I see the entry in the registry.
Thanks AGAIN!
Jerry.
Hi Jerry, do you want to set/change the maximum number of errors before CSE HTML Validator stops the validation? That's not currently possible but I could look into adding that functionality if that is what you want to do.
I tried the above, and adding TBODY as a recognized tag stopped the error message for the implied tag, until I added my own message into the Program Editor...
Then my custom message appeared with the implied tag.
Is this the right place to add the error message (in the "Open tag name" type), or do I need to create a whole User Functions file for just this tag?
Thanks,
Jerry.
Are you using a user functions file already? If so then it should be easy to add another function to that file to display that message.
I recommend using user functions and a user functions file whenever possible because the user function files can be easily applied to almost any config file (including the latest and greatest)... but if not then you can keep it the way it is (in the config file using the Program Editor in the Programs tab of the Configuration Editor). Neither way is really "wrong"... each method has its advantages and disadvantages.
I've just added the ability to set the maximum number of errors and warnings using user functions (and override the defaults). This will be in the next update.
function onStartValidation() {
setValueInt(30,15); // set max errors to 15
setValueInt(31,15); // set max warnings to 15
}
UPDATE: I've also changed it so that the error message about unrecognized elements will not be generated for implied tags, so in the next update you will be able to remove the "tbody" elements you added to the config in order to suppress that error message. It seemed like this change made sense to do.
Albert Wiersch wrote:I've just added the ability to set the maximum number of errors and warnings using user functions (and override the defaults). This will be in the next update.
function onStartValidation() {
setValueInt(30,15); // set max errors to 15
setValueInt(31,15); // set max warnings to 15
}
UPDATE: I've also changed it so that the error message about unrecognized elements will not be generated for implied tags, so in the next update you will be able to remove the "tbody" elements you added to the config in order to suppress that error message. It seemed like this change made sense to do.
Hi Albert:
Thanks for both of these changes, they will come in VERY handy for my work. I look forward to trying them both when the update becomes available. I should also mention that I tried using the User Functions file and it made perfect sense for small changes. But, I'm making massive changes to the element validation, so it "felt right" to do them in the config file.
BTW, are there other implied tags that I should watch for, or is TBODY the only one
Your response speed and assistance are most appreciated!
You're welcome! I hope to release the v16.04 update next week.
Jerry K wrote:BTW, are there other implied tags that I should watch for, or is TBODY the only one
There are other implied tags but it's hard to say which ones you should watch for. "tbody" may be the "sneakiest" though. Hopefully with the next update you won't really have to watch for them anyway.