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