| 1 |
/** |
| 2 |
* @file |
| 3 |
* |
| 4 |
* @brief XML entities |
| 5 |
* |
| 6 |
* This module provides an API to work with XML entities. |
| 7 |
* |
| 8 |
* @copyright See Copyright for the status of this software. |
| 9 |
* |
| 10 |
* @author Daniel Veillard |
| 11 |
*/ |
| 12 |
|
| 13 |
#ifndef __XML_ENTITIES_H__ |
| 14 |
#define __XML_ENTITIES_H__ |
| 15 |
|
| 16 |
#include <libxml/xmlversion.h> |
| 17 |
#define XML_TREE_INTERNALS |
| 18 |
#include <libxml/tree.h> |
| 19 |
#undef XML_TREE_INTERNALS |
| 20 |
|
| 21 |
#ifdef __cplusplus |
| 22 |
extern "C" { |
| 23 |
#endif |
| 24 |
|
| 25 |
/** |
| 26 |
* The different entity types. |
| 27 |
*/ |
| 28 |
typedef enum { |
| 29 |
/** internal general entity */ |
| 30 |
XML_INTERNAL_GENERAL_ENTITY = 1, |
| 31 |
/** external general parsed entity */ |
| 32 |
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, |
| 33 |
/** external general unparsed entity */ |
| 34 |
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, |
| 35 |
/** internal parameter entity */ |
| 36 |
XML_INTERNAL_PARAMETER_ENTITY = 4, |
| 37 |
/** external parameter entity */ |
| 38 |
XML_EXTERNAL_PARAMETER_ENTITY = 5, |
| 39 |
/** internal predefined entity */ |
| 40 |
XML_INTERNAL_PREDEFINED_ENTITY = 6 |
| 41 |
} xmlEntityType; |
| 42 |
|
| 43 |
/** |
| 44 |
* An entity declaration |
| 45 |
*/ |
| 46 |
struct _xmlEntity { |
| 47 |
/** application data */ |
| 48 |
void *_private; |
| 49 |
/** XML_ENTITY_DECL, must be second ! */ |
| 50 |
xmlElementType type; |
| 51 |
/** Entity name */ |
| 52 |
const xmlChar *name; |
| 53 |
/** First child link */ |
| 54 |
struct _xmlNode *children; |
| 55 |
/** Last child link */ |
| 56 |
struct _xmlNode *last; |
| 57 |
/** -> DTD */ |
| 58 |
struct _xmlDtd *parent; |
| 59 |
/** next sibling link */ |
| 60 |
struct _xmlNode *next; |
| 61 |
/** previous sibling link */ |
| 62 |
struct _xmlNode *prev; |
| 63 |
/** the containing document */ |
| 64 |
struct _xmlDoc *doc; |
| 65 |
|
| 66 |
/** content without ref substitution */ |
| 67 |
xmlChar *orig; |
| 68 |
/** content or ndata if unparsed */ |
| 69 |
xmlChar *content; |
| 70 |
/** the content length */ |
| 71 |
int length; |
| 72 |
/** The entity type */ |
| 73 |
xmlEntityType etype; |
| 74 |
/** External identifier for PUBLIC */ |
| 75 |
const xmlChar *ExternalID; |
| 76 |
/** URI for a SYSTEM or PUBLIC Entity */ |
| 77 |
const xmlChar *SystemID; |
| 78 |
|
| 79 |
/** unused */ |
| 80 |
struct _xmlEntity *nexte; |
| 81 |
/** the full URI as computed */ |
| 82 |
const xmlChar *URI; |
| 83 |
/** unused */ |
| 84 |
int owner; |
| 85 |
/** various flags */ |
| 86 |
int flags; |
| 87 |
/** expanded size */ |
| 88 |
unsigned long expandedSize; |
| 89 |
}; |
| 90 |
|
| 91 |
typedef struct _xmlHashTable xmlEntitiesTable; |
| 92 |
typedef xmlEntitiesTable *xmlEntitiesTablePtr; |
| 93 |
|
| 94 |
XMLPUBFUN xmlEntity * |
| 95 |
xmlNewEntity (xmlDoc *doc, |
| 96 |
const xmlChar *name, |
| 97 |
int type, |
| 98 |
const xmlChar *publicId, |
| 99 |
const xmlChar *systemId, |
| 100 |
const xmlChar *content); |
| 101 |
XMLPUBFUN void |
| 102 |
xmlFreeEntity (xmlEntity *entity); |
| 103 |
XMLPUBFUN int |
| 104 |
xmlAddEntity (xmlDoc *doc, |
| 105 |
int extSubset, |
| 106 |
const xmlChar *name, |
| 107 |
int type, |
| 108 |
const xmlChar *publicId, |
| 109 |
const xmlChar *systemId, |
| 110 |
const xmlChar *content, |
| 111 |
xmlEntity **out); |
| 112 |
XMLPUBFUN xmlEntity * |
| 113 |
xmlAddDocEntity (xmlDoc *doc, |
| 114 |
const xmlChar *name, |
| 115 |
int type, |
| 116 |
const xmlChar *publicId, |
| 117 |
const xmlChar *systemId, |
| 118 |
const xmlChar *content); |
| 119 |
XMLPUBFUN xmlEntity * |
| 120 |
xmlAddDtdEntity (xmlDoc *doc, |
| 121 |
const xmlChar *name, |
| 122 |
int type, |
| 123 |
const xmlChar *publicId, |
| 124 |
const xmlChar *systemId, |
| 125 |
const xmlChar *content); |
| 126 |
XMLPUBFUN xmlEntity * |
| 127 |
xmlGetPredefinedEntity (const xmlChar *name); |
| 128 |
XMLPUBFUN xmlEntity * |
| 129 |
xmlGetDocEntity (const xmlDoc *doc, |
| 130 |
const xmlChar *name); |
| 131 |
XMLPUBFUN xmlEntity * |
| 132 |
xmlGetDtdEntity (xmlDoc *doc, |
| 133 |
const xmlChar *name); |
| 134 |
XMLPUBFUN xmlEntity * |
| 135 |
xmlGetParameterEntity (xmlDoc *doc, |
| 136 |
const xmlChar *name); |
| 137 |
XMLPUBFUN xmlChar * |
| 138 |
xmlEncodeEntitiesReentrant(xmlDoc *doc, |
| 139 |
const xmlChar *input); |
| 140 |
XMLPUBFUN xmlChar * |
| 141 |
xmlEncodeSpecialChars (const xmlDoc *doc, |
| 142 |
const xmlChar *input); |
| 143 |
XML_DEPRECATED |
| 144 |
XMLPUBFUN xmlEntitiesTable * |
| 145 |
xmlCreateEntitiesTable (void); |
| 146 |
XML_DEPRECATED |
| 147 |
XMLPUBFUN xmlEntitiesTable * |
| 148 |
xmlCopyEntitiesTable (xmlEntitiesTable *table); |
| 149 |
XML_DEPRECATED |
| 150 |
XMLPUBFUN void |
| 151 |
xmlFreeEntitiesTable (xmlEntitiesTable *table); |
| 152 |
#ifdef LIBXML_OUTPUT_ENABLED |
| 153 |
XML_DEPRECATED |
| 154 |
XMLPUBFUN void |
| 155 |
xmlDumpEntitiesTable (xmlBuffer *buf, |
| 156 |
xmlEntitiesTable *table); |
| 157 |
XML_DEPRECATED |
| 158 |
XMLPUBFUN void |
| 159 |
xmlDumpEntityDecl (xmlBuffer *buf, |
| 160 |
xmlEntity *ent); |
| 161 |
#endif /* LIBXML_OUTPUT_ENABLED */ |
| 162 |
|
| 163 |
#ifdef __cplusplus |
| 164 |
} |
| 165 |
#endif |
| 166 |
|
| 167 |
# endif /* __XML_ENTITIES_H__ */ |