Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * entities.h : interface for the XML entities handking |
| 3 | * |
| 4 | * See Copyright for the status of this software. |
| 5 | * |
Daniel Veillard | 39a1f9a | 1999-01-17 19:11:59 +0000 | [diff] [blame] | 6 | * Daniel.Veillard@w3.org |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __XML_ENTITIES_H__ |
| 10 | #define __XML_ENTITIES_H__ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 11 | |
Daniel Veillard | 361d845 | 2000-04-03 19:48:13 +0000 | [diff] [blame] | 12 | #include <libxml/tree.h> |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 18 | /* |
| 19 | * The different valid entity types |
| 20 | */ |
| 21 | typedef enum { |
| 22 | XML_INTERNAL_GENERAL_ENTITY = 1, |
| 23 | XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, |
| 24 | XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, |
| 25 | XML_INTERNAL_PARAMETER_ENTITY = 4, |
| 26 | XML_EXTERNAL_PARAMETER_ENTITY = 5, |
| 27 | XML_INTERNAL_PREDEFINED_ENTITY = 6 |
| 28 | } xmlEntityType; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 29 | |
| 30 | /* |
| 31 | * An unit of storage for an entity, contains the string, the value |
| 32 | * and the linkind data needed for the linking in the hash table. |
| 33 | */ |
| 34 | |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 35 | typedef struct _xmlEntity xmlEntity; |
| 36 | typedef xmlEntity *xmlEntityPtr; |
| 37 | struct _xmlEntity { |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 38 | #ifndef XML_WITHOUT_CORBA |
| 39 | void *_private; /* for Corba, must be first ! */ |
| 40 | #endif |
| 41 | xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ |
| 42 | const xmlChar *name; /* Attribute name */ |
| 43 | struct _xmlNode *children; /* NULL */ |
| 44 | struct _xmlNode *last; /* NULL */ |
| 45 | struct _xmlDtd *parent; /* -> DTD */ |
| 46 | struct _xmlNode *next; /* next sibling link */ |
| 47 | struct _xmlNode *prev; /* previous sibling link */ |
| 48 | struct _xmlDoc *doc; /* the containing document */ |
| 49 | |
| 50 | xmlChar *orig; /* content without ref substitution */ |
| 51 | xmlChar *content; /* content or ndata if unparsed */ |
| 52 | int length; /* the content length */ |
| 53 | xmlEntityType etype; /* The entity type */ |
| 54 | const xmlChar *ExternalID; /* External identifier for PUBLIC */ |
| 55 | const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ |
| 56 | |
Daniel Veillard | 52afe80 | 2000-10-22 16:56:02 +0000 | [diff] [blame] | 57 | struct _xmlEntity *nexte; /* unused */ |
Daniel Veillard | 39c7d71 | 2000-09-10 16:14:55 +0000 | [diff] [blame] | 58 | const xmlChar *URI; /* the full URI as computed */ |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 59 | }; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 60 | |
| 61 | /* |
Daniel Veillard | 52afe80 | 2000-10-22 16:56:02 +0000 | [diff] [blame] | 62 | * ALl entities are stored in an hash table |
| 63 | * there is 2 separate hash tables for global and parmeter entities |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 64 | */ |
| 65 | |
Daniel Veillard | 52afe80 | 2000-10-22 16:56:02 +0000 | [diff] [blame] | 66 | typedef struct _xmlHashTable xmlEntitiesTable; |
Daniel Veillard | 71b656e | 2000-01-05 14:46:17 +0000 | [diff] [blame] | 67 | typedef xmlEntitiesTable *xmlEntitiesTablePtr; |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 68 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 69 | /* |
| 70 | * External functions : |
| 71 | */ |
| 72 | |
Daniel Veillard | bc76530 | 2000-10-01 18:23:35 +0000 | [diff] [blame] | 73 | void xmlInitializePredefinedEntities (void); |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 74 | xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 75 | const xmlChar *name, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 76 | int type, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 77 | const xmlChar *ExternalID, |
| 78 | const xmlChar *SystemID, |
| 79 | const xmlChar *content); |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 80 | xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 81 | const xmlChar *name, |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 82 | int type, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 83 | const xmlChar *ExternalID, |
| 84 | const xmlChar *SystemID, |
| 85 | const xmlChar *content); |
| 86 | xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 87 | xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 88 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 89 | xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 90 | const xmlChar *name); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 91 | xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 92 | const xmlChar *name); |
| 93 | const xmlChar * xmlEncodeEntities (xmlDocPtr doc, |
| 94 | const xmlChar *input); |
Daniel Veillard | 00fdf37 | 1999-10-08 09:40:39 +0000 | [diff] [blame] | 95 | xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc, |
Daniel Veillard | dd6b367 | 1999-09-23 22:19:22 +0000 | [diff] [blame] | 96 | const xmlChar *input); |
Daniel Veillard | be80396 | 2000-06-28 23:40:59 +0000 | [diff] [blame] | 97 | xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc, |
| 98 | const xmlChar *input); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 99 | xmlEntitiesTablePtr xmlCreateEntitiesTable (void); |
| 100 | xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table); |
| 101 | void xmlFreeEntitiesTable (xmlEntitiesTablePtr table); |
| 102 | void xmlDumpEntitiesTable (xmlBufferPtr buf, |
| 103 | xmlEntitiesTablePtr table); |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 104 | void xmlDumpEntityDecl (xmlBufferPtr buf, |
| 105 | xmlEntityPtr ent); |
Daniel Veillard | b96e643 | 1999-08-29 21:02:19 +0000 | [diff] [blame] | 106 | xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table); |
Daniel Veillard | a594bf4 | 1999-12-01 09:51:45 +0000 | [diff] [blame] | 107 | void xmlCleanupPredefinedEntities(void); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 108 | |
Daniel Veillard | cf46199 | 2000-03-14 18:30:20 +0000 | [diff] [blame] | 109 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 110 | #ifdef __cplusplus |
| 111 | } |
| 112 | #endif |
| 113 | |
| 114 | # endif /* __XML_ENTITIES_H__ */ |