1/*
2 * Summary: interface for the XML entities handling
3 * Description: this module provides some of the entity API needed
4 *              for the parser and applications.
5 *
6 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Daniel Veillard
9 */
10
11#ifndef __XML_ENTITIES_H__
12#define __XML_ENTITIES_H__
13
14#include <libxml/xmlversion.h>
15#include <libxml/tree.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * The different valid entity types.
23 */
24typedef enum {
25    XML_INTERNAL_GENERAL_ENTITY = 1,
26    XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
27    XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
28    XML_INTERNAL_PARAMETER_ENTITY = 4,
29    XML_EXTERNAL_PARAMETER_ENTITY = 5,
30    XML_INTERNAL_PREDEFINED_ENTITY = 6
31} xmlEntityType;
32
33/*
34 * An unit of storage for an entity, contains the string, the value
35 * and the linkind data needed for the linking in the hash table.
36 */
37
38struct _xmlEntity {
39    void           *_private;	        /* application data */
40    xmlElementType          type;       /* XML_ENTITY_DECL, must be second ! */
41    const xmlChar          *name;	/* Entity name */
42    struct _xmlNode    *children;	/* First child link */
43    struct _xmlNode        *last;	/* Last child link */
44    struct _xmlDtd       *parent;	/* -> DTD */
45    struct _xmlNode        *next;	/* next sibling link  */
46    struct _xmlNode        *prev;	/* previous sibling link  */
47    struct _xmlDoc          *doc;       /* the containing document */
48
49    xmlChar                *orig;	/* content without ref substitution */
50    xmlChar             *content;	/* content or ndata if unparsed */
51    int                   length;	/* the content length */
52    xmlEntityType          etype;	/* The entity type */
53    const xmlChar    *ExternalID;	/* External identifier for PUBLIC */
54    const xmlChar      *SystemID;	/* URI for a SYSTEM or PUBLIC Entity */
55
56    struct _xmlEntity     *nexte;	/* unused */
57    const xmlChar           *URI;	/* the full URI as computed */
58    int                    owner;	/* does the entity own the childrens */
59};
60
61/*
62 * All entities are stored in an hash table.
63 * There is 2 separate hash tables for global and parameter entities.
64 */
65
66typedef struct _xmlHashTable xmlEntitiesTable;
67typedef xmlEntitiesTable *xmlEntitiesTablePtr;
68
69/*
70 * External functions:
71 */
72
73#ifdef LIBXML_LEGACY_ENABLED
74XMLPUBFUN void XMLCALL
75		xmlInitializePredefinedEntities	(void);
76#endif /* LIBXML_LEGACY_ENABLED */
77XMLPUBFUN xmlEntityPtr XMLCALL
78			xmlAddDocEntity		(xmlDocPtr doc,
79						 const xmlChar *name,
80						 int type,
81						 const xmlChar *ExternalID,
82						 const xmlChar *SystemID,
83						 const xmlChar *content);
84XMLPUBFUN xmlEntityPtr XMLCALL
85			xmlAddDtdEntity		(xmlDocPtr doc,
86						 const xmlChar *name,
87						 int type,
88						 const xmlChar *ExternalID,
89						 const xmlChar *SystemID,
90						 const xmlChar *content);
91XMLPUBFUN xmlEntityPtr XMLCALL
92			xmlGetPredefinedEntity	(const xmlChar *name);
93XMLPUBFUN xmlEntityPtr XMLCALL
94			xmlGetDocEntity		(xmlDocPtr doc,
95						 const xmlChar *name);
96XMLPUBFUN xmlEntityPtr XMLCALL
97			xmlGetDtdEntity		(xmlDocPtr doc,
98						 const xmlChar *name);
99XMLPUBFUN xmlEntityPtr XMLCALL
100			xmlGetParameterEntity	(xmlDocPtr doc,
101						 const xmlChar *name);
102#ifdef LIBXML_LEGACY_ENABLED
103XMLPUBFUN const xmlChar * XMLCALL
104			xmlEncodeEntities	(xmlDocPtr doc,
105						 const xmlChar *input);
106#endif /* LIBXML_LEGACY_ENABLED */
107XMLPUBFUN xmlChar * XMLCALL
108			xmlEncodeEntitiesReentrant(xmlDocPtr doc,
109						 const xmlChar *input);
110XMLPUBFUN xmlChar * XMLCALL
111			xmlEncodeSpecialChars	(xmlDocPtr doc,
112						 const xmlChar *input);
113XMLPUBFUN xmlEntitiesTablePtr XMLCALL
114			xmlCreateEntitiesTable	(void);
115#ifdef LIBXML_TREE_ENABLED
116XMLPUBFUN xmlEntitiesTablePtr XMLCALL
117			xmlCopyEntitiesTable	(xmlEntitiesTablePtr table);
118#endif /* LIBXML_TREE_ENABLED */
119XMLPUBFUN void XMLCALL
120			xmlFreeEntitiesTable	(xmlEntitiesTablePtr table);
121#ifdef LIBXML_OUTPUT_ENABLED
122XMLPUBFUN void XMLCALL
123			xmlDumpEntitiesTable	(xmlBufferPtr buf,
124						 xmlEntitiesTablePtr table);
125XMLPUBFUN void XMLCALL
126			xmlDumpEntityDecl	(xmlBufferPtr buf,
127						 xmlEntityPtr ent);
128#endif /* LIBXML_OUTPUT_ENABLED */
129#ifdef LIBXML_LEGACY_ENABLED
130XMLPUBFUN void XMLCALL
131			xmlCleanupPredefinedEntities(void);
132#endif /* LIBXML_LEGACY_ENABLED */
133
134
135#ifdef __cplusplus
136}
137#endif
138
139# endif /* __XML_ENTITIES_H__ */
140