Daniel Veillard | 01791d5 | 1998-07-24 19:24:09 +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 "xml_parser.h" |
| 12 | |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /* |
| 19 | * An unit of storage for an entity, contains the string, the value |
| 20 | * and the linkind data needed for the linking in the hash table. |
| 21 | */ |
| 22 | |
| 23 | typedef struct xmlEntity { |
| 24 | const CHAR *id; /* The entity name */ |
| 25 | CHAR *value; /* The entity CHAR equivalent */ |
| 26 | } xmlEntity, *xmlEntityPtr; |
| 27 | |
| 28 | /* |
| 29 | * ALl entities are stored in a table there is one table per DTD |
| 30 | * and one extra per document. |
| 31 | */ |
| 32 | |
| 33 | #define XML_MIN_ENTITIES_TABLE 32 |
| 34 | |
| 35 | typedef struct xmlEntitiesTable { |
| 36 | int nb_entities; /* number of elements stored */ |
| 37 | int max_entities; /* maximum number of elements */ |
| 38 | xmlEntityPtr table; /* the table of entities */ |
| 39 | } xmlEntitiesTable, *xmlEntitiesTablePtr; |
| 40 | |
| 41 | /* |
| 42 | * External functions : |
| 43 | */ |
| 44 | |
| 45 | extern void xmlAddDocEntity(xmlDocPtr doc, CHAR *value, const CHAR *id); |
| 46 | extern void xmlAddDtdEntity(xmlDtdPtr dtd, CHAR *value, const CHAR *id); |
| 47 | extern CHAR *xmlGetEntity(xmlDocPtr doc, const CHAR *id); |
| 48 | extern CHAR *xmlSubstituteEntities(xmlDocPtr doc, const CHAR *input); |
| 49 | extern CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input); |
| 50 | extern CHAR *xmlDecodeEntities(xmlDocPtr doc, const CHAR *input, int len); |
| 51 | extern xmlEntitiesTablePtr xmlCreateEntitiesTable(void); |
| 52 | extern void xmlFreeEntitiesTable(xmlEntitiesTablePtr table); |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | } |
| 56 | #endif |
| 57 | |
| 58 | # endif /* __XML_ENTITIES_H__ */ |