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 | * |
| 6 | * $Id$ |
| 7 | */ |
| 8 | |
| 9 | #ifndef __XML_ENTITIES_H__ |
| 10 | #define __XML_ENTITIES_H__ |
| 11 | #include "parser.h" |
| 12 | |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | #define XML_INTERNAL_GENERAL_ENTITY 1 |
| 19 | #define XML_EXTERNAL_GENERAL_PARSED_ENTITY 2 |
| 20 | #define XML_EXTERNAL_GENERAL_UNPARSED_ENTITY 3 |
| 21 | #define XML_INTERNAL_PARAMETER_ENTITY 4 |
| 22 | #define XML_EXTERNAL_PARAMETER_ENTITY 5 |
| 23 | |
| 24 | /* |
| 25 | * An unit of storage for an entity, contains the string, the value |
| 26 | * and the linkind data needed for the linking in the hash table. |
| 27 | */ |
| 28 | |
| 29 | typedef struct xmlEntity { |
| 30 | int type; /* The entity type */ |
| 31 | int len; /* The lenght of the name */ |
| 32 | const CHAR *name; /* Name of the entity */ |
| 33 | const CHAR *ExternalID; /* External identifier for PUBLIC Entity */ |
| 34 | const CHAR *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ |
| 35 | CHAR *content; /* The entity content or ndata if unparsed */ |
| 36 | } xmlEntity, *xmlEntityPtr; |
| 37 | |
| 38 | /* |
| 39 | * ALl entities are stored in a table there is one table per DTD |
| 40 | * and one extra per document. |
| 41 | */ |
| 42 | |
| 43 | #define XML_MIN_ENTITIES_TABLE 32 |
| 44 | |
| 45 | typedef struct xmlEntitiesTable { |
| 46 | int nb_entities; /* number of elements stored */ |
| 47 | int max_entities; /* maximum number of elements */ |
| 48 | xmlEntityPtr table; /* the table of entities */ |
| 49 | } xmlEntitiesTable, *xmlEntitiesTablePtr; |
| 50 | |
| 51 | /* |
| 52 | * External functions : |
| 53 | */ |
| 54 | |
| 55 | extern void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type, |
| 56 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
| 57 | extern void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type, |
| 58 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
| 59 | extern xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name); |
| 60 | extern xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name); |
| 61 | extern CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input); |
| 62 | extern xmlEntitiesTablePtr xmlCreateEntitiesTable(void); |
| 63 | extern void xmlFreeEntitiesTable(xmlEntitiesTablePtr table); |
| 64 | extern void xmlDumpEntitiesTable(xmlEntitiesTablePtr table); |
| 65 | |
| 66 | #ifdef __cplusplus |
| 67 | } |
| 68 | #endif |
| 69 | |
| 70 | # endif /* __XML_ENTITIES_H__ */ |