blob: 305d043c3d1e9cc91af5aeae65ef326030ab5612 [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 Veillard361d8452000-04-03 19:48:13 +000012#include <libxml/tree.h>
Daniel Veillard260a68f1998-08-13 03:39:55 +000013
14#ifdef __cplusplus
15extern "C" {
16#endif
17
Daniel Veillardcf461992000-03-14 18:30:20 +000018/*
19 * The different valid entity types
20 */
21typedef enum {
22 XML_INTERNAL_GENERAL_ENTITY = 1,
23 XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
24 XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
25 XML_INTERNAL_PARAMETER_ENTITY = 4,
26 XML_EXTERNAL_PARAMETER_ENTITY = 5,
27 XML_INTERNAL_PREDEFINED_ENTITY = 6
28} xmlEntityType;
Daniel Veillard260a68f1998-08-13 03:39:55 +000029
30/*
31 * An unit of storage for an entity, contains the string, the value
32 * and the linkind data needed for the linking in the hash table.
33 */
34
Daniel Veillard71b656e2000-01-05 14:46:17 +000035typedef struct _xmlEntity xmlEntity;
36typedef xmlEntity *xmlEntityPtr;
37struct _xmlEntity {
Daniel Veillardcf461992000-03-14 18:30:20 +000038#ifndef XML_WITHOUT_CORBA
39 void *_private; /* for Corba, must be first ! */
40#endif
41 xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
42 const xmlChar *name; /* Attribute name */
43 struct _xmlNode *children; /* NULL */
44 struct _xmlNode *last; /* NULL */
45 struct _xmlDtd *parent; /* -> DTD */
46 struct _xmlNode *next; /* next sibling link */
47 struct _xmlNode *prev; /* previous sibling link */
48 struct _xmlDoc *doc; /* the containing document */
49
50 xmlChar *orig; /* content without ref substitution */
51 xmlChar *content; /* content or ndata if unparsed */
52 int length; /* the content length */
53 xmlEntityType etype; /* The entity type */
54 const xmlChar *ExternalID; /* External identifier for PUBLIC */
55 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
56
Daniel Veillard52afe802000-10-22 16:56:02 +000057 struct _xmlEntity *nexte; /* unused */
Daniel Veillard39c7d712000-09-10 16:14:55 +000058 const xmlChar *URI; /* the full URI as computed */
Daniel Veillard71b656e2000-01-05 14:46:17 +000059};
Daniel Veillard260a68f1998-08-13 03:39:55 +000060
61/*
Daniel Veillard52afe802000-10-22 16:56:02 +000062 * ALl entities are stored in an hash table
63 * there is 2 separate hash tables for global and parmeter entities
Daniel Veillard260a68f1998-08-13 03:39:55 +000064 */
65
Daniel Veillard52afe802000-10-22 16:56:02 +000066typedef struct _xmlHashTable xmlEntitiesTable;
Daniel Veillard71b656e2000-01-05 14:46:17 +000067typedef xmlEntitiesTable *xmlEntitiesTablePtr;
Daniel Veillardccb09631998-10-27 06:21:04 +000068
Daniel Veillard260a68f1998-08-13 03:39:55 +000069/*
70 * External functions :
71 */
72
Daniel Veillardbc765302000-10-01 18:23:35 +000073void xmlInitializePredefinedEntities (void);
Daniel Veillardcf461992000-03-14 18:30:20 +000074xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000075 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000076 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000077 const xmlChar *ExternalID,
78 const xmlChar *SystemID,
79 const xmlChar *content);
Daniel Veillardcf461992000-03-14 18:30:20 +000080xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000081 const xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +000082 int type,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000083 const xmlChar *ExternalID,
84 const xmlChar *SystemID,
85 const xmlChar *content);
86xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000087xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000088 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000089xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000090 const xmlChar *name);
Daniel Veillardb96e6431999-08-29 21:02:19 +000091xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000092 const xmlChar *name);
93const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
94 const xmlChar *input);
Daniel Veillard00fdf371999-10-08 09:40:39 +000095xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
Daniel Veillarddd6b3671999-09-23 22:19:22 +000096 const xmlChar *input);
Daniel Veillardbe803962000-06-28 23:40:59 +000097xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc,
98 const xmlChar *input);
Daniel Veillardb96e6431999-08-29 21:02:19 +000099xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
100xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
101void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
102void xmlDumpEntitiesTable (xmlBufferPtr buf,
103 xmlEntitiesTablePtr table);
Daniel Veillardcf461992000-03-14 18:30:20 +0000104void xmlDumpEntityDecl (xmlBufferPtr buf,
105 xmlEntityPtr ent);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000106xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
Daniel Veillarda594bf41999-12-01 09:51:45 +0000107void xmlCleanupPredefinedEntities(void);
Daniel Veillard260a68f1998-08-13 03:39:55 +0000108
Daniel Veillardcf461992000-03-14 18:30:20 +0000109
Daniel Veillard260a68f1998-08-13 03:39:55 +0000110#ifdef __cplusplus
111}
112#endif
113
114# endif /* __XML_ENTITIES_H__ */