blob: 84ad7c162ee9aeb7c44f31a01b0de8cd1a848bc7 [file] [log] [blame]
Daniel Veillard260a68f1998-08-13 03:39:55 +00001/*
2 * entities.h : interface for the XML entities handking
3 *
4 * See Copyright for the status of this software.
5 *
Daniel Veillard39a1f9a1999-01-17 19:11:59 +00006 * Daniel.Veillard@w3.org
Daniel Veillard260a68f1998-08-13 03:39:55 +00007 */
8
9#ifndef __XML_ENTITIES_H__
10#define __XML_ENTITIES_H__
Daniel Veillard260a68f1998-08-13 03:39:55 +000011
Daniel Veillard517752b1999-04-05 12:20:10 +000012#include "tree.h"
Daniel Veillard260a68f1998-08-13 03:39:55 +000013
14#ifdef __cplusplus
15extern "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 Veillard25940b71998-10-29 05:51:30 +000023#define XML_INTERNAL_PREDEFINED_ENTITY 6
Daniel Veillard260a68f1998-08-13 03:39:55 +000024
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
30typedef struct xmlEntity {
31 int type; /* The entity type */
32 int len; /* The lenght of the name */
Daniel Veillard00fdf371999-10-08 09:40:39 +000033 const xmlChar *name; /* Name of the entity */
34 const xmlChar *ExternalID; /* External identifier for PUBLIC Entity */
35 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
Daniel Veillarddd6b3671999-09-23 22:19:22 +000036 xmlChar *content; /* The entity content or ndata if unparsed */
Daniel Veillarddbfd6411999-12-28 16:35:14 +000037 int length; /* the content length */
Daniel Veillard00fdf371999-10-08 09:40:39 +000038 xmlChar *orig; /* The entity cont without ref substitution */
Daniel Veillard1e346af1999-02-22 10:33:01 +000039} xmlEntity;
40typedef xmlEntity *xmlEntityPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000041
42/*
43 * ALl entities are stored in a table there is one table per DTD
44 * and one extra per document.
45 */
46
47#define XML_MIN_ENTITIES_TABLE 32
48
49typedef struct xmlEntitiesTable {
50 int nb_entities; /* number of elements stored */
51 int max_entities; /* maximum number of elements */
Daniel Veillardbe36afe1998-11-27 06:39:50 +000052 xmlEntityPtr table; /* the table of entities */
Daniel Veillard1e346af1999-02-22 10:33:01 +000053} xmlEntitiesTable;
54typedef xmlEntitiesTable *xmlEntitiesTablePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000055
Daniel Veillardccb09631998-10-27 06:21:04 +000056
Daniel Veillard260a68f1998-08-13 03:39:55 +000057/*
58 * External functions :
59 */
60
Daniel Veillardb96e6431999-08-29 21:02:19 +000061void xmlAddDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000062 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000063 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000064 const xmlChar *ExternalID,
65 const xmlChar *SystemID,
66 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +000067void xmlAddDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000068 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000069 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000070 const xmlChar *ExternalID,
71 const xmlChar *SystemID,
72 const xmlChar *content);
73xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000074xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000075 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000076xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000077 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000078xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000079 const xmlChar *name);
80const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
81 const xmlChar *input);
Daniel Veillard00fdf371999-10-08 09:40:39 +000082xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000083 const xmlChar *input);
Daniel Veillardb96e6431999-08-29 21:02:19 +000084xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
85xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
86void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
87void xmlDumpEntitiesTable (xmlBufferPtr buf,
88 xmlEntitiesTablePtr table);
89xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
Daniel Veillarda594bf41999-12-01 09:51:45 +000090void xmlCleanupPredefinedEntities(void);
Daniel Veillard260a68f1998-08-13 03:39:55 +000091
92#ifdef __cplusplus
93}
94#endif
95
96# endif /* __XML_ENTITIES_H__ */