blob: f6b03c3ebd6d34ea65a311980ab64b9e91a6ee93 [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 *
6 * $Id$
7 */
8
9#ifndef __XML_ENTITIES_H__
10#define __XML_ENTITIES_H__
Daniel Veillard260a68f1998-08-13 03:39:55 +000011
Daniel Veillardccb09631998-10-27 06:21:04 +000012#include "parser.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 */
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
46typedef struct xmlEntitiesTable {
47 int nb_entities; /* number of elements stored */
48 int max_entities; /* maximum number of elements */
49 xmlEntityPtr table; /* the table of entities */
50} xmlEntitiesTable, *xmlEntitiesTablePtr;
51
Daniel Veillardccb09631998-10-27 06:21:04 +000052
Daniel Veillard260a68f1998-08-13 03:39:55 +000053/*
54 * External functions :
55 */
56
57extern void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
58 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
59extern void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
60 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
Daniel Veillardccb09631998-10-27 06:21:04 +000061extern xmlEntityPtr xmlGetPredefinedEntity(const CHAR *name);
Daniel Veillard260a68f1998-08-13 03:39:55 +000062extern xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name);
63extern xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name);
64extern CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
65extern xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
66extern void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
67extern void xmlDumpEntitiesTable(xmlEntitiesTablePtr table);
Daniel Veillardccb09631998-10-27 06:21:04 +000068extern xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt,
69 xmlEntityPtr entity);
Daniel Veillard260a68f1998-08-13 03:39:55 +000070
71#ifdef __cplusplus
72}
73#endif
74
75# endif /* __XML_ENTITIES_H__ */