Error Message for Non-Existent Element

For technical support and bug reports for all editions of CSS HTML Validator, including htmlval for Linux and Mac.
Jerry K
Rank I - Novice
Posts: 13
Joined: Tue Apr 19, 2016 9:51 am

Error Message for Non-Existent Element

Post by Jerry K »

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 8) 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...

Code: Select all

<html lang="en">
<head>
<title>Test</title>
</head>
<body>
<h5>Should <span>throw</span> an error message</h5>
<table>
<tr><td><table></table></td></tr>
</table>
<table>
</table>
</body>
</html>
I tried exporting to an XML file and searching for "tbody" in the programs, but didn't turn up anything.

Any thoughts? My config file is attached.

Thanks!
You do not have the required permissions to view the files attached to this post.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

Hi Jerry,

I'm glad that almost all of it is working as expected. :D

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Jerry K
Rank I - Novice
Posts: 13
Joined: Tue Apr 19, 2016 9:51 am

Re: Error Message for Non-Existent Element

Post by Jerry K »

Hi Albert:

I see. So, using a configuration file, how does one suppress messages for "implied tags"?

BTW, sorry for the backhanded compliment. I think CSE is pretty freakin' awesome and it's been my goto tool for years. :)

Thanks again,

Jerry.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Jerry K
Rank I - Novice
Posts: 13
Joined: Tue Apr 19, 2016 9:51 am

Re: Error Message for Non-Existent Element

Post by Jerry K »

Thanks Albert, I'll give it a try.

And one more quick question, since you're being so generous with your support time... :wink:

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.
Jerry K
Rank I - Novice
Posts: 13
Joined: Tue Apr 19, 2016 9:51 am

Re: Error Message for Non-Existent Element

Post by Jerry K »

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...

Code: Select all

Message($TRUE, $MSG_ERROR, "TBODY found.");
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.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

Jerry K wrote:And one more quick question, since you're being so generous with your support time... :wink:

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

Jerry K wrote: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...

Code: Select all

Message($TRUE, $MSG_ERROR, "TBODY found.");
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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

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.

Example:

Code: Select all

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, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Lou
Rank V - Professional
Posts: 297
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO

Re: Error Message for Non-Existent Element

Post by Lou »

Sometimes THAT I can use :)

Now if we could figure out how to get the system to figure out how to "read" PHP if statements to avoid HTML errors... </joke>
Lou
Say what you will about Sisyphus. He always has work.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

Lou wrote:Now if we could figure out how to get the system to figure out how to "read" PHP if statements to avoid HTML errors... </joke>
There is a missing <joke> start-tag. Maybe I need to come up with a new product, CSE Joke Validator. :D
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
User avatar
Lou
Rank V - Professional
Posts: 297
Joined: Fri Jul 29, 2005 5:55 pm
Location: CO

Re: Error Message for Non-Existent Element

Post by Lou »

yes, error code 13, or 666 or some other number that we already don't like.
Lou
Say what you will about Sisyphus. He always has work.
Jerry K
Rank I - Novice
Posts: 13
Joined: Tue Apr 19, 2016 9:51 am

Re: Error Message for Non-Existent Element

Post by Jerry K »

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.

Example:

Code: Select all

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!

Jerry.
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: Error Message for Non-Existent Element

Post by Albert Wiersch »

Hi Jerry,

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.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial