blob: 67180b1b4ab9131284eff0f0c2ab7b243ca37ebf [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 Veillard00fdf371999-10-08 09:40:39 +000037 xmlChar *orig; /* The entity cont without ref substitution */
Daniel Veillard1e346af1999-02-22 10:33:01 +000038} xmlEntity;
39typedef xmlEntity *xmlEntityPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000040
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
48typedef struct xmlEntitiesTable {
49 int nb_entities; /* number of elements stored */
50 int max_entities; /* maximum number of elements */
Daniel Veillardbe36afe1998-11-27 06:39:50 +000051 xmlEntityPtr table; /* the table of entities */
Daniel Veillard1e346af1999-02-22 10:33:01 +000052} xmlEntitiesTable;
53typedef xmlEntitiesTable *xmlEntitiesTablePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000054
Daniel Veillardccb09631998-10-27 06:21:04 +000055
Daniel Veillard260a68f1998-08-13 03:39:55 +000056/*
57 * External functions :
58 */
59
Daniel Veillard517752b1999-04-05 12:20:10 +000060#include "parser.h"
61
Daniel Veillardb96e6431999-08-29 21:02:19 +000062void xmlAddDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000063 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000064 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000065 const xmlChar *ExternalID,
66 const xmlChar *SystemID,
67 const xmlChar *content);
Daniel Veillardb96e6431999-08-29 21:02:19 +000068void xmlAddDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000069 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000070 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000071 const xmlChar *ExternalID,
72 const xmlChar *SystemID,
73 const xmlChar *content);
74xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000075xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000076 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000077xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000078 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000079xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000080 const xmlChar *name);
81const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
82 const xmlChar *input);
Daniel Veillard00fdf371999-10-08 09:40:39 +000083xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000084 const xmlChar *input);
Daniel Veillardb96e6431999-08-29 21:02:19 +000085xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
86xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
87void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
88void xmlDumpEntitiesTable (xmlBufferPtr buf,
89 xmlEntitiesTablePtr table);
90xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
Daniel Veillard260a68f1998-08-13 03:39:55 +000091
92#ifdef __cplusplus
93}
94#endif
95
96# endif /* __XML_ENTITIES_H__ */