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 | 517752b | 1999-04-05 12:20:10 +0000 | [diff] [blame] | 12 | #include "tree.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 */ |
Daniel Veillard | 011b63c | 1999-06-02 17:44:04 +0000 | [diff] [blame] | 37 | CHAR *orig; /* The entity cont without ref substitution */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 38 | } xmlEntity; |
| 39 | typedef xmlEntity *xmlEntityPtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * ALl entities are stored in a table there is one table per DTD |
| 43 | * and one extra per document. |
| 44 | */ |
| 45 | |
| 46 | #define XML_MIN_ENTITIES_TABLE 32 |
| 47 | |
| 48 | typedef struct xmlEntitiesTable { |
| 49 | int nb_entities; /* number of elements stored */ |
| 50 | int max_entities; /* maximum number of elements */ |
Daniel Veillard | be36afe | 1998-11-27 06:39:50 +0000 | [diff] [blame] | 51 | xmlEntityPtr table; /* the table of entities */ |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 52 | } xmlEntitiesTable; |
| 53 | typedef xmlEntitiesTable *xmlEntitiesTablePtr; |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 54 | |
Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame] | 55 | |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 56 | /* |
| 57 | * External functions : |
| 58 | */ |
| 59 | |
Daniel Veillard | 517752b | 1999-04-05 12:20:10 +0000 | [diff] [blame] | 60 | #include "parser.h" |
| 61 | |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 62 | void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 63 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 64 | void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type, |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 65 | const CHAR *ExternalID, const CHAR *SystemID, CHAR *content); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 66 | xmlEntityPtr xmlGetPredefinedEntity(const CHAR *name); |
| 67 | xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name); |
| 68 | xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name); |
Daniel Veillard | b05deb7 | 1999-08-10 19:04:08 +0000 | [diff] [blame] | 69 | xmlEntityPtr xmlGetParameterEntity(xmlDocPtr doc, const CHAR *name); |
Daniel Veillard | 14fff06 | 1999-06-22 21:49:07 +0000 | [diff] [blame] | 70 | const CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input); |
| 71 | CHAR *xmlEncodeEntitiesReentrant(xmlDocPtr doc, const CHAR *input); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 72 | xmlEntitiesTablePtr xmlCreateEntitiesTable(void); |
| 73 | xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table); |
| 74 | void xmlFreeEntitiesTable(xmlEntitiesTablePtr table); |
Daniel Veillard | 5099ae8 | 1999-04-21 20:12:07 +0000 | [diff] [blame] | 75 | void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table); |
Daniel Veillard | 1e346af | 1999-02-22 10:33:01 +0000 | [diff] [blame] | 76 | xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table); |
Daniel Veillard | 260a68f | 1998-08-13 03:39:55 +0000 | [diff] [blame] | 77 | |
| 78 | #ifdef __cplusplus |
| 79 | } |
| 80 | #endif |
| 81 | |
| 82 | # endif /* __XML_ENTITIES_H__ */ |