Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:41:51

0001 /*
0002  * Summary: unfinished XLink detection module
0003  * Description: unfinished XLink detection module
0004  *
0005  * Copy: See Copyright for the status of this software.
0006  *
0007  * Author: Daniel Veillard
0008  */
0009 
0010 #ifndef __XML_XLINK_H__
0011 #define __XML_XLINK_H__
0012 
0013 #include <libxml/xmlversion.h>
0014 #include <libxml/tree.h>
0015 
0016 #ifdef LIBXML_XPTR_ENABLED
0017 
0018 #ifdef __cplusplus
0019 extern "C" {
0020 #endif
0021 
0022 /**
0023  * Various defines for the various Link properties.
0024  *
0025  * NOTE: the link detection layer will try to resolve QName expansion
0026  *       of namespaces. If "foo" is the prefix for "http://foo.com/"
0027  *       then the link detection layer will expand role="foo:myrole"
0028  *       to "http://foo.com/:myrole".
0029  * NOTE: the link detection layer will expand URI-References found on
0030  *       href attributes by using the base mechanism if found.
0031  */
0032 typedef xmlChar *xlinkHRef;
0033 typedef xmlChar *xlinkRole;
0034 typedef xmlChar *xlinkTitle;
0035 
0036 typedef enum {
0037     XLINK_TYPE_NONE = 0,
0038     XLINK_TYPE_SIMPLE,
0039     XLINK_TYPE_EXTENDED,
0040     XLINK_TYPE_EXTENDED_SET
0041 } xlinkType;
0042 
0043 typedef enum {
0044     XLINK_SHOW_NONE = 0,
0045     XLINK_SHOW_NEW,
0046     XLINK_SHOW_EMBED,
0047     XLINK_SHOW_REPLACE
0048 } xlinkShow;
0049 
0050 typedef enum {
0051     XLINK_ACTUATE_NONE = 0,
0052     XLINK_ACTUATE_AUTO,
0053     XLINK_ACTUATE_ONREQUEST
0054 } xlinkActuate;
0055 
0056 /**
0057  * xlinkNodeDetectFunc:
0058  * @ctx:  user data pointer
0059  * @node:  the node to check
0060  *
0061  * This is the prototype for the link detection routine.
0062  * It calls the default link detection callbacks upon link detection.
0063  */
0064 typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
0065 
0066 /*
0067  * The link detection module interact with the upper layers using
0068  * a set of callback registered at parsing time.
0069  */
0070 
0071 /**
0072  * xlinkSimpleLinkFunk:
0073  * @ctx:  user data pointer
0074  * @node:  the node carrying the link
0075  * @href:  the target of the link
0076  * @role:  the role string
0077  * @title:  the link title
0078  *
0079  * This is the prototype for a simple link detection callback.
0080  */
0081 typedef void
0082 (*xlinkSimpleLinkFunk)  (void *ctx,
0083              xmlNodePtr node,
0084              const xlinkHRef href,
0085              const xlinkRole role,
0086              const xlinkTitle title);
0087 
0088 /**
0089  * xlinkExtendedLinkFunk:
0090  * @ctx:  user data pointer
0091  * @node:  the node carrying the link
0092  * @nbLocators: the number of locators detected on the link
0093  * @hrefs:  pointer to the array of locator hrefs
0094  * @roles:  pointer to the array of locator roles
0095  * @nbArcs: the number of arcs detected on the link
0096  * @from:  pointer to the array of source roles found on the arcs
0097  * @to:  pointer to the array of target roles found on the arcs
0098  * @show:  array of values for the show attributes found on the arcs
0099  * @actuate:  array of values for the actuate attributes found on the arcs
0100  * @nbTitles: the number of titles detected on the link
0101  * @title:  array of titles detected on the link
0102  * @langs:  array of xml:lang values for the titles
0103  *
0104  * This is the prototype for a extended link detection callback.
0105  */
0106 typedef void
0107 (*xlinkExtendedLinkFunk)(void *ctx,
0108              xmlNodePtr node,
0109              int nbLocators,
0110              const xlinkHRef *hrefs,
0111              const xlinkRole *roles,
0112              int nbArcs,
0113              const xlinkRole *from,
0114              const xlinkRole *to,
0115              xlinkShow *show,
0116              xlinkActuate *actuate,
0117              int nbTitles,
0118              const xlinkTitle *titles,
0119              const xmlChar **langs);
0120 
0121 /**
0122  * xlinkExtendedLinkSetFunk:
0123  * @ctx:  user data pointer
0124  * @node:  the node carrying the link
0125  * @nbLocators: the number of locators detected on the link
0126  * @hrefs:  pointer to the array of locator hrefs
0127  * @roles:  pointer to the array of locator roles
0128  * @nbTitles: the number of titles detected on the link
0129  * @title:  array of titles detected on the link
0130  * @langs:  array of xml:lang values for the titles
0131  *
0132  * This is the prototype for a extended link set detection callback.
0133  */
0134 typedef void
0135 (*xlinkExtendedLinkSetFunk) (void *ctx,
0136                  xmlNodePtr node,
0137                  int nbLocators,
0138                  const xlinkHRef *hrefs,
0139                  const xlinkRole *roles,
0140                  int nbTitles,
0141                  const xlinkTitle *titles,
0142                  const xmlChar **langs);
0143 
0144 /**
0145  * This is the structure containing a set of Links detection callbacks.
0146  *
0147  * There is no default xlink callbacks, if one want to get link
0148  * recognition activated, those call backs must be provided before parsing.
0149  */
0150 typedef struct _xlinkHandler xlinkHandler;
0151 typedef xlinkHandler *xlinkHandlerPtr;
0152 struct _xlinkHandler {
0153     xlinkSimpleLinkFunk simple;
0154     xlinkExtendedLinkFunk extended;
0155     xlinkExtendedLinkSetFunk set;
0156 };
0157 
0158 /*
0159  * The default detection routine, can be overridden, they call the default
0160  * detection callbacks.
0161  */
0162 
0163 XMLPUBFUN xlinkNodeDetectFunc
0164         xlinkGetDefaultDetect   (void);
0165 XMLPUBFUN void
0166         xlinkSetDefaultDetect   (xlinkNodeDetectFunc func);
0167 
0168 /*
0169  * Routines to set/get the default handlers.
0170  */
0171 XMLPUBFUN xlinkHandlerPtr
0172         xlinkGetDefaultHandler  (void);
0173 XMLPUBFUN void
0174         xlinkSetDefaultHandler  (xlinkHandlerPtr handler);
0175 
0176 /*
0177  * Link detection module itself.
0178  */
0179 XMLPUBFUN xlinkType
0180         xlinkIsLink     (xmlDocPtr doc,
0181                      xmlNodePtr node);
0182 
0183 #ifdef __cplusplus
0184 }
0185 #endif
0186 
0187 #endif /* LIBXML_XPTR_ENABLED */
0188 
0189 #endif /* __XML_XLINK_H__ */