xmlschemas.inc 5.2 KB

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