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__ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 11 | |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 12 | #include "parser.h" |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 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 |
Daniel Veillard | 25940b7 | 1998-10-29 05:51:30 +0000 | [diff] [blame] | 23 | #define XML_INTERNAL_PREDEFINED_ENTITY 6 |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * An unit of storage for an entity, contains the string, the value |
| 27 | * and the linkind data needed for the linking in the hash table. |
| 28 | */ |
| 29 | |
| 30 | typedef struct xmlEntity { |
| 31 | int type; /* The entity type */ |
| 32 | int len; /* The lenght of the name */ |
| 33 | const CHAR *name; /* Name of the entity */ |
| 34 | const CHAR *ExternalID; /* External identifier for PUBLIC Entity */ |
| 35 | const CHAR *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ |
| 36 | CHAR *content; /* The entity content or ndata if unparsed */ |
| 37 | } xmlEntity, *xmlEntityPtr; |
| 38 | |
| 39 | /* |
| 40 | * ALl entities are stored in a table there is one table per DTD |
| 41 | * and one extra per document. |
| 42 | */ |
| 43 | |
| 44 | #define XML_MIN_ENTITIES_TABLE 32 |
| 45 | |
| 46 | typedef struct xmlEntitiesTable { |
| 47 | int nb_entities; /* number of elements stored */ |
| 48 | int max_entities; /* maximum number of elements */ |
Daniel Veillard | be36afe | 1998-11-27 06:39:50 +0000 | [diff] [blame] | 49 | xmlEntityPtr table; /* the table of entities */ |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 50 | } xmlEntitiesTable, *xmlEntitiesTablePtr; |
| 51 | |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 52 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 53 | /* |
| 54 | * External functions : |
| 55 | */ |
| 56 | |
| 57 | extern void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type, |
| 58 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
| 59 | extern void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type, |
| 60 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 61 | extern xmlEntityPtr xmlGetPredefinedEntity(const CHAR *name); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 62 | extern xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name); |
| 63 | extern xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name); |
| 64 | extern CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input); |
| 65 | extern xmlEntitiesTablePtr xmlCreateEntitiesTable(void); |
Daniel Veillard | be36afe | 1998-11-27 06:39:50 +0000 | [diff] [blame] | 66 | extern xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 67 | extern void xmlFreeEntitiesTable(xmlEntitiesTablePtr table); |
| 68 | extern void xmlDumpEntitiesTable(xmlEntitiesTablePtr table); |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 69 | extern xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, |
| 70 | xmlEntityPtr entity); |
Daniel Veillard | be36afe | 1998-11-27 06:39:50 +0000 | [diff] [blame] | 71 | extern xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 72 | |
| 73 | #ifdef __cplusplus |
| 74 | } |
| 75 | #endif |
| 76 | |
| 77 | # endif /* __XML_ENTITIES_H__ */ |