blob: 5d6506d972608b7f180bb91b883dabdfc8675423 [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 Veillard1e346af1999-02-22 10:33:01 +000037} xmlEntity;
38typedef xmlEntity *xmlEntityPtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000039
40/*
41 * ALl entities are stored in a table there is one table per DTD
42 * and one extra per document.
43 */
44
45#define XML_MIN_ENTITIES_TABLE 32
46
47typedef struct xmlEntitiesTable {
48 int nb_entities; /* number of elements stored */
49 int max_entities; /* maximum number of elements */
Daniel Veillardbe36afe1998-11-27 06:39:50 +000050 xmlEntityPtr table; /* the table of entities */
Daniel Veillard1e346af1999-02-22 10:33:01 +000051} xmlEntitiesTable;
52typedef xmlEntitiesTable *xmlEntitiesTablePtr;
Daniel Veillard260a68f1998-08-13 03:39:55 +000053
Daniel Veillardccb09631998-10-27 06:21:04 +000054
Daniel Veillard260a68f1998-08-13 03:39:55 +000055/*
56 * External functions :
57 */
58
Daniel Veillard517752b1999-04-05 12:20:10 +000059#include "parser.h"
60
Daniel Veillard1e346af1999-02-22 10:33:01 +000061void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
Daniel Veillard260a68f1998-08-13 03:39:55 +000062 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
Daniel Veillard1e346af1999-02-22 10:33:01 +000063void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
Daniel Veillard260a68f1998-08-13 03:39:55 +000064 const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
Daniel Veillard1e346af1999-02-22 10:33:01 +000065xmlEntityPtr xmlGetPredefinedEntity(const CHAR *name);
66xmlEntityPtr xmlGetDocEntity(xmlDocPtr doc, const CHAR *name);
67xmlEntityPtr xmlGetDtdEntity(xmlDocPtr doc, const CHAR *name);
68CHAR *xmlEncodeEntities(xmlDocPtr doc, const CHAR *input);
69xmlEntitiesTablePtr xmlCreateEntitiesTable(void);
70xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
71void xmlFreeEntitiesTable(xmlEntitiesTablePtr table);
Daniel Veillard5099ae81999-04-21 20:12:07 +000072void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table);
Daniel Veillard1e346af1999-02-22 10:33:01 +000073xmlParserInputPtr xmlNewEntityInputStream(xmlParserCtxtPtr ctxt,
Daniel Veillardccb09631998-10-27 06:21:04 +000074 xmlEntityPtr entity);
Daniel Veillard1e346af1999-02-22 10:33:01 +000075xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table);
Daniel Veillard260a68f1998-08-13 03:39:55 +000076
77#ifdef __cplusplus
78}
79#endif
80
81# endif /* __XML_ENTITIES_H__ */