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