|
Packit |
21b7a2 |
/*
|
|
Packit |
21b7a2 |
* Summary: unfinished XLink detection module
|
|
Packit |
21b7a2 |
* Description: unfinished XLink detection module
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* Copy: See Copyright for the status of this software.
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* Author: Daniel Veillard
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#ifndef __XML_XLINK_H__
|
|
Packit |
21b7a2 |
#define __XML_XLINK_H__
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#include <libxml/xmlversion.h>
|
|
Packit |
21b7a2 |
#include <libxml/tree.h>
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#ifdef LIBXML_XPTR_ENABLED
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#ifdef __cplusplus
|
|
Packit |
21b7a2 |
extern "C" {
|
|
Packit |
21b7a2 |
#endif
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* Various defines for the various Link properties.
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* NOTE: the link detection layer will try to resolve QName expansion
|
|
Packit |
21b7a2 |
* of namespaces. If "foo" is the prefix for "http://foo.com/"
|
|
Packit |
21b7a2 |
* then the link detection layer will expand role="foo:myrole"
|
|
Packit |
21b7a2 |
* to "http://foo.com/:myrole".
|
|
Packit |
21b7a2 |
* NOTE: the link detection layer will expand URI-Refences found on
|
|
Packit |
21b7a2 |
* href attributes by using the base mechanism if found.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef xmlChar *xlinkHRef;
|
|
Packit |
21b7a2 |
typedef xmlChar *xlinkRole;
|
|
Packit |
21b7a2 |
typedef xmlChar *xlinkTitle;
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
typedef enum {
|
|
Packit |
21b7a2 |
XLINK_TYPE_NONE = 0,
|
|
Packit |
21b7a2 |
XLINK_TYPE_SIMPLE,
|
|
Packit |
21b7a2 |
XLINK_TYPE_EXTENDED,
|
|
Packit |
21b7a2 |
XLINK_TYPE_EXTENDED_SET
|
|
Packit |
21b7a2 |
} xlinkType;
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
typedef enum {
|
|
Packit |
21b7a2 |
XLINK_SHOW_NONE = 0,
|
|
Packit |
21b7a2 |
XLINK_SHOW_NEW,
|
|
Packit |
21b7a2 |
XLINK_SHOW_EMBED,
|
|
Packit |
21b7a2 |
XLINK_SHOW_REPLACE
|
|
Packit |
21b7a2 |
} xlinkShow;
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
typedef enum {
|
|
Packit |
21b7a2 |
XLINK_ACTUATE_NONE = 0,
|
|
Packit |
21b7a2 |
XLINK_ACTUATE_AUTO,
|
|
Packit |
21b7a2 |
XLINK_ACTUATE_ONREQUEST
|
|
Packit |
21b7a2 |
} xlinkActuate;
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* xlinkNodeDetectFunc:
|
|
Packit |
21b7a2 |
* @ctx: user data pointer
|
|
Packit |
21b7a2 |
* @node: the node to check
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* This is the prototype for the link detection routine.
|
|
Packit |
21b7a2 |
* It calls the default link detection callbacks upon link detection.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/*
|
|
Packit |
21b7a2 |
* The link detection module interact with the upper layers using
|
|
Packit |
21b7a2 |
* a set of callback registered at parsing time.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* xlinkSimpleLinkFunk:
|
|
Packit |
21b7a2 |
* @ctx: user data pointer
|
|
Packit |
21b7a2 |
* @node: the node carrying the link
|
|
Packit |
21b7a2 |
* @href: the target of the link
|
|
Packit |
21b7a2 |
* @role: the role string
|
|
Packit |
21b7a2 |
* @title: the link title
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* This is the prototype for a simple link detection callback.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef void
|
|
Packit |
21b7a2 |
(*xlinkSimpleLinkFunk) (void *ctx,
|
|
Packit |
21b7a2 |
xmlNodePtr node,
|
|
Packit |
21b7a2 |
const xlinkHRef href,
|
|
Packit |
21b7a2 |
const xlinkRole role,
|
|
Packit |
21b7a2 |
const xlinkTitle title);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* xlinkExtendedLinkFunk:
|
|
Packit |
21b7a2 |
* @ctx: user data pointer
|
|
Packit |
21b7a2 |
* @node: the node carrying the link
|
|
Packit |
21b7a2 |
* @nbLocators: the number of locators detected on the link
|
|
Packit |
21b7a2 |
* @hrefs: pointer to the array of locator hrefs
|
|
Packit |
21b7a2 |
* @roles: pointer to the array of locator roles
|
|
Packit |
21b7a2 |
* @nbArcs: the number of arcs detected on the link
|
|
Packit |
21b7a2 |
* @from: pointer to the array of source roles found on the arcs
|
|
Packit |
21b7a2 |
* @to: pointer to the array of target roles found on the arcs
|
|
Packit |
21b7a2 |
* @show: array of values for the show attributes found on the arcs
|
|
Packit |
21b7a2 |
* @actuate: array of values for the actuate attributes found on the arcs
|
|
Packit |
21b7a2 |
* @nbTitles: the number of titles detected on the link
|
|
Packit |
21b7a2 |
* @title: array of titles detected on the link
|
|
Packit |
21b7a2 |
* @langs: array of xml:lang values for the titles
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* This is the prototype for a extended link detection callback.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef void
|
|
Packit |
21b7a2 |
(*xlinkExtendedLinkFunk)(void *ctx,
|
|
Packit |
21b7a2 |
xmlNodePtr node,
|
|
Packit |
21b7a2 |
int nbLocators,
|
|
Packit |
21b7a2 |
const xlinkHRef *hrefs,
|
|
Packit |
21b7a2 |
const xlinkRole *roles,
|
|
Packit |
21b7a2 |
int nbArcs,
|
|
Packit |
21b7a2 |
const xlinkRole *from,
|
|
Packit |
21b7a2 |
const xlinkRole *to,
|
|
Packit |
21b7a2 |
xlinkShow *show,
|
|
Packit |
21b7a2 |
xlinkActuate *actuate,
|
|
Packit |
21b7a2 |
int nbTitles,
|
|
Packit |
21b7a2 |
const xlinkTitle *titles,
|
|
Packit |
21b7a2 |
const xmlChar **langs);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* xlinkExtendedLinkSetFunk:
|
|
Packit |
21b7a2 |
* @ctx: user data pointer
|
|
Packit |
21b7a2 |
* @node: the node carrying the link
|
|
Packit |
21b7a2 |
* @nbLocators: the number of locators detected on the link
|
|
Packit |
21b7a2 |
* @hrefs: pointer to the array of locator hrefs
|
|
Packit |
21b7a2 |
* @roles: pointer to the array of locator roles
|
|
Packit |
21b7a2 |
* @nbTitles: the number of titles detected on the link
|
|
Packit |
21b7a2 |
* @title: array of titles detected on the link
|
|
Packit |
21b7a2 |
* @langs: array of xml:lang values for the titles
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* This is the prototype for a extended link set detection callback.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef void
|
|
Packit |
21b7a2 |
(*xlinkExtendedLinkSetFunk) (void *ctx,
|
|
Packit |
21b7a2 |
xmlNodePtr node,
|
|
Packit |
21b7a2 |
int nbLocators,
|
|
Packit |
21b7a2 |
const xlinkHRef *hrefs,
|
|
Packit |
21b7a2 |
const xlinkRole *roles,
|
|
Packit |
21b7a2 |
int nbTitles,
|
|
Packit |
21b7a2 |
const xlinkTitle *titles,
|
|
Packit |
21b7a2 |
const xmlChar **langs);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/**
|
|
Packit |
21b7a2 |
* This is the structure containing a set of Links detection callbacks.
|
|
Packit |
21b7a2 |
*
|
|
Packit |
21b7a2 |
* There is no default xlink callbacks, if one want to get link
|
|
Packit |
21b7a2 |
* recognition activated, those call backs must be provided before parsing.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
typedef struct _xlinkHandler xlinkHandler;
|
|
Packit |
21b7a2 |
typedef xlinkHandler *xlinkHandlerPtr;
|
|
Packit |
21b7a2 |
struct _xlinkHandler {
|
|
Packit |
21b7a2 |
xlinkSimpleLinkFunk simple;
|
|
Packit |
21b7a2 |
xlinkExtendedLinkFunk extended;
|
|
Packit |
21b7a2 |
xlinkExtendedLinkSetFunk set;
|
|
Packit |
21b7a2 |
};
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/*
|
|
Packit |
21b7a2 |
* The default detection routine, can be overridden, they call the default
|
|
Packit |
21b7a2 |
* detection callbacks.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
|
|
Packit |
21b7a2 |
xlinkGetDefaultDetect (void);
|
|
Packit |
21b7a2 |
XMLPUBFUN void XMLCALL
|
|
Packit |
21b7a2 |
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/*
|
|
Packit |
21b7a2 |
* Routines to set/get the default handlers.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
XMLPUBFUN xlinkHandlerPtr XMLCALL
|
|
Packit |
21b7a2 |
xlinkGetDefaultHandler (void);
|
|
Packit |
21b7a2 |
XMLPUBFUN void XMLCALL
|
|
Packit |
21b7a2 |
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
/*
|
|
Packit |
21b7a2 |
* Link detection module itself.
|
|
Packit |
21b7a2 |
*/
|
|
Packit |
21b7a2 |
XMLPUBFUN xlinkType XMLCALL
|
|
Packit |
21b7a2 |
xlinkIsLink (xmlDocPtr doc,
|
|
Packit |
21b7a2 |
xmlNodePtr node);
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#ifdef __cplusplus
|
|
Packit |
21b7a2 |
}
|
|
Packit |
21b7a2 |
#endif
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#endif /* LIBXML_XPTR_ENABLED */
|
|
Packit |
21b7a2 |
|
|
Packit |
21b7a2 |
#endif /* __XML_XLINK_H__ */
|