Page 1 of 1

Error Message for Non-Existent Element

Posted: Thu May 26, 2016 1:52 pm
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!

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 2:13 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 2:38 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 3:30 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 3:42 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 4:05 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 5:33 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 5:38 pm
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.

Re: Error Message for Non-Existent Element

Posted: Thu May 26, 2016 7:19 pm
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.

Re: Error Message for Non-Existent Element

Posted: Fri May 27, 2016 10:24 am
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>

Re: Error Message for Non-Existent Element

Posted: Fri May 27, 2016 10:52 am
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

Re: Error Message for Non-Existent Element

Posted: Sat May 28, 2016 9:09 am
by Lou
yes, error code 13, or 666 or some other number that we already don't like.

Re: Error Message for Non-Existent Element

Posted: Wed Jun 01, 2016 8:30 am
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.

Re: Error Message for Non-Existent Element

Posted: Wed Jun 01, 2016 9:37 am
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.