documents.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Summary: interface for the document handling
  3. * Description: implements document loading and cache (multiple
  4. * document() reference for the same resources must
  5. * be equal.
  6. *
  7. * Copy: See Copyright for the status of this software.
  8. *
  9. * Author: Daniel Veillard
  10. */
  11. #ifndef __XML_XSLT_DOCUMENTS_H__
  12. #define __XML_XSLT_DOCUMENTS_H__
  13. #include <libxml/tree.h>
  14. #include "xsltexports.h"
  15. #include "xsltInternals.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. XSLTPUBFUN xsltDocumentPtr XSLTCALL
  20. xsltNewDocument (xsltTransformContextPtr ctxt,
  21. xmlDocPtr doc);
  22. XSLTPUBFUN xsltDocumentPtr XSLTCALL
  23. xsltLoadDocument (xsltTransformContextPtr ctxt,
  24. const xmlChar *URI);
  25. XSLTPUBFUN xsltDocumentPtr XSLTCALL
  26. xsltFindDocument (xsltTransformContextPtr ctxt,
  27. xmlDocPtr doc);
  28. XSLTPUBFUN void XSLTCALL
  29. xsltFreeDocuments (xsltTransformContextPtr ctxt);
  30. XSLTPUBFUN xsltDocumentPtr XSLTCALL
  31. xsltLoadStyleDocument (xsltStylesheetPtr style,
  32. const xmlChar *URI);
  33. XSLTPUBFUN xsltDocumentPtr XSLTCALL
  34. xsltNewStyleDocument (xsltStylesheetPtr style,
  35. xmlDocPtr doc);
  36. XSLTPUBFUN void XSLTCALL
  37. xsltFreeStyleDocuments (xsltStylesheetPtr style);
  38. /*
  39. * Hooks for document loading
  40. */
  41. /**
  42. * xsltLoadType:
  43. *
  44. * Enum defining the kind of loader requirement.
  45. */
  46. typedef enum {
  47. XSLT_LOAD_START = 0, /* loading for a top stylesheet */
  48. XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet include/import */
  49. XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation time */
  50. } xsltLoadType;
  51. /**
  52. * xsltDocLoaderFunc:
  53. * @URI: the URI of the document to load
  54. * @dict: the dictionary to use when parsing that document
  55. * @options: parsing options, a set of xmlParserOption
  56. * @ctxt: the context, either a stylesheet or a transformation context
  57. * @type: the xsltLoadType indicating the kind of loading required
  58. *
  59. * An xsltDocLoaderFunc is a signature for a function which can be
  60. * registered to load document not provided by the compilation or
  61. * transformation API themselve, for example when an xsl:import,
  62. * xsl:include is found at compilation time or when a document()
  63. * call is made at runtime.
  64. *
  65. * Returns the pointer to the document (which will be modified and
  66. * freed by the engine later), or NULL in case of error.
  67. */
  68. typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI,
  69. xmlDictPtr dict,
  70. int options,
  71. void *ctxt,
  72. xsltLoadType type);
  73. XSLTPUBFUN void XSLTCALL
  74. xsltSetLoaderFunc (xsltDocLoaderFunc f);
  75. /* the loader may be needed by extension libraries so it is exported */
  76. XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader;
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif /* __XML_XSLT_DOCUMENTS_H__ */