tnc -
tnc is an expat parser object extension, that validates the XML
stream against the document DTD while parsing.
package require tdom package require tnc set parser [expat] tnc $parser enable
tnc adds the C handler set "tnc" to an tcl expat parser obj. This handler set is a simple DTD validator. If the validator detects a validation error, it sets the interp result, signals error and stops parsing. There isn't any validation error recovering. As a consequence, only valid documents are completely parsed.
This handler set has only two methods:
Adds the tnc C handler set to a Tcl expat parser object.
The validation error reports could be much more informative and user-friendly.
The validator doesn't detect ambiguous content models (see XML recomendation Section 3.2.1 and Appendix E). Most Java validators also doesn't, but handle such content models right anyhow. Tnc does not; if your DTD has such ambiguous content models, tnc can not used to validate documents against such (not completely XML spec compliant) DTDs.
You cannot validate XML documents with standalone="yes" in the XML Declaration
Violations of the validity constraints Proper Group/PE Nesting and Proper Conditional Section/PE Nesting are not detected. They could only happen inside a invalid DTD, not in the content of a document.