Hello,
CSE HTML Validator Pro+ v11 will allow a "user functions" file that makes it easier to configure CSE HTML Validator and keep the configuration through updates.
I don't think it will be too difficult to do what you want. In the user functions file, which is just a text file with functions, you could do something like this:
- Code: Select all
function onStartValidation() {
#indivcount=0;
$divclassarray='';
}
function onStartTag_div() {
#indivcount++;
// Message(1,MSG_MESSAGE,'<div> level '+$indivcount+'.'); // for testing
if hasAtt("class") {
#classindex=getAttIndex("class");
$classvalue=getAttValue(#classindex);
// Message(1,MSG_MESSAGE,'<div class="'+$classvalue+'">.'); // for testing
if matchNoCase($classvalue,"XYZ") {
if isValueInArray("divclassarray","ABC")>=0 {
Message(1,MSG_ERROR,'Cannot nest <div class="'+$classvalue+'"> under <div class="ABC">.');
}
}
$divclassarray[#indivcount]=$classvalue;
}
}
function onEndTag_div() {
$divclassarray[#indivcount]='';
#indivcount--;
}
function onStartTag_input() {
if isValueInArray("divclassarray","ABC")>=0 {
Message(1,MSG_ERROR,'Cannot nest <input> under <div class="ABC">.');
}
}
Save the above code in a file like "MyUserFunctions.cfg" and specify it in the Validator Engine Options->Validator Engine->Config File tab.
I gave the above a brief test and it seems to work well.
You will be able to do this in the upcoming v11 PUBLIC BETA, which I expect to release in about two weeks or so. If you'd like to try this sooner, I can send you a test build. Let me know!