From 474d6da1b46aff1e1036c4dcf76079fd5dd3313d Mon Sep 17 00:00:00 2001
From: Michael R Sweet Add a callback to convert entities to Unicode.
-int mxmlEntityAddCallback (void);mxmlEntityAddCallback
+ mxml_entity_cb_t cb
+);
0 on success, -1 on failure
Remove a callback.
-void mxmlEntityRemoveCallback (void);
+void mxmlEntityRemoveCallback (Find the named element.
@@ -1385,6 +1400,11 @@ typedef struct mxml_custom_s mxml_custom_t;
typedef struct mxml_element_s mxml_element_t;
+Entity callback function
++typedef int (*mxml_entity_cb_t)(const char *); +
Error callback function
diff --git a/mxml-entity.c b/mxml-entity.c
index 4416627..d7a9cb9 100644
--- a/mxml-entity.c
+++ b/mxml-entity.c
@@ -4,7 +4,7 @@
* Character entity support code for Mini-XML, a small XML-like
* file parsing library.
*
- * Copyright 2003-2007 by Michael Sweet.
+ * Copyright 2003-2009 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -41,7 +41,7 @@
int /* O - 0 on success, -1 on failure */
mxmlEntityAddCallback(
- int (*cb)(const char *name)) /* I - Callback function to add */
+ mxml_entity_cb_t cb) /* I - Callback function to add */
{
_mxml_global_t *global = _mxml_global();
/* Global data */
@@ -121,8 +121,8 @@ mxmlEntityGetValue(const char *name) /* I - Entity name */
*/
void
-mxmlEntityRemoveCallback(int (*cb)(const char *name))
- /* I - Callback function to remove */
+mxmlEntityRemoveCallback(
+ mxml_entity_cb_t cb) /* I - Callback function to remove */
{
int i; /* Looping var */
_mxml_global_t *global = _mxml_global();
diff --git a/mxml.h b/mxml.h
index 9efd0a2..2133cf9 100644
--- a/mxml.h
+++ b/mxml.h
@@ -3,7 +3,7 @@
*
* Header file for Mini-XML, a small XML-like file parsing library.
*
- * Copyright 2003-2007 by Michael Sweet.
+ * Copyright 2003-2009 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -161,6 +161,9 @@ typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *);
typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *);
/**** Custom data save callback function ****/
+typedef int (*mxml_entity_cb_t)(const char *);
+ /**** Entity callback function */
+
typedef mxml_type_t (*mxml_load_cb_t)(mxml_node_t *);
/**** Load callback function ****/
@@ -197,10 +200,10 @@ extern void mxmlElementSetAttrf(mxml_node_t *node, const char *name,
__attribute__ ((__format__ (__printf__, 3, 4)))
# endif /* __GNUC__ */
;
-extern int mxmlEntityAddCallback(int (*cb)(const char *name));
+extern int mxmlEntityAddCallback(mxml_entity_cb_t cb);
extern const char *mxmlEntityGetName(int val);
extern int mxmlEntityGetValue(const char *name);
-extern void mxmlEntityRemoveCallback(int (*cb)(const char *name));
+extern void mxmlEntityRemoveCallback(mxml_entity_cb_t cb);
extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top,
const char *name, const char *attr,
const char *value, int descend);
diff --git a/mxml.xml b/mxml.xml
index 4f474da..a17bbb1 100644
--- a/mxml.xml
+++ b/mxml.xml
@@ -118,6 +118,10 @@ is not an element.