Home › Forums › General XMetaL Discussion › Using xml:lang Values to Control Spell Checking › Reply To: Using xml:lang Values to Control Spell Checking
Reply to: Using xml:lang Values to Control Spell Checking
May 26, 2010 at 1:15 amThe APIs are not documented in the Programmer's Guide (6.0) yet, but here's an example you can try with the Journalist demo.
It is still possible these APIs may change a little bit in the future (part of the reason we haven't documented them yet).
[code]
//*********************************************************
function spellService() {
//create the spell checker service
}
spellService.prototype.shouldSpellCheck = function(node) {
//spell check every node…
var spellCheck = 1;
//…unless it triggers one of the following tests
//node is an element
if (node.nodeType == 1) {
//element name =
//do not spell check
spellCheck = 0;
}
}
//node's parent's attribute called “Style” has a value equal to “Bullet”
if (node.parentNode.getAttribute(“Style”) == “Bullet”) {
//do not spell check
spellCheck = 0;
}
return spellCheck;
}
var spServ = new spellService();
ActiveDocument.SetSpellCheckerService(spServ);
[/code]
Note that because the journalist.mcr already has an “On_Document_Open_Complete” event macro you will want to incorporate this into that same section of the MCR file.
With that in place try the following XML file that uses the journalist.dtd:
[code]