xlink.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /**
  2. * @file
  3. *
  4. * @brief unfinished XLink detection module
  5. *
  6. * This module is deprecated, don't use.
  7. *
  8. * @copyright See Copyright for the status of this software.
  9. *
  10. * @author Daniel Veillard
  11. */
  12. #ifndef __XML_XLINK_H__
  13. #define __XML_XLINK_H__
  14. #include <libxml/xmlversion.h>
  15. #include <libxml/tree.h>
  16. #ifdef LIBXML_XPTR_ENABLED
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /** @cond ignore */
  21. /**
  22. * Various defines for the various Link properties.
  23. *
  24. * NOTE: the link detection layer will try to resolve QName expansion
  25. * of namespaces. If "foo" is the prefix for "http://foo.com/"
  26. * then the link detection layer will expand role="foo:myrole"
  27. * to "http://foo.com/:myrole".
  28. * NOTE: the link detection layer will expand URI-References found on
  29. * href attributes by using the base mechanism if found.
  30. */
  31. typedef xmlChar *xlinkHRef;
  32. typedef xmlChar *xlinkRole;
  33. typedef xmlChar *xlinkTitle;
  34. typedef enum {
  35. XLINK_TYPE_NONE = 0,
  36. XLINK_TYPE_SIMPLE,
  37. XLINK_TYPE_EXTENDED,
  38. XLINK_TYPE_EXTENDED_SET
  39. } xlinkType;
  40. typedef enum {
  41. XLINK_SHOW_NONE = 0,
  42. XLINK_SHOW_NEW,
  43. XLINK_SHOW_EMBED,
  44. XLINK_SHOW_REPLACE
  45. } xlinkShow;
  46. typedef enum {
  47. XLINK_ACTUATE_NONE = 0,
  48. XLINK_ACTUATE_AUTO,
  49. XLINK_ACTUATE_ONREQUEST
  50. } xlinkActuate;
  51. /** @endcond */
  52. /**
  53. * This is the prototype for the link detection routine.
  54. * It calls the default link detection callbacks upon link detection.
  55. *
  56. * @param ctx user data pointer
  57. * @param node the node to check
  58. */
  59. typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNode *node);
  60. /*
  61. * The link detection module interact with the upper layers using
  62. * a set of callback registered at parsing time.
  63. */
  64. /**
  65. * This is the prototype for a simple link detection callback.
  66. *
  67. * @param ctx user data pointer
  68. * @param node the node carrying the link
  69. * @param href the target of the link
  70. * @param role the role string
  71. * @param title the link title
  72. */
  73. typedef void
  74. (*xlinkSimpleLinkFunk) (void *ctx,
  75. xmlNode *node,
  76. const xlinkHRef href,
  77. const xlinkRole role,
  78. const xlinkTitle title);
  79. /**
  80. * This is the prototype for a extended link detection callback.
  81. *
  82. * @param ctx user data pointer
  83. * @param node the node carrying the link
  84. * @param nbLocators the number of locators detected on the link
  85. * @param hrefs pointer to the array of locator hrefs
  86. * @param roles pointer to the array of locator roles
  87. * @param nbArcs the number of arcs detected on the link
  88. * @param from pointer to the array of source roles found on the arcs
  89. * @param to pointer to the array of target roles found on the arcs
  90. * @param show array of values for the show attributes found on the arcs
  91. * @param actuate array of values for the actuate attributes found on the arcs
  92. * @param nbTitles the number of titles detected on the link
  93. * @param titles array of titles detected on the link
  94. * @param langs array of xml:lang values for the titles
  95. */
  96. typedef void
  97. (*xlinkExtendedLinkFunk)(void *ctx,
  98. xmlNode *node,
  99. int nbLocators,
  100. const xlinkHRef *hrefs,
  101. const xlinkRole *roles,
  102. int nbArcs,
  103. const xlinkRole *from,
  104. const xlinkRole *to,
  105. xlinkShow *show,
  106. xlinkActuate *actuate,
  107. int nbTitles,
  108. const xlinkTitle *titles,
  109. const xmlChar **langs);
  110. /**
  111. * This is the prototype for a extended link set detection callback.
  112. *
  113. * @param ctx user data pointer
  114. * @param node the node carrying the link
  115. * @param nbLocators the number of locators detected on the link
  116. * @param hrefs pointer to the array of locator hrefs
  117. * @param roles pointer to the array of locator roles
  118. * @param nbTitles the number of titles detected on the link
  119. * @param titles array of titles detected on the link
  120. * @param langs array of xml:lang values for the titles
  121. */
  122. typedef void
  123. (*xlinkExtendedLinkSetFunk) (void *ctx,
  124. xmlNode *node,
  125. int nbLocators,
  126. const xlinkHRef *hrefs,
  127. const xlinkRole *roles,
  128. int nbTitles,
  129. const xlinkTitle *titles,
  130. const xmlChar **langs);
  131. typedef struct _xlinkHandler xlinkHandler;
  132. typedef xlinkHandler *xlinkHandlerPtr;
  133. /**
  134. * This is the structure containing a set of Links detection callbacks.
  135. *
  136. * There is no default xlink callbacks, if one want to get link
  137. * recognition activated, those call backs must be provided before parsing.
  138. */
  139. struct _xlinkHandler {
  140. xlinkSimpleLinkFunk simple;
  141. xlinkExtendedLinkFunk extended;
  142. xlinkExtendedLinkSetFunk set;
  143. };
  144. /*
  145. * The default detection routine, can be overridden, they call the default
  146. * detection callbacks.
  147. */
  148. XML_DEPRECATED
  149. XMLPUBFUN xlinkNodeDetectFunc
  150. xlinkGetDefaultDetect (void);
  151. XML_DEPRECATED
  152. XMLPUBFUN void
  153. xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
  154. /*
  155. * Routines to set/get the default handlers.
  156. */
  157. XML_DEPRECATED
  158. XMLPUBFUN xlinkHandler *
  159. xlinkGetDefaultHandler (void);
  160. XML_DEPRECATED
  161. XMLPUBFUN void
  162. xlinkSetDefaultHandler (xlinkHandler *handler);
  163. /*
  164. * Link detection module itself.
  165. */
  166. XML_DEPRECATED
  167. XMLPUBFUN xlinkType
  168. xlinkIsLink (xmlDoc *doc,
  169. xmlNode *node);
  170. #ifdef __cplusplus
  171. }
  172. #endif
  173. #endif /* LIBXML_XPTR_ENABLED */
  174. #endif /* __XML_XLINK_H__ */