1 * Summary: The DTD validation 2 * Description: API for the DTD handling and the validity checking 3 * 4 * Copy: See Copyright for the status of this software. 5 * 6 * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A. 7 8 /if not defined(XML_VALID_H__) 9 /define XML_VALID_H__ 10 11 /include "libxmlrpg/xmlversion" 12 /include "libxmlrpg/xmlerror" 13 /include "libxmlrpg/tree" 14 /include "libxmlrpg/list" 15 /include "libxmlrpg/xmlautomata" 16 /include "libxmlrpg/xmlregexp" 17 18 * Validation state added for non-determinist content model. 19 20 d xmlValidStatePtr... 21 d s * based(######typedef######) 22 23 * xmlValidityErrorFunc: 24 * @ctx: usually an xmlValidCtxtPtr to a validity error context, 25 * but comes from ctxt->userData (which normally contains such 26 * a pointer); ctxt->userData can be changed by the user. 27 * @msg: the string to format *printf like vararg 28 * @...: remaining arguments to the format 29 * 30 * Callback called when a validity error is found. This is a message 31 * oriented function similar to an *printf function. 32 33 d xmlValidityErrorFunc... 34 d s * based(######typedef######) 35 d procptr 36 37 * xmlValidityWarningFunc: 38 * @ctx: usually an xmlValidCtxtPtr to a validity error context, 39 * but comes from ctxt->userData (which normally contains such 40 * a pointer); ctxt->userData can be changed by the user. 41 * @msg: the string to format *printf like vararg 42 * @...: remaining arguments to the format 43 * 44 * Callback called when a validity warning is found. This is a message 45 * oriented function similar to an *printf function. 46 47 d xmlValidityWarningFunc... 48 d s * based(######typedef######) 49 d procptr 50 51 * xmlValidCtxt: 52 * An xmlValidCtxt is used for error reporting when validating. 53 54 d xmlValidCtxtPtr... 55 d s * based(######typedef######) 56 57 d xmlValidCtxt ds based(xmlValidCtxtPtr) 58 d align qualified 59 d userdata * void * 60 d error like(xmlValidityErrorFunc) Error callback 61 d warning like(xmlValidityWarningFunc) Warning callback 62 * 63 * Node analysis stack used when validating within entities 64 * 65 d node like(xmlNodePtr) Current parsed Node 66 d nodeNr 10i 0 Parsing stack depth 67 d nodeMax 10i 0 Max stack depth 68 d nodeTab * xmlNodePtr * 69 * 70 d finishDtd 10u 0 Finish validtng DTD? 71 d doc like(xmlDocPtr) The document 72 d valid 10i 0 Temp check result 73 * 74 * state state used for non-determinist content validation 75 * 76 d vstate * xmlValidState * 77 d vstateNr 10i 0 Validat. stack depth 78 d vstateMax 10i 0 Max stack depth 79 d vstateTab * xmlValidState * 80 * 81 /if defined(LIBXML_REGEXP_ENABLED) 82 d am like(xmlAutomataPtr) The automata 83 d state like(xmlAutomataStatePtr) Automata build state 84 /else 85 d am * 86 d state * 87 /endif 88 89 * ALL notation declarations are stored in a table. 90 * There is one table per DTD. 91 92 d xmlNotationTablePtr... 93 d s * based(######typedef######) 94 95 * ALL element declarations are stored in a table. 96 * There is one table per DTD. 97 98 d xmlElementTablePtr... 99 d s * based(######typedef######) 100 101 * ALL attribute declarations are stored in a table. 102 * There is one table per DTD. 103 104 d xmlAttributeTablePtr... 105 d s * based(######typedef######) 106 107 * ALL IDs attributes are stored in a table. 108 * There is one table per document. 109 110 d xmlIDTablePtr s * based(######typedef######) 111 112 * ALL Refs attributes are stored in a table. 113 * There is one table per document. 114 115 d xmlRefTablePtr s * based(######typedef######) 116 117 * Notation 118 119 d xmlAddNotationDecl... 120 d pr extproc('xmlAddNotationDecl') 121 d like(xmlNotationPtr) 122 d ctxt value like(xmlValidCtxtPtr) 123 d dtd value like(xmlDtdPtr) 124 d name * value options(*string) const xmlChar * 125 d PublicID * value options(*string) const xmlChar * 126 d SystemID * value options(*string) const xmlChar * 127 128 /if defined(LIBXML_TREE_ENABLED) 129 d xmlCopyNotationTable... 130 d pr extproc('xmlCopyNotationTable') 131 d like(xmlNotationPtr) 132 d table value like(xmlNotationTablePtr) 133 /endif LIBXML_TREE_ENABLED 134 135 d xmlFreeNotationTable... 136 d pr extproc('xmlFreeNotationTable') 137 d table value like(xmlNotationTablePtr) 138 139 /if defined(LIBXML_OUTPUT_ENABLED) 140 d xmlDumpNotationDecl... 141 d pr extproc('xmlDumpNotationDecl') 142 d buf value like(xmlBufferPtr) 143 d nota value like(xmlNotationPtr) 144 145 d xmlDumpNotationTable... 146 d pr extproc('xmlDumpNotationTable') 147 d buf value like(xmlBufferPtr) 148 d table value like(xmlNotationTablePtr) 149 /endif LIBXML_OUTPUT_ENABLD 150 151 * Element Content 152 * the non Doc version are being deprecated 153 154 d xmlNewElementContent... 155 d pr extproc('xmlNewElementContent') 156 d like(xmlElementContentPtr) 157 d name * value const xmlChar * 158 d type value like(xmlElementContentType) 159 160 d xmlCopyElementContent... 161 d pr extproc('xmlCopyElementContent') 162 d like(xmlElementContentPtr) 163 d content value like(xmlElementContentPtr) 164 165 d xmlFreeElementContent... 166 d pr extproc('xmlFreeElementContent') 167 d cur value like(xmlElementContentPtr) 168 169 * the new versions with doc argument 170 171 d xmlNewDocElementContent... 172 d pr extproc('xmlNewDocElementContent') 173 d like(xmlElementContentPtr) 174 d doc value like(xmlDocPtr) 175 d name * value const xmlChar * 176 d type value like(xmlElementContentType) 177 178 d xmlCopyDocElementContent... 179 d pr extproc('xmlCopyDocElementContent') 180 d like(xmlElementContentPtr) 181 d doc value like(xmlDocPtr) 182 d content value like(xmlElementContentPtr) 183 184 d xmlFreeDocElementContent... 185 d pr extproc('xmlFreeDocElementContent') 186 d doc value like(xmlDocPtr) 187 d cur value like(xmlElementContentPtr) 188 189 d xmlSnprintfElementContent... 190 d pr extproc('xmlSnprintfElementContent') 191 d buf 65535 options(*varsize) 192 d size 10i 0 value 193 d content value like(xmlElementContentPtr) 194 d englob 10i 0 value 195 196 /if defined(LIBXML_OUTPUT_ENABLED) 197 * DEPRECATED 198 d xmlSprintfElementContent... 199 d pr extproc('xmlSprintfElementContent') 200 d buf 65535 options(*varsize) 201 d content value like(xmlElementContentPtr) 202 d englob 10i 0 value 203 /endif LIBXML_OUTPUT_ENABLD 204 205 * DEPRECATED 206 207 * Element 208 209 d xmlAddElementDecl... 210 d pr extproc('xmlAddElementDecl') 211 d like(xmlElementPtr) 212 d ctxt value like(xmlValidCtxtPtr) 213 d dtd value like(xmlDtdPtr) 214 d name * value options(*string) const xmlChar * 215 d type value like(xmlElementTypeVal) 216 d content value like(xmlElementContentPtr) 217 218 /if defined(LIBXML_TREE_ENABLED) 219 d xmlCopyElementTable... 220 d pr extproc('xmlCopyElementTable') 221 d like(xmlElementTablePtr) 222 d table value like(xmlElementTablePtr) 223 /endif LIBXML_TREE_ENABLED 224 225 d xmlFreeElementTable... 226 d pr extproc('xmlFreeElementTable') 227 d table value like(xmlElementTablePtr) 228 229 /if defined(LIBXML_OUTPUT_ENABLED) 230 d xmlDumpElementTable... 231 d pr extproc('xmlDumpElementTable') 232 d buf value like(xmlBufferPtr) 233 d table value like(xmlElementTablePtr) 234 235 d xmlDumpElementDecl... 236 d pr extproc('xmlDumpElementDecl') 237 d buf value like(xmlBufferPtr) 238 d elem value like(xmlElementPtr) 239 /endif LIBXML_OUTPUT_ENABLD 240 241 * Enumeration 242 243 d xmlCreateEnumeration... 244 d pr extproc('xmlCreateEnumeration') 245 d like(xmlEnumerationPtr) 246 d name * value options(*string) const xmlChar * 247 248 d xmlFreeEnumeration... 249 d pr extproc('xmlFreeEnumeration') 250 d cur value like(xmlEnumerationPtr) 251 252 /if defined(LIBXML_TREE_ENABLED) 253 d xmlCopyEnumeration... 254 d pr extproc('xmlCopyEnumeration') 255 d like(xmlEnumerationPtr) 256 d cur value like(xmlEnumerationPtr) 257 /endif LIBXML_TREE_ENABLED 258 259 * Attribute 260 261 d xmlAddAttributeDecl... 262 d pr extproc('xmlAddAttributeDecl') 263 d like(xmlAttributePtr) 264 d ctxt value like(xmlValidCtxtPtr) 265 d dtd value like(xmlDtdPtr) 266 d elem * value options(*string) const xmlChar * 267 d name * value options(*string) const xmlChar * 268 d ns * value options(*string) const xmlChar * 269 d type value like(xmlAttributeType) 270 d def value like(xmlAttributeDefault) 271 d defaultValue * value options(*string) const xmlChar * 272 d tree value like(xmlEnumerationPtr) 273 274 /if defined(LIBXML_TREE_ENABLED) 275 d xmlCopyAttributeTable... 276 d pr extproc('xmlCopyAttributeTable') 277 d like(xmlAttributeTablePtr) 278 d table value like(xmlAttributeTablePtr) 279 /endif LIBXML_TREE_ENABLED 280 281 d xmlFreeAttributeTable... 282 d pr extproc('xmlFreeAttributeTable') 283 d table value like(xmlAttributeTablePtr) 284 285 /if defined(LIBXML_OUTPUT_ENABLED) 286 d xmlDumpAttributeTable... 287 d pr extproc('xmlDumpAttributeTable') 288 d buf value like(xmlBufferPtr) 289 d table value like(xmlAttributeTablePtr) 290 291 d xmlDumpAttributeDecl... 292 d pr extproc('xmlDumpAttributeDecl') 293 d buf value like(xmlBufferPtr) 294 d attr value like(xmlAttributePtr) 295 /endif LIBXML_OUTPUT_ENABLD 296 297 * IDs 298 299 d xmlAddID pr extproc('xmlAddID') 300 d like(xmlIDPtr) 301 d ctxt value like(xmlValidCtxtPtr) 302 d doc value like(xmlDocPtr) 303 d value * value options(*string) const xmlChar * 304 d attr value like(xmlAttrPtr) 305 306 d xmlFreeIdTable pr extproc('xmlFreeIDTable') 307 d table value like(xmlIDTablePtr) 308 309 d xmlGetID pr extproc('xmlGetID') 310 d like(xmlAttrPtr) 311 d doc value like(xmlDocPtr) 312 d ID * value options(*string) const xmlChar * 313 314 d xmlIsID pr 10i 0 extproc('xmlIsID') 315 d doc value like(xmlDocPtr) 316 d node value like(xmlNodePtr) 317 d attr value like(xmlAttrPtr) 318 319 d xmlRemoveID pr 10i 0 extproc('xmlRemoveID') 320 d doc value like(xmlDocPtr) 321 d attr value like(xmlAttrPtr) 322 323 * IDREFs 324 325 d xmlAddRef pr extproc('xmlAddRef') 326 d like(xmlRefPtr) 327 d ctxt value like(xmlValidCtxtPtr) 328 d doc value like(xmlDocPtr) 329 d value * value options(*string) const xmlChar * 330 d attr value like(xmlAttrPtr) 331 332 d xmlFreeRefTable... 333 d pr extproc('xmlFreeRefTable') 334 d table value like(xmlRefTablePtr) 335 336 d xmlIsRef pr 10i 0 extproc('xmlIsRef') 337 d doc value like(xmlDocPtr) 338 d node value like(xmlNodePtr) 339 d attr value like(xmlAttrPtr) 340 341 d xmlRemoveRef pr 10i 0 extproc('xmlRemoveRef') 342 d doc value like(xmlDocPtr) 343 d attr value like(xmlAttrPtr) 344 345 d xmlGetRefs pr extproc('xmlGetRefs') 346 d like(xmlListPtr) 347 d doc value like(xmlDocPtr) 348 d ID * value options(*string) const xmlChar * 349 350 * The public function calls related to validity checking. 351 352 /if defined(LIBXML_VALID_ENABLED) 353 * Allocate/Release Validation Contexts 354 355 d xmlNewValidCtxt... 356 d pr extproc('xmlNewValidCtxt') 357 d like(xmlValidCtxtPtr) 358 359 d xmlFreeValidCtxt... 360 d pr extproc('xmlFreeValidCtxt') 361 d ctxt value like(xmlValidCtxtPtr) 362 363 d xmlValidateRoot... 364 d pr 10i 0 extproc('xmlValidateRoot') 365 d ctxt value like(xmlValidCtxtPtr) 366 d doc value like(xmlDocPtr) 367 368 d xmlValidateElementDecl... 369 d pr 10i 0 extproc('xmlValidateElementDecl') 370 d ctxt value like(xmlValidCtxtPtr) 371 d doc value like(xmlDocPtr) 372 d elem value like(xmlElementPtr) 373 374 d xmlValidNormalizeAttributeValue... 375 d pr * extproc( xmlChar * 376 d 'xmlValidNormalizeAttributeValue') 377 d doc value like(xmlDocPtr) 378 d elem value like(xmlNodePtr) 379 d name * value options(*string) const xmlChar * 380 d value * value options(*string) const xmlChar * 381 382 d xmlValidCtxtNormalizeAttributeValue... 383 d pr * extproc('xmlValidCtxt+ xmlChar * 384 d NormalizeAttributeValue') 385 d ctxt value like(xmlValidCtxtPtr) 386 d doc value like(xmlDocPtr) 387 d elem value like(xmlNodePtr) 388 d name * value options(*string) const xmlChar * 389 d value * value options(*string) const xmlChar * 390 391 d xmlValidateAttributeDecl... 392 d pr 10i 0 extproc('xmlValidateAttributeDecl') 393 d ctxt value like(xmlValidCtxtPtr) 394 d doc value like(xmlDocPtr) 395 d attr value like(xmlAttributePtr) 396 397 d xmlValidateAttributeValue... 398 d pr 10i 0 extproc('xmlValidateAttributeValue') 399 d type value like(xmlAttributeType) 400 d value * value options(*string) const xmlChar * 401 402 d xmlValidateNotationDecl... 403 d pr 10i 0 extproc('xmlValidateNotationDecl') 404 d ctxt value like(xmlValidCtxtPtr) 405 d doc value like(xmlDocPtr) 406 d nota value like(xmlNotationPtr) 407 408 d xmlValidateDtd pr 10i 0 extproc('xmlValidateDtd') 409 d ctxt value like(xmlValidCtxtPtr) 410 d doc value like(xmlDocPtr) 411 d dtd value like(xmlDtdPtr) 412 413 d xmlValidateDtdFinal... 414 d pr 10i 0 extproc('xmlValidateDtdFinal') 415 d ctxt value like(xmlValidCtxtPtr) 416 d doc value like(xmlDocPtr) 417 418 d xmlValidateDocument... 419 d pr 10i 0 extproc('xmlValidateDocument') 420 d ctxt value like(xmlValidCtxtPtr) 421 d doc value like(xmlDocPtr) 422 423 d xmlValidateElement... 424 d pr 10i 0 extproc('xmlValidateElement') 425 d ctxt value like(xmlValidCtxtPtr) 426 d doc value like(xmlDocPtr) 427 d elem value like(xmlNodePtr) 428 429 d xmlValidateOneElement... 430 d pr 10i 0 extproc('xmlValidateOneElement') 431 d ctxt value like(xmlValidCtxtPtr) 432 d doc value like(xmlDocPtr) 433 d elem value like(xmlNodePtr) 434 435 d xmlValidateOneAttribute... 436 d pr 10i 0 extproc('xmlValidateOneAttribute') 437 d ctxt value like(xmlValidCtxtPtr) 438 d doc value like(xmlDocPtr) 439 d elem value like(xmlNodePtr) 440 d attr value like(xmlAttrPtr) 441 d value * value options(*string) const xmlChar * 442 443 d xmlValidateOneNamespace... 444 d pr 10i 0 extproc('xmlValidateOneNamespace') 445 d ctxt value like(xmlValidCtxtPtr) 446 d doc value like(xmlDocPtr) 447 d elem value like(xmlNodePtr) 448 d prefix * value options(*string) const xmlChar * 449 d ns value like(xmlNsPtr) 450 d value * value options(*string) const xmlChar * 451 452 d xmlValidateDocumentFinal... 453 d pr 10i 0 extproc('xmlValidateDocumentFinal') 454 d ctxt value like(xmlValidCtxtPtr) 455 d doc value like(xmlDocPtr) 456 /endif LIBXML_VALID_ENABLED 457 458 /undefine XML_TESTVAL 459 /if defined(LIBXML_VALID_ENABLED) 460 /define XML_TESTVAL 461 /elseif defined(LIBXML_SCHEMAS_ENABLED) 462 /define XML_TESTVAL 463 /endif 464 /if defined(XML_TESTVAL) 465 d xmlValidateNotationUse... 466 d pr 10i 0 extproc('xmlValidateNotationUse') 467 d ctxt value like(xmlValidCtxtPtr) 468 d doc value like(xmlDocPtr) 469 d notationName * value options(*string) const xmlChar * 470 471 /undefine XML_TESTVAL 472 /endif 473 474 d xmlIsMixedElement... 475 d pr 10i 0 extproc('xmlIsMixedElement') 476 d doc value like(xmlDocPtr) 477 d name * value options(*string) const xmlChar * 478 479 d xmlGetDtdAttrDesc... 480 d pr extproc('xmlGetDtdAttrDesc') 481 d like(xmlAttributePtr) 482 d dtd value like(xmlDtdPtr) 483 d elem * value options(*string) const xmlChar * 484 d name * value options(*string) const xmlChar * 485 486 d xmlGetDtdQAttrDesc... 487 d pr extproc('xmlGetDtdQAttrDesc') 488 d like(xmlAttributePtr) 489 d dtd value like(xmlDtdPtr) 490 d elem * value options(*string) const xmlChar * 491 d name * value options(*string) const xmlChar * 492 d prefix * value options(*string) const xmlChar * 493 494 d xmlGetDtdNotationDesc... 495 d pr extproc('xmlGetDtdNotationDesc') 496 d like(xmlNotationPtr) 497 d dtd value like(xmlDtdPtr) 498 d name * value options(*string) const xmlChar * 499 500 d xmlGetDtdQElementDesc... 501 d pr extproc('xmlGetDtdQElementDesc') 502 d like(xmlElementPtr) 503 d dtd value like(xmlDtdPtr) 504 d name * value options(*string) const xmlChar * 505 d prefix * value options(*string) const xmlChar * 506 507 d xmlGetDtdElementDesc... 508 d pr extproc('xmlGetDtdElementDesc') 509 d like(xmlElementPtr) 510 d dtd value like(xmlDtdPtr) 511 d name * value options(*string) const xmlChar * 512 513 /if defined(LIBXML_VALID_ENABLED) 514 d xmlValidGetPotentialChildren... 515 d pr 10i 0 extproc( 516 d 'xmlValidGetPotentialChildren') 517 d ctree * value xmlElementContent * 518 d names * const xmlChar *(*) 519 d len 10i 0 520 d max 10i 0 value 521 522 d xmlValidGetValidElements... 523 d pr 10i 0 extproc('xmlValidGetValidElements') 524 d prev like(xmlNodePtr) 525 d next like(xmlNodePtr) 526 d names * const xmlChar *(*) 527 d max 10i 0 value 528 529 d xmlValidateNameValue... 530 d pr 10i 0 extproc('xmlValidateNameValue') 531 d value * value options(*string) const xmlChar * 532 533 d xmlValidateNamesValue... 534 d pr 10i 0 extproc('xmlValidateNamesValue') 535 d value * value options(*string) const xmlChar * 536 537 d xmlValidateNmtokenValue... 538 d pr 10i 0 extproc('xmlValidateNmtokenValue') 539 d value * value options(*string) const xmlChar * 540 541 d xmlValidateNmtokensValue... 542 d pr 10i 0 extproc('xmlValidateNmtokensValue') 543 d value * value options(*string) const xmlChar * 544 545 /if defined(LIBXML_REGEXP_ENABLED) 546 * Validation based on the regexp support 547 548 d xmlValidBuildContentModel... 549 d pr 10i 0 extproc('xmlValidBuildContentModel') 550 d ctxt value like(xmlValidCtxtPtr) 551 d elem value like(xmlElementPtr) 552 553 d xmlValidatePushElement... 554 d pr 10i 0 extproc('xmlValidatePushElement') 555 d ctxt value like(xmlValidCtxtPtr) 556 d doc value like(xmlDocPtr) 557 d elem value like(xmlNodePtr) 558 d qname * value options(*string) const xmlChar * 559 560 d xmlValidatePushCData... 561 d pr 10i 0 extproc('xmlValidatePushCData') 562 d ctxt value like(xmlValidCtxtPtr) 563 d data * value options(*string) const xmlChar * 564 d len 10i 0 value 565 566 d xmlValidatePopElement... 567 d pr 10i 0 extproc('xmlValidatePopElement') 568 d ctxt value like(xmlValidCtxtPtr) 569 d doc value like(xmlDocPtr) 570 d elem value like(xmlNodePtr) 571 d qname * value options(*string) const xmlChar * 572 573 /endif LIBXML_REGEXP_ENABLD 574 /endif LIBXML_VALID_ENABLED 575 /endif XML_VALID_H__ 576