How to check html syntax using DocType:strict
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
How to check html syntax using DocType:strict
My sites are all using: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Before pasting into my CMS based sites I check the html code (without any html/body tags) with my cse v10.
If I'm checking an online web page I suppose CSE picksup the DocType from the page and does validation as per it.
But for my bits and pieces of html code how to I force it to use the strict DTD?
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Before pasting into my CMS based sites I check the html code (without any html/body tags) with my cse v10.
If I'm checking an online web page I suppose CSE picksup the DocType from the page and does validation as per it.
But for my bits and pieces of html code how to I force it to use the strict DTD?
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
Hello,
I'm sorry for the delay.
I think the best way to do this is to append the "start validation" program using the Configuration Editor. Try this:
* Press Ctrl+F5 in CSE HTML Validator to open the Configuration Editor
* Go to the Programs tab and select the Start validation program
* Add this to the end of the program:
* Finally, save your custom config file to a new filename and set the new config file to the default to use
That should simulate an XHTML 1.0 Strict document if there is no DOCTYPE. You can uncheck flag 180 to undo this behavior.
I'm sorry for the delay.
I think the best way to do this is to append the "start validation" program using the Configuration Editor. Try this:
* Press Ctrl+F5 in CSE HTML Validator to open the Configuration Editor
* Go to the Programs tab and select the Start validation program
* Add this to the end of the program:
Code: Select all
if isFlagSet(180) {
MessageEx(13,2011071901,#MSG_COMMENT,'[180] Simulating a XHTML 1.0 Strict DOCTYPE (if no DOCTYPE is encountered).');
setValueInt(3,2+32+128);
}
else {
MessageEx(13,2011071902,#MSG_COMMENT,'[180] DOCTYPE simulation off.');
}
That should simulate an XHTML 1.0 Strict document if there is no DOCTYPE. You can uncheck flag 180 to undo this behavior.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
Re: How to check html syntax using DocType:strict
I've done exactly the way you've specified but it isn't giving any error message for this html code:
Also I see in Validator Engine->Flags->180 is checked
Code: Select all
<p> hello
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
I'm sorry. It looks like more was needed than I first thought... please use this instead:
I think that should work, however, encountering a real DOCTYPE will not change many of those options back to the default so you may need to toggle flag 180 back and forth when switching to & from XHTML or the validator may try to enforce some XHTML constraints on HTML documents.
Code: Select all
if isFlagSet(180) {
MessageEx(13,2011071901,#MSG_COMMENT,'[180] Simulating a XHTML 1.0 Strict DOCTYPE.');
setValueInt(3,2+32+128);
activateCategory(33,1);
setValueInt(3,32);
setFlag(1,65536,1);
setFlag(1,64,1);
setFlag(1,262144,1);
setFlag(1,131072,1);
setFlag(1,524288,1);
setFlag(1,1,1);
setFlag(1,4194304,1);
setFlag(9,2,1);
setFlag(1,1048576,1);
setValueString(1,"For better backward compatibility with HTML, a space character should precede the '/' character.");
}
else {
MessageEx(13,2011071902,#MSG_COMMENT,'[180] DOCTYPE simulation off.');
}
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
Re: How to check html syntax using DocType:strict
What are those options? I wish validation from typed code or from url should give same validation results.
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
This should help (includes comments):rag_gupta wrote:What are those options? I wish validation from typed code or from url should give same validation results.
Code: Select all
setFlag(1,65536,1); // CSEVALFLAG1XMLCOMPAT (65536)
setFlag(1,64,1); // CSEVALFLAG1REQUIREOPTIONALENDTAGS (64)
setFlag(1,262144,1); // CSEVALFLAG1REQUIREQUICKCLOSE (262144)
setFlag(1,131072,1); // CSEVALFLAG1REQUIREQUOTEDATTVALUES (131072)
setFlag(1,524288,1); // CSEVALFLAG1NOUPPERCASE (524288)
setFlag(1,1,1); // CSEVALFLAG1CHECKNESTING (1)
setFlag(1,4194304,1); // CSEVALFLAG1REQUIREATTVALUES (4194304)
setFlag(9,2,1); // CSEVALFLAG2MATCHATTVALUECASE (2)
setFlag(1,1048576,1); // CSEVALFLAG1XMLSPACEWARNING
By setting some options to be stricter, then you should be able to get more consistent results regardless of the DOCTYPE.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
Re: How to check html syntax using DocType:strict
After changing the configuration, CSE is showing me error one by one and not all at once!
Pl. see the attmt.
Pl. see the attmt.
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
Please enable the Message Window (View->Windows->Message) so you can see the full text of the messages. Some messages are displayed only once and will say so at the end. For example, the message in the screenshot should end in "This message is displayed only once.", so that is by design for that particular message.rag_gupta wrote:After changing the configuration, CSE is showing me error one by one and not all at once!
Pl. see the attmt.
The reason for that is that some people want to use that attribute ("target") anyway, because it still works, and don't want a bunch of those error messages as just one is more than enough to let them know about "target" not being valid.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
Re: How to check html syntax using DocType:strict
With 180 flag enabled I'm not able to understand the reason of an error. I'm attaching the html file and the snapshot.
This code is present in this web page which when I validated with W3C validator gave this message:
This code is present in this web page which when I validated with W3C validator gave this message:
Please note that the error is with doctype strict and the web page is doctype Transitional.This document was successfully checked as XHTML 1.0 Transitional!
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
Thanks. I loaded error.html into CSE HTML Validator and reproduced the error message but there was a "?" at the end of the "</div>" on line 34 (which is not shown in the screenshot). If I remove the "?" then the error goes away. Typo?rag_gupta wrote:With 180 flag enabled I'm not able to understand the reason of an error. I'm attaching the html file and the snapshot.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 28
- Joined: Tue Nov 30, 2010 10:17 pm
Re: How to check html syntax using DocType:strict
When I'm copy-pasting from cse to text editor then only this question mark(?) is appearing.
But when I checked the same content in the web page, CSE isn't complaining. Strange, I'll get back.
But when I checked the same content in the web page, CSE isn't complaining. Strange, I'll get back.
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: How to check html syntax using DocType:strict
OK, please let me know what you find out, especially if you think the "?" is being added by some issue with CSE HTML Validator. Thank you.rag_gupta wrote:When I'm copy-pasting from cse to text editor then only this question mark(?) is appearing.
But when I checked the same content in the web page, CSE isn't complaining. Strange, I'll get back.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial