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