source: trunk/third/libxml/xlink.h @ 15360

Revision 15360, 4.8 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15359, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * xlink.h : interfaces to the hyperlinks detection module
3 *
4 * See Copyright for the status of this software.
5 *
6 * Related specification: http://www.w3.org/TR/xlink
7 *                        http://www.w3.org/HTML/
8 *     and XBase
9 *
10 * Daniel.Veillard@w3.org
11 */
12
13#ifndef __XML_XLINK_H__
14#define __XML_XLINK_H__
15
16#include "tree.h"
17
18#ifdef __cplusplus
19#define extern "C" {
20#endif
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-Refences found on
29 *       href attributes by using the base mechanism if found.
30 */
31typedef xmlChar *xlinkHRef;
32typedef xmlChar *xlinkRole;
33typedef xmlChar *xlinkTitle;
34
35typedef enum {
36    XLINK_TYPE_NONE = 0,
37    XLINK_TYPE_SIMPLE,
38    XLINK_TYPE_EXTENDED,
39    XLINK_TYPE_EXTENDED_SET
40} xlinkType;
41
42typedef enum {
43    XLINK_SHOW_NONE = 0,
44    XLINK_SHOW_NEW,
45    XLINK_SHOW_EMBED,
46    XLINK_SHOW_REPLACE
47} xlinkShow;
48
49typedef enum {
50    XLINK_ACTUATE_NONE = 0,
51    XLINK_ACTUATE_AUTO,
52    XLINK_ACTUATE_ONREQUEST
53} xlinkActuate;
54
55/**
56 * xlinkNodeDetectFunc:
57 * @ctx:  user data pointer
58 * @node:  the node to check
59 *
60 * This is the prototype for the link detection routine
61 * It calls the default link detection callbacks upon link detection.
62 */
63typedef void
64(*xlinkNodeDetectFunc)  (void *ctx,
65                         xmlNodePtr node);
66
67/**
68 * The link detection module interract with the upper layers using
69 * a set of callback registered at parsing time.
70 */
71
72/**
73 * xlinkSimpleLinkFunk:
74 * @ctx:  user data pointer
75 * @node:  the node carrying the link
76 * @href:  the target of the link
77 * @role:  the role string
78 * @title:  the link title
79 *
80 * This is the prototype for a simple link detection callback.
81 */
82typedef void
83(*xlinkSimpleLinkFunk)  (void *ctx,
84                         xmlNodePtr node,
85                         const xlinkHRef href,
86                         const xlinkRole role,
87                         const xlinkTitle title);
88
89/**
90 * xlinkExtendedLinkFunk:
91 * @ctx:  user data pointer
92 * @node:  the node carrying the link
93 * @nbLocators: the number of locators detected on the link
94 * @hrefs:  pointer to the array of locator hrefs
95 * @roles:  pointer to the array of locator roles
96 * @nbArcs: the number of arcs detected on the link
97 * @from:  pointer to the array of source roles found on the arcs
98 * @to:  pointer to the array of target roles found on the arcs
99 * @show:  array of values for the show attributes found on the arcs
100 * @actuate:  array of values for the actuate attributes found on the arcs
101 * @nbTitles: the number of titles detected on the link
102 * @title:  array of titles detected on the link
103 * @langs:  array of xml:lang values for the titles
104 *
105 * This is the prototype for a extended link detection callback.
106 */
107typedef void
108(*xlinkExtendedLinkFunk)(void *ctx,
109                         xmlNodePtr node,
110                         int nbLocators,
111                         const xlinkHRef *hrefs,
112                         const xlinkRole *roles,
113                         int nbArcs,
114                         const xlinkRole *from,
115                         const xlinkRole *to,
116                         xlinkShow *show,
117                         xlinkActuate *actuate,
118                         int nbTitles,
119                         const xlinkTitle *titles,
120                         const xmlChar **langs);
121
122/**
123 * xlinkExtendedLinkSetFunk:
124 * @ctx:  user data pointer
125 * @node:  the node carrying the link
126 * @nbLocators: the number of locators detected on the link
127 * @hrefs:  pointer to the array of locator hrefs
128 * @roles:  pointer to the array of locator roles
129 * @nbTitles: the number of titles detected on the link
130 * @title:  array of titles detected on the link
131 * @langs:  array of xml:lang values for the titles
132 *
133 * This is the prototype for a extended link set detection callback.
134 */
135typedef void
136(*xlinkExtendedLinkSetFunk)     (void *ctx,
137                                 xmlNodePtr node,
138                                 int nbLocators,
139                                 const xlinkHRef *hrefs,
140                                 const xlinkRole *roles,
141                                 int nbTitles,
142                                 const xlinkTitle *titles,
143                                 const xmlChar **langs);
144
145/**
146 * This is the structure containing a set of Links detection callbacks
147 *
148 * There is no default xlink callbacks, if one want to get link
149 * recognition activated, those call backs must be provided before parsing.
150 */
151typedef struct _xlinkHandler xlinkHandler;
152typedef xlinkHandler *xlinkHandlerPtr;
153struct _xlinkHandler {
154    xlinkSimpleLinkFunk simple;
155    xlinkExtendedLinkFunk extended;
156    xlinkExtendedLinkSetFunk set;
157};
158
159/**
160 * the default detection routine, can be overriden, they call the default
161 * detection callbacks.
162 */
163
164xlinkNodeDetectFunc     xlinkGetDefaultDetect   (void);
165void                    xlinkSetDefaultDetect   (xlinkNodeDetectFunc func);
166
167/**
168 * Routines to set/get the default handlers.
169 */
170xlinkHandlerPtr xlinkGetDefaultHandler  (void);
171void            xlinkSetDefaultHandler  (xlinkHandlerPtr handler);
172
173/*
174 * Link detection module itself.
175 */
176xlinkType        xlinkIsLink            (xmlDocPtr doc,
177                                         xmlNodePtr node);
178
179#ifdef __cplusplus
180}
181#endif
182#endif /* __XML_XLINK_H__ */
Note: See TracBrowser for help on using the repository browser.