entities.h
1 /*
2 * entities.h : interface for the XML entities handling
3 *
4 * See Copyright for the status of this software.
5 *
6 * daniel@veillard.com
7 */
8
9 #ifndef __XML_ENTITIES_H__
10 #define __XML_ENTITIES_H__
11
12 #include
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /*
19 * The different valid entity types.
20 */
21 typedef enum { <XML_INTERNAL_GENERAL_ENTITY> <XML_EXTERNAL_GENERAL_PARSED_ENTITY> <XML_EXTERNAL_GENERAL_UNPARSED_ENTITY> <XML_INTERNAL_PARAMETER_ENTITY> <XML_EXTERNAL_PARAMETER_ENTITY> <XML_INTERNAL_PREDEFINED_ENTITY>
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; <typedef:xmlEntityType>
29
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
35 struct _xmlEntity {
36 void *_private; /* application data */
37 xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
38 const xmlChar *name; /* Entity name */
39 struct _xmlNode *children; /* First child link */
40 struct _xmlNode *last; /* Last child link */
41 struct _xmlDtd *parent; /* -> DTD */
42 struct _xmlNode *next; /* next sibling link */
43 struct _xmlNode *prev; /* previous sibling link */
44 struct _xmlDoc *doc; /* the containing document */
45
46 xmlChar *orig; /* content without ref substitution */
47 xmlChar *content; /* content or ndata if unparsed */
48 int length; /* the content length */
49 xmlEntityType etype; /* The entity type */
50 const xmlChar *ExternalID; /* External identifier for PUBLIC */
51 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
52
53 struct _xmlEntity *nexte; /* unused */
54 const xmlChar *URI; /* the full URI as computed */
55 };
56
57 /*
58 * All entities are stored in an hash table.
59 * There is 2 separate hash tables for global and parameter entities.
60 */
61
62 typedef struct _xmlHashTable xmlEntitiesTable; <typedef:xmlEntitiesTable>
63 typedef xmlEntitiesTable *xmlEntitiesTablePtr; <typedef:xmlEntitiesTablePtr>
64
65 /*
66 * External functions:
67 */
68
69 void xmlInitializePredefinedEntities (void);
70 xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
71 const xmlChar *name,
72 int type,
73 const xmlChar *ExternalID,
74 const xmlChar *SystemID,
75 const xmlChar *content);
76 xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc,
77 const xmlChar *name,
78 int type,
79 const xmlChar *ExternalID,
80 const xmlChar *SystemID,
81 const xmlChar *content);
82 xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
83 xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
84 const xmlChar *name);
85 xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
86 const xmlChar *name);
87 xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
88 const xmlChar *name);
89 const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
90 const xmlChar *input);
91 xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
92 const xmlChar *input);
93 xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc,
94 const xmlChar *input);
95 xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
96 xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
97 void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
98 void xmlDumpEntitiesTable (xmlBufferPtr buf,
99 xmlEntitiesTablePtr table);
100 void xmlDumpEntityDecl (xmlBufferPtr buf,
101 xmlEntityPtr ent);
102 void xmlCleanupPredefinedEntities(void);
103
104
105 #ifdef __cplusplus
106 }
107 #endif
108
109 # endif /* __XML_ENTITIES_H__ */