1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
|
'\"
'\" Generated from tnc.xml
'\"
'\" BEGIN man.macros
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
. ie !"\\$2"" .TP \\n()Cu
. el .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1 \\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\" Draw three-sided box if this is the box's first page,
.\" draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
.de DS
.RS
.nf
.sp
..
.de DE
.fi
.RE
.sp
..
.de SO
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
.de SE
.fi
.ft R
.LP
See the \\fBoptions\\fR manual entry for details on the standard options.
..
.de OP
.LP
.nf
.ta 4c
Command-Line Name: \\fB\\$1\\fR
Database Name: \\fB\\$2\\fR
Database Class: \\fB\\$3\\fR
.fi
.IP
..
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
.if t .ft C
..
.de CE
.fi
.if t .ft R
.RE
..
.de UL
\\$1\l'|0\(ul'\\$2
..
'\" END man.macros
.TH tnc n "" Tcl ""
.BS
.SH NAME
tnc \- tnc is an expat parser object extension, that validates the XML
stream against the document DTD while parsing.
.SH SYNOPSIS
.nf
package require tdom
package require tnc
set parser [expat]
tnc $parser enable
.fi
.BE
.SH DESCRIPTION
.PP
\&\fItnc\fR adds the C handler set "tnc" to a 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.
.PP
This handler set has only three methods:
.TP
\&\fB\fBtnc\fP \fIparserObj\fB \fBenable\fP
\&\fR
.RS
.PP
Adds the tnc C handler set to a Tcl expat parser object.
.RE
.TP
\&\fB\fBtnc\fP \fIparserObj\fB \fBremove\fP
\&\fR
.RS
.PP
Removes the tnc validatore from the parser \fIparserObj\fR
and frees all information, stored by it.
.RE
.TP
\&\fB\fBtnc\fP \fIparserObj\fB \fBgetValidateCmd\fP \fB?validateCmdName?\fP
\&\fR
.RS
.PP
Returns a new created validation command, if one is available
from the parser command, otherwise it signals error. The name of the validation
command is the \fIvalidateCmdName\fR, if this optional argument was given, or
a random chosen name. A validation command is available in a parser command,
if the parser with tnc enabled was previously used, to parse an XML document
with a valid doctype declaration, a valid external subset, if one was given by
the doctype declaration, and a valid internal subset. The further document
doesn't need to be valid, to make the validation command available. The
validation command can only get received one time from the parser command. The
created validation command has this syntax:
.CS
\&\fBvalidationCmd\fP \fImethod\fR \fI?args?\fR
.CE
.PP
The valid methods are:
.TP
\&\fB\fBvalidateDocument\fP \fIdomDocument\fB \fI?varName?\fB
\&\fRChecks, if the given domDocument is valid against the DTD
information represented by the validation command. Returns 1, if the document
ist valid, 0 otherwise. If the \fIvarName\fR argument is given, then the
variable it names is set to the detected reason for the validation error or to
the empty string in case of a valid document.
.TP
\&\fB\fBvalidateTree\fP \fIelementNode\fB \fI?varName?\fB
\&\fRChecks, if the given subtree with \fIdomNode\fR as root element
is a possible valid subtree of a document conforming to the DTD information
represented by the validation command. IDREF could not checked, while
validating only a subtree, but it is checked, that every known ID attribute in
the subtree is unique. Returns 1, if the subtree is OK, 0 otherwise. If the
\&\fIvarName\fR argument is given, then the variable it names is set to the
detected reason for the validation error or to the empty string in case of
a valid subtree.
.TP
\&\fB\fBvalidateAttributes\fP \fIelementNode\fB \fI?varName?\fB
\&\fRChecks, if there is an element declaration for the name of the
\&\fIelementNode\fR in the DTD represented by the validation command and, if
yes, if the attributes of the \fIelementNode\fR are conform to the ATTLIST
declarations for that element in the DTD. Returns 1, if the attributes and
there value types are OK, 0 otherwise. If the \fIvarName\fR argument is given,
then the variable it names is set to the detected reason for the validation
error or to the empty string in case the element has all its required
attributes, only declared attributes and the values of the attributes matches
there type.
.TP
\&\fB\fBdelete\fP
\&\fRDeletes the validation command and frees the memory used by
it. Returns the empty string.
.RE
.SH BUGS
.PP
The validation error reports could be much more informative and
user-friendly.
.PP
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.
.PP
It isn't possible to validate XML documents with standalone="yes" in the
XML Declaration
.PP
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.
.SH KEYWORDS
Validation, DTD
|