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