xmlschemas.inc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. (*
  2. * Summary: incomplete XML Schemas structure implementation
  3. * Description: interface to the XML Schemas handling and schema validity
  4. * checking, it is incomplete right now.
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Daniel Veillard
  9. *)
  10. {$IFDEF LIBXML_SCHEMAS_ENABLED}
  11. {$IFDEF POINTER}
  12. xmlSchemaPtr = ^xmlSchema;
  13. xmlSchemaParserCtxtPtr = ^xmlSchemaParserCtxt;
  14. xmlSchemaValidCtxtPtr = ^xmlSchemaValidCtxt;
  15. xmlSchemaSAXPlugPtr = ^xmlSchemaSAXPlugStruct;
  16. {$ENDIF}
  17. {$IFDEF TYPE}
  18. (**
  19. * This error codes are obsolete; not used any more.
  20. *)
  21. xmlSchemaValidError = (
  22. XML_SCHEMAS_ERR_OK = 0,
  23. XML_SCHEMAS_ERR_NOROOT = 1,
  24. XML_SCHEMAS_ERR_UNDECLAREDELEM,
  25. XML_SCHEMAS_ERR_NOTTOPLEVEL,
  26. XML_SCHEMAS_ERR_MISSING,
  27. XML_SCHEMAS_ERR_WRONGELEM,
  28. XML_SCHEMAS_ERR_NOTYPE,
  29. XML_SCHEMAS_ERR_NOROLLBACK,
  30. XML_SCHEMAS_ERR_ISABSTRACT,
  31. XML_SCHEMAS_ERR_NOTEMPTY,
  32. XML_SCHEMAS_ERR_ELEMCONT,
  33. XML_SCHEMAS_ERR_HAVEDEFAULT,
  34. XML_SCHEMAS_ERR_NOTNILLABLE,
  35. XML_SCHEMAS_ERR_EXTRACONTENT,
  36. XML_SCHEMAS_ERR_INVALIDATTR,
  37. XML_SCHEMAS_ERR_INVALIDELEM,
  38. XML_SCHEMAS_ERR_NOTDETERMINIST,
  39. XML_SCHEMAS_ERR_CONSTRUCT,
  40. XML_SCHEMAS_ERR_INTERNAL,
  41. XML_SCHEMAS_ERR_NOTSIMPLE,
  42. XML_SCHEMAS_ERR_ATTRUNKNOWN,
  43. XML_SCHEMAS_ERR_ATTRINVALID,
  44. XML_SCHEMAS_ERR_VALUE,
  45. XML_SCHEMAS_ERR_FACET,
  46. XML_SCHEMAS_ERR_,
  47. XML_SCHEMAS_ERR_XXX
  48. );
  49. (*
  50. * ATTENTION: Change xmlSchemaSetValidOptions's check
  51. * for invalid values, if adding to the validation
  52. * options below.
  53. *)
  54. (**
  55. * xmlSchemaValidOption:
  56. *
  57. * This is the set of XML Schema validation options.
  58. *)
  59. xmlSchemaValidOption = type cint;
  60. {$ENDIF}
  61. {$IFDEF CONST}
  62. XML_SCHEMA_VAL_VC_I_CREATE = 1 shl 0;
  63. (* Default/fixed: create an attribute node
  64. * or an element's text node on the instance.
  65. *)
  66. XML_SCHEMA_VAL_XSI_ASSEMBLE = 1 shl 1;
  67. (*
  68. * assemble schemata using
  69. * xsi:schemaLocation and
  70. * xsi:noNamespaceSchemaLocation
  71. *)
  72. {$ENDIF}
  73. {$IFDEF TYPE}
  74. (**
  75. * The schemas related types are kept internal
  76. *)
  77. // xmlSchema = record end;
  78. (**
  79. * A schemas validation context
  80. *)
  81. xmlSchemaValidityErrorFunc = procedure(ctx: pointer; msg: pchar); cdecl; varargs;
  82. xmlSchemaValidityWarningFunc = procedure(ctx: pointer; msg: pchar); cdecl; varargs;
  83. xmlSchemaParserCtxt = record end;
  84. xmlSchemaValidCtxt = record end;
  85. xmlSchemaSAXPlugStruct = record end;
  86. {$ENDIF}
  87. {$IFDEF FUNCTION}
  88. (*
  89. * Interfaces for parsing.
  90. *)
  91. function xmlSchemaNewParserCtxt(URL: pchar): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
  92. function xmlSchemaNewMemParserCtxt(buffer: pchar; size: cint): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
  93. function xmlSchemaNewDocParserCtxt(doc: xmlDocPtr): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
  94. procedure xmlSchemaFreeParserCtxt(ctxt: xmlSchemaParserCtxtPtr); EXTDECL; external xml2lib;
  95. procedure xmlSchemaSetParserErrors(ctxt: xmlSchemaParserCtxtPtr; err: xmlSchemaValidityErrorFunc; warn: xmlSchemaValidityWarningFunc; ctx: pointer); EXTDECL; external xml2lib;
  96. procedure xmlSchemaSetParserStructuredErrors(ctxt: xmlSchemaParserCtxtPtr; serror: xmlStructuredErrorFunc; ctx: pointer); EXTDECL; external xml2lib;
  97. function xmlSchemaSetParserErrors(ctxt: xmlSchemaParserCtxtPtr; var err: xmlSchemaValidityErrorFunc; var warn: xmlSchemaValidityWarningFunc; var ctx: pointer): cint; EXTDECL; external xml2lib;
  98. function xmlSchemaIsValid(ctxt: xmlSchemaValidCtxtPtr): cint; EXTDECL; external xml2lib;
  99. function xmlSchemaParse(ctxt: xmlSchemaParserCtxtPtr): xmlSchemaPtr; EXTDECL; external xml2lib;
  100. procedure xmlSchemaFree(schema: xmlSchemaPtr); EXTDECL; external xml2lib;
  101. {$IFDEF LIBXML_OUTPUT_ENABLED}
  102. procedure xmlSchemaDump(output: PFILE; schema: xmlSchemaPtr); EXTDECL; external xml2lib;
  103. {$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
  104. (*
  105. * Interfaces for validating
  106. *)
  107. procedure xmlSchemaSetValidErrors(ctxt: xmlSchemaParserCtxtPtr; err: xmlSchemaValidityErrorFunc; warn: xmlSchemaValidityWarningFunc; ctx: pointer); EXTDECL; external xml2lib;
  108. procedure xmlSchemaSetValidStructuredErrors(ctxt: xmlSchemaParserCtxtPtr; serror: xmlStructuredErrorFunc; ctx: pointer); EXTDECL; external xml2lib;
  109. function xmlSchemaGetValidErrors(ctxt: xmlSchemaParserCtxtPtr; var err: xmlSchemaValidityErrorFunc; var warn: xmlSchemaValidityWarningFunc; var ctx: pointer): cint; EXTDECL; external xml2lib;
  110. function xmlSchemaSetValidOptions(ctxt: xmlSchemaValidCtxtPtr; options: cint): cint; EXTDECL; external xml2lib;
  111. function xmlSchemaValidCtxtGetOptions(ctxt: xmlSchemaValidCtxtPtr): cint; EXTDECL; external xml2lib;
  112. function xmlSchemaNewValidCtxt(schema: xmlSchemaPtr): xmlSchemaValidCtxtPtr; EXTDECL; external xml2lib;
  113. procedure xmlSchemaFreeValidCtxt(ctxt: xmlSchemaValidCtxtPtr); EXTDECL; external xml2lib;
  114. function xmlSchemaNewValidCtxt(ctxt: xmlSchemaValidCtxtPtr; instance: xmlDocPtr): cint; EXTDECL; external xml2lib;
  115. function xmlSchemaValidateOneElement(ctxt: xmlSchemaValidCtxtPtr; elem: xmlNodePtr): cint; EXTDECL; external xml2lib;
  116. function xmlSchemaValidateStream(ctxt: xmlSchemaValidCtxtPtr; input: xmlParserInputBufferPtr; enc: xmlCharEncoding; sax: xmlSAXHandlerPtr; user_data: pointer): cint; EXTDECL; external xml2lib;
  117. function xmlSchemaValidateFile(ctxt: xmlSchemaValidCtxtPtr; filename: pchar; options: cint): cint; EXTDECL; external xml2lib;
  118. (*
  119. * Interface to insert Schemas SAX velidation in a SAX stream
  120. *)
  121. function xmlSchemaSAXPlug(ctxt: xmlSchemaValidCtxtPtr; var sax: xmlSchemaSAXPlugPtr; var user_data: pointer): xmlSchemaSAXPlugPtr; EXTDECL; external xml2lib;
  122. function xmlSchemaSAXUnplug(plug: xmlSchemaSAXPlugPtr): cint; EXTDECL; external xml2lib;
  123. {$ENDIF}
  124. {$ENDIF} (* LIBXML_SCHEMAS_ENABLED *)