blob: 180a40c04a90fcf487ea17d3799da0f97e3f0983 [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 */
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 Veillard011b63c1999-06-02 17:44:04 +000037 CHAR *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 Veillard1e346af1999-02-22 10:33:01 +000062void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
Daniel Veillard260a68f1998-08-13 03:39:55 +000063 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
Daniel Veillard1e346af1999-02-22 10:33:01 +000064void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
Daniel Veillard260a68f1998-08-13 03:39:55 +000065 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
Daniel Veillard1e346af1999-02-22 10:33:01 +000066xmlEntityPtr xmlGetPredefinedEntity(const CHAR *name);
67xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name);
68xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name);
Daniel Veillardb05deb71999-08-10 19:04:08 +000069xmlEntityPtr xmlGetParameterEntity(xmlDocPtr doc, const CHAR *name);
Daniel Veillard14fff061999-06-22 21:49:07 +000070const CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
71CHAR *xmlEncodeEntitiesReentrant(xmlDocPtr doc, const CHAR *input);
Daniel Veillard1e346af1999-02-22 10:33:01 +000072xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
73xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
74void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
Daniel Veillard5099ae81999-04-21 20:12:07 +000075void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table);
Daniel Veillard1e346af1999-02-22 10:33:01 +000076xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
Daniel Veillard260a68f1998-08-13 03:39:55 +000077
78#ifdef __cplusplus
79}
80#endif
81
82# endif /* __XML_ENTITIES_H__ */